How to deploy derby database?
Hi all,
I have developed an indexing application recently using derby database embedded in netbeans IDE, sure it is the first time to use derby database, and now I need to deploy my application, so does any one know how I can do that ? because I dont want to run the IDE every time I want to execute my application. Although, I tried to use EmbeddedDriver to connect to database, but it didnt work too. Any suggestion is welcome
Thank you.
Re: How to deploy derby database?
Hello Muaz_Sh, welcome to the Java Programming Forums.
Have you read about JAR files? Lesson: Packaging Programs in JAR Files (The Java™ Tutorials > Deployment)
Re: How to deploy derby database?
I am facing the same issue.
I am following this tutorial : [http://netbeans.org/kb/docs/java/gui-db.html] .
I want to create an apllication in Java, using as database Java DB (Derby).
Does someone know how the data are saved? I need this application for a customer, and i would like if data could be saved in a single file, pretty much like access do.
Secondly, does anyone know if there is an easy way to start Derby?
And, last but not least, following the tutorial mentioned above, i can't use NEW button to create a new record in my database. I can modify a record that is already saved in my database, but i can't create a new one.
Anyone that has an answer at any of my questions please feel free to instruct me.
Re: How to deploy derby database?
Just deploy the Derby.jar file with the application. Derby will create a folder relative to the application jar file defined by the database name used containing the database files (you will first have to create the database in your application if you have not yet, or distribute this folder with your app)
Re: How to deploy derby database?
Dear all
thank you for your replies. Sure I had read about the jar files and derby.jar is already in classpath, but please let me clear the problem: In fact when I run the application through netbeans with ClientDriver every thing goes well, but when I use EmbeddedDriver also through netbeans the exception"SEVERE: null
java.lang.ClassNotFoundException: org.apache.derby.jdbc.EmbeddedDriver" is shown, although the database is connected via netbeans. I also tried to add ";create=true" after database URL parameter but it was useless.
What you think I should do. Thank you
BTW I wonder that when I was using MySql database, it was necessary to run mysql service in background in order to response the queries, so is there any similar things with derby database
thanks.
Re: How to deploy derby database?
Re: How to deploy derby database?
Dear all
thank you for your suggestions I guess I got it. Although I had added derby.jar to classpath and put it in \Java\jdk1.6.0_23\jre\lib\ext it didnt work until I added it under projects tab -> myproject -> libraries;then, the EmbeddedDriver is recognized.
thank you so much
Re: How to deploy derby database?
Actually I thought cross posting my help to publish the info as we see in wikis, but really I was not aware about its problems.However, it is me in both forums. Please forget about it and let us continue our discussion ;).
I need to start java db server without using netbeans.
Thank you for your understanding and suggestions.
Re: How to deploy derby database?
Dear all,
Thank you very much for your help every thing goes well now, and the following steps describe how to deploy java application uses derby db with embedded driver connection:
- add derby.jar into project libraries
- use Embedded driver by calling Class.forName("org.apache.derby.jdbc.EmbeddedDrive r");
- add the string ";create=true" after the db name when using DriverManager.getConnection to get the connection
- build the project in order to get the project's jar file and libraries in the dist directory
- to start the java db server without netbeans you can refer to : Getting Started with Derby, or simply use the command
"java -jar derbyrun.jar server start", but first you should set the DERBY_HOME environment variable