0

I want to make my Netbeans project executable with a database without opening any wamp or xampp. I am new at java and I don't know how to do this. Thanks in advance.

mathielo
  • 6,725
  • 7
  • 50
  • 63
  • As far as we know wamp and xampp are PHP dev stacks, why are you using them? For MySQL? Could you elaborate your question, bit more. – mane May 25 '15 at 08:46
  • yes im using it for MySQL. – ian almine May 25 '15 at 08:47
  • because when i run the jar files i still need to open the xampp to retrieve data in database. – ian almine May 25 '15 at 08:50
  • I guess, dunni has already pointed out what you should do next. Refer to this SO post -> http://stackoverflow.com/questions/154636/embedding-the-java-h2-database-programmatically . Embedded dbs like H2 are what you are looking for. – mane May 25 '15 at 08:52
  • do you have any suggestions on how can we embed our database to jar? – ian almine May 25 '15 at 08:59

2 Answers2

1

There are several embedded databases which you can start from your Java application, like H2, HSQLDB, Derby. Try one of them, and if you have a specific problem, ask another question here.

dunni
  • 43,386
  • 10
  • 104
  • 99
0

if you want to use Database as a standalone java application. Then you can go for embedded database. Netbeans comes with default Java DB (derby). 1. Open services tab in Netbeans window -> services 2. Under Databases - Right click -> New connection -> Java DB (Embedded) -> next -> in the JDBC URl give jdbc:derby:myjavadb;create=true -> Click next and finish

  1. Now you have successfully created Embedded database.

Check this link for the code http://www.codejava.net/java-se/jdbc/connect-to-apache-derby-java-db-via-jdbc