How to embedded and make protable database for a java standalone apploication?

769 views Asked by At

I am working in a java stand alone application which connect with a database(later i'll explain which database).

Now after generate the jar file,its working fine in my system where i create the application.

but when i want to run that jar file in another system,its running correctly but in the login part (where the database terms coming),when i click on a button which will open the login window it passes an exception,-- "java.lang.ClassNotFoundException.org.h2.Driver"(i'm using h2 database).

But there's no such problem in that system where i create that application.

Firstly i used MySQL database..but i search in the internet that MySQL is not portable database. so i switch to H2 database which is an embedded database. i did same whatever they said to embedded h2 database. But still i got the same problem.. My database is still not portable.

I want that whenever i generate the jar file,the database which has all the data of my application is bound with the jar file.and same for creating .exe file...that is when i take the .jar or .exe file to another system and want to run it there,the database should go along with my jar or exe file.

i have seen this websites,but unable to get the solutions.. Finished Java project, now creating jar or .exe file (with Database)

How to Bind MySql Database inside a JAR file of any application?

please help.i need your help badly.

1

There are 1 answers

0
Alex On

Java DB or Derby could be good choice. It is already embedded into Java and so it always exist. It is also pretty simple and powerful.