Win a copy of Murach's MySQL this week in the JDBC and Relational Databases forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

MySQL without MYSQL server running?

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Bartender
Posts: 10336
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
author
Posts: 4335
39
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic