Java interacting directly with a DB file - java

Before I started learning and using Java I used VB. In VB, a program can open a Microsoft Access database file and view/edit the records. VB has a component that handles the file and parsing. What I am looking for is a Java program that can open a database file directly. What I am not looking for is Java communicating with a SQL server a database server or any other kind of server. I have tried to search the net for Java and databases but all I am able to find is Java protocols that communicate with a server or a Java server service. Those items fill the search records on all of the search engines I have tried. I have found that DB's can be XML, and that Java can open them but, it seems that it no longer preserves the relational aspects. I may be wrong on that fact, I am uncertain.
A. Can Java open a local DB file?
B. Can that preserve the relational aspects?C. Can multiple Java programs open the same DB file?
D. If a Java program on computer A modifies the DB file will the Java program on computer B know about that change and update itself?
Assuming they are not modifying the same record. The type of DB file is not that important to but it would be nice if it could be opened by MS Access. It would also be nice if it could be open by JAVADB. Neither of those two are required.
E. what kind of components or projects could meet this need?

Pure Java hasn't graphic design. Some degree of design of databases have IDE, for example Eclipse in perspectives: Database Debug, Database development. Can view tables, design columns etc.
It isn't full desktop tool for (semi) amateur computer worker.
In Java can write full comfortable user database program (in example Open Office "Base" has some dependencies to Java), with filling similar to entry level access.

For simpler database like sqlite there are several java projects that you can use, for example sqlite 4 java.
Sqlite is pretty good these days and for small databases a good choice.

Related

MySQL Commands into .DBF Tables

I am currently writing a database system in Java that writes and reads to a MySQL database hosted on XAMPP. The system is fully up and running using MySQL commands to select, update, add, delete etc.
The issue is that we are currently using an old database written in Visual FoxPro that has its tables stored as .DBF files. Rather than taking a few years to get a fully working system and then moving everybody over to the MySQL system at once, we would like to have both systems working concurrently with gradually more people beginning to move over and use the MySQL system.
This is where I am having issues. Is there a way to both update a MySQL table and .DBF file when a job is added through the Java program? Is it as simple as using a MySQL command to directly modify the file? I understand there could be possibilities in Python or PHP however I have never learnt either of these languages and would prefer an easier solution.
Trying to keep two databases in synch is a bad idea. If you miss something and the data no longer matches, how will you know which is right? (A man with one clock always knows what time it is; a man with two is never sure.)
If the existing system is complex enough, maybe consider moving one module at a time.
If the existing system is well-written, it might be possible to switch it to work with MySQL without too much effort. That said, my experience is that very few applications are well enough designed and written to make that a simple task.
Alternatively, you might set up your new system with some kind of wrapper that talks to the existing DBFs until you're done and then can easily switch to MySQL.

connecting onedrive api to database

I have a problem where I am supposed to create an application (Preferably Java) which extracts data (Excel sheet) from onedrive account of different users and store that in a database.
I went through different resources on internet to look for the same. But i couldn't find any REST API for JAVA Applications (Although there is for Android).
Any pointers in solving above problem would be really helpful.
Thanks
Excel Datasource
As much of a fan as I am of OneDrive, it is really about storing file information not relational data. It sounds like your problem would be best solved with a connected Excel data source as seen below in this example. This will require that you setup an accessible datasource (Setting up a DB, API, or file backed source). Using the following menu should allow you to creation the relationship with the excel presentation.
Straight-forwards APIs
Assuming that you don't have the time/control needed to architect a completely new way of using this content I can give you some basic pointers around the following scenarios, 1 getting an up-to-date file from OneDrive, 2 interacting with the excel data and 3 then naturally doing what you need to do with that information.
1) Working with OneDrive
If you can interact with the file inside of your OneDrive using your machine, install the sync client for OneDrive. This will work on a Mac, Windows 7, 8, and 8.1 machine and might just get you up and syncing with ease.
If you can't use your personal account/deploy to a controlled machine you will want to use and SDK like the LiveSDK. However, I would actually recommend the Live-SDK-for-Windows, while it is not java, C# is pretty close in a lot of ways as long as you can depend on running on a windows machine.
Lastly, if you need to be able to run in a non-windows environment or have to run using the Java stack then I'd say that you should look at porting the LiveSDK-for-Android into a java only version, this is a large amount of work as you'll need to remove all the android dependencies, but you should be able to target your specific scenario around getting/updating files. You could technically look at reverse engineering how the service interactions work with a program like Fiddler.
2) Interacting with Excel files
Look around the Excel SDKs these are your best functionality bets to dig into your spreadsheets and getting the data that you'll need. There is a high likelihood that you will need to use C# or a .Net language to use them however.
Find a java compatible library to use, a quick Bing search turned up J-Integra, note that this still requires a Windows environment for execution and will have their own restrictions and usages.

Creating java applet or windows application that has internal database

