This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes JDBC and the fly likes MySQL without MYSQL server running? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "MySQL without MYSQL server running?" Watch "MySQL without MYSQL server running?" New topic
Author

MySQL without MYSQL server running?

Philippus Scholtz
Greenhorn

Joined: Sep 19, 2009
Posts: 5
In the past, I've always used MS Access as a database because I found the connection easy to set up and it is the only database software we have in school. Now I have read that it is not 'good practice' to use MS Access as a DB source at all. Now I want to move over to an 'acceptable' database type. I have identified MySQL as probably the best choice and I have used it successfully with the MySQL server running. The problem is: Using Access allowed me to bundle my .mdb file with the application and the jar with the database driver and it would work on any machine on which my app is installed. MySQL seems to need the MySQL server running to access the database. This is a problem because an end user would not want to worry about setting up a database server before using any off-the-shelf software. How can I set MySQL up so that I can bundle the .sql file in my distribution and have java access it transparently without the user having to set up the server?

If I am on the wrong track here, please direct me as to what other type of database is the best to use for desktop applications so that the database connection can 'just work' on every computer my software gets installed on? Which database do Java developers generally use when creating 'out of the box' applications?

PS I work in NetBeans 6.5

Thanks
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

A database is probably not the best choice for a single user desktop application. I would just use the file system. Databases (Access aside) are intended to run on servers handling multiple requests from different users. If your system doesn't need this then don't use one.

If you feel you need a database and you want it running on the user's machine you probably would be best looking at a Java-based one you could completely control from your application, e.g. DerbyDB or HSQLDB.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Scott Selikoff
Saloon Keeper

Joined: Oct 23, 2005
Posts: 3703
    
    5

As Paul mentioned, Derby and HSQLDB might be what you need. They are in a class of database referred to as 'embedded databases'. Basically, they start inside your application and are only available as long as your application is up. I'm not a huge fan of them, though, as I find the desire to centralize my data (such as a web-based application) paramount to running lots of disconnected copies of the database. Keep in mind, if you want to update the user's database you need to perform updates on every instance that it is installed on.


My Blog: Down Home Country Coding with Scott Selikoff
 
 
subject: MySQL without MYSQL server running?
 
Similar Threads
Java EE 6 Glassfish App problem
Problems regarding MS JDBC Driver and JTDS-JDBC Connectivity for MS SQL Server 2000
mac + mysql for a java guy
Please help me in creating setup in java
connect to MS Access database file without making a dsn?