0

Possible Duplicate:
Java, MySQL: Is there a way to embed a MySQL server with a Java program?

I made a java program that uses a mysql database that works on a local server (XAMPP). When I build my project (NETBEANS), it will only functions if the local server is running. So is there any way to make my program run without the need of a local server. Can the database be embedded in the Jar. file to make my app a Standalone. I appreciated your help ! Thanks

Community
  • 1
  • 1
user1776576
  • 103
  • 3
  • 7
  • See this answer: [is there a way to embed a mysql server with a java program](http://stackoverflow.com/questions/1791417/java-mysql-is-there-a-way-to-embed-a-mysql-server-with-a-java-program) – Vincent Ramdhanie Dec 28 '12 at 18:41

1 Answers1

2

The short answer to your question is: No, the MySQL database cannot be "embedded" in a jar file.

If you have built your application to require a connection to a MySQL database, then you will need a MySQL database server running somewhere. (The MySQL server doesn't have to be local to the box; you can connect to a remote MySQL server, although that adds a dependency, so may not be the way you want to go for a "standalone" application.

If you need an "embedded" database for a "standalone" application, you might want to check out some different databases, e.g.

Java H2 database engine: http://www.h2database.com/html/main.html

Apache Derby: http://db.apache.org/derby/


MySQL has stopped development and support for MySQL Connector/MJX http://dev.mysql.com/doc/connector-mxj/en/connector-mxj.html which wasn't a truly embedded database; it was really a mechanism to automatically start a MySQL instance and initialize a database when a JDBC connection was requested.

spencer7593
  • 106,611
  • 15
  • 112
  • 140