I want to make a form or applet that will serve as GUI to a "database". The basic outline of it will be just a menu where people can put in a date and then all of the items related to that date will show up. I also want to have an insert option where people can add information for a date.
However, I was thinking if this could be possible with creating a database. I want to have this be pretty portable and give it to anyone so don't want to have to deal with connecting to database and installing DB server and all that.
Is it possible to keep all the data within the program and the filesize of the program just grows dynamically as more information is put in?
There are several "stand alone" or "single user" database engines around.
H2
HSQLDB
As I understand it, Apache Derby and even Java DB can be configured for "single user" operation, but you would need to verify this.
If you don't care about having a Java based database, you could also look at SQLLite
Applets have very restrictive security constraints, generally meaning that they can't read or write files to a local disk. You can run a in memory database, but once the applet/database is closed, the data is lost
There is a very lightweight file DBMS called Derby, created by Apache. Take a look at it here: http://db.apache.org/derby/
It's free and simple to use. It is not a very powerful solution, but it does sound like something you need.

Developing a Java Application with database

Sorry for this trivial question, but I am new to programming and I wanted to create a Java app that can be distributed to other computers without having to install database on that computer.
The app is similar to an address book app where you store details about a person. Is there a way to create something like that using netbeans which does not require a database or is there any other way to go about it..
I have searched for answers, but I guess I am not searching for the right keywords which I'd appreciate if someone could enlighten me with.
PS: I know how to create an app like that in netbeans which is connected to a database (Mysql or Postgresql) but they cannot be moved from one computer to other? Or can it be? I don't know.
Thanks you in advance..
When I want to make a Java program relying on a database and which is lightweight and which doesn't appear to have any other dependencies than a JVM, I use Apache Derby (JavaDB).
It is a pure Java database engine which you can embed in your Java application. Very small footprint. I usually package the program with a SQL file for creating the database structure and another one for populating it. Worth taking a look IMO.
EDIT: Just saving you the search... If you try DerbyDB, there is a little something you want to know (in case you also have that syndrome of not reading manuals)... When you close Derby, it throws exceptions if it went wrong AND if it went well. You'll receive exceptions with exception.getSQLState().equals("08006") and "XJ015". These are for successful shutdown; don't mind them. On connection to Derby, you'll get exception.getErrorCode() == 40000 if the database was not yet created; just create it. (These exceptions are all SQLException instances.)
If your application has a database back-end, then you will require database software on either the computer where the application is running, or on a remote server.
If you want the application and database to be portable, you can use something like SQLite (an embedded SQL database engine) or even flat files.
You do not have to move the database to any computer, what you can do is write some SQL scripts to generate the tables(and populate, if necessary) needed for application, and it can work on any computer.

Where to begin with a Java project

I've tried searching for similar questions here and I don't think I've found anything that matches what I'm looking for. I would like to know where to start in developing a (most likely) database-driven Java application that could keep track of customers, invoices, and quotes for my dad's auto shop. There will be a couple computers in the shop that will need access to it.
I was thinking of having a server in there to handle the database and let whatever machines need to access it use a client app.
Almost all of my experience is in a LAMP environment but I have been trying to learn as much as I can about Java and feel pretty comfortable playing with it in Netbeans or Eclipse.
I'm not asking anyone to tell me how to make it or anything. I would just like to know where to start learning. Is MySQL a good match with Java or should I use something else? I've been wanting to learn Java and I figured this would be a good project to learn on but everything I read seems to give only bits and pieces of what I want to know.
Java and MySQL work well together. Here are some things I would recommend to get started:
JDBC (Java Database Connector) - use it to connect to MySQL
Swing programming - used to create the GUI front end that users will interact with. While NetBeans has a drag and drop GUI builder interface, actually understanding what's going on under the hood is very important.
GlazedLists is a great project for showing dynamic content in table format, such that you can easily filter, sort, etc. Given you will probably have table views of customers, etc., I would look into this
If I were you I would definitely set the bar a little bit lower and try some easier projects to start with (ones that do not require database connectivity, for instance). Once you're a little more advanced with Java, then I'd start work integrating a MySQL table with your app.
I think that most of the answers to this question will prove useful as a starting point
You'll never find a complete subject list to learn java or any other tecnology, I suggest that you should start by writing down the requirements for the project and start "trying/failing" at what you want to do. Bits and Pieces are a very good way to learn.
You could try building different test applications, to get the feel of java, and slowly start using all parts needed to build your application. Common concepts used in small database-driven Java applications are:
JDBC, a java database connector
A client/server architecture (needed if multiple clients need to keep their data synchronized)
Synchronization
A swing GUI
A learning path that worked for me was:
Build a command-line driven java application
Build a test application with a graphical user interface (GUI).
Build a test application with a client/server architecture, but with only one client
Build a test application with a client/server architecture, connect multiple clients and keep them synchronized.
Build a java application with a JDBC database connector, set up a MySQL server and connect the server in your client/server architecture to it.
You can search for each of the concepts on the internet. It should be easy to find tutorials that will teach you how to use them.
MySQL should work well with Java.
In any case, if you use JDBC (a generic API to access SQL databases, part of the standard Java library), you should be quite independent of what underlying database you are using (apart from vendor-specific SQL extensions).

Categories

Resources