1

Say I have created a desktop application in Java to keep notes. I used MySQL for storage. On my computer it connects to database I have created(using my root username and password). But what if I want to distribute my program? Are the other users should have MySQL installed on their system? If they have to isnt tat a problem that I have my MySQL username and password embedded in code?

In general, I am asking how can I make a desktop program in Java which can store data from its users??

obtur
  • 33
  • 1
  • 6

4 Answers4

4

Sounds like you want SQLite, There is another SO question here about it.

Community
  • 1
  • 1
IanNorton
  • 7,145
  • 2
  • 25
  • 28
3

SQLite as IanNorton mentioned is a good alternative. Other good alternatives are Apache Derby or the H2 database, both providing an embedded (install-free) java database.

Johan Sjöberg
  • 47,929
  • 21
  • 130
  • 148
  • I have made some reserach, and I think databases for this situation are called "embedded databases"? Does MySQL have its own embedded version? I seen mySQL embedded server but could not understand what is it? Is it for my needs?? – obtur May 14 '11 at 10:22
  • Yes they're called *embedded databases*. MySQL Embedded makes no more sence to me than it did for you. The two mentioned already I've myself tested with good experience, in particular the latter. – Johan Sjöberg May 14 '11 at 10:52
2

Does MySQL have its own embedded version?

Normal "embedded MySQL" is a native code library (libmysqld) that is not really suitable for use with Java. However, there is something called mysql-je that purports to be a Java compatible wrapper. The problem is that it is based on a rather old version of MySQL, and hasn't been updated since 2006.

There are also postings on the MySQL forums about using embedded MySQL with Java, but there's no sign that it is supported.

So I think you'd be better of going with a one of the alternatives; e.g. SQLite, Derby or H2.

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
1

No need of multiple installations of MYSQL database if all the machines where you want to access are in a LAN. In that case you can have single database installation and access it from multiple systems using the IP address of the database machine. We can access a remote database through Internet as well, using the IP Address of the machine in which database exists..

Krishna
  • 1,454
  • 5
  • 16
  • 31