Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 9 of 9

Thread: How to deploy derby database?

  1. #1
    Junior Member
    Join Date
    Mar 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation 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.


  2. #2
    mmm.. coffee JavaPF's Avatar
    Join Date
    May 2008
    Location
    United Kingdom
    Posts
    3,336
    My Mood
    Mellow
    Thanks
    258
    Thanked 294 Times in 227 Posts
    Blog Entries
    4

    Default 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)
    Please use [highlight=Java] code [/highlight] tags when posting your code.
    Forum Tip: Add to peoples reputation by clicking the button on their useful posts.

  3. #3
    Junior Member
    Join Date
    Mar 2011
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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.

  4. #4
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default 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)

  5. #5
    Junior Member
    Join Date
    Mar 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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.

  6. #6
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: How to deploy derby database?


  7. #7
    Junior Member
    Join Date
    Mar 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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

  8. #8
    Junior Member
    Join Date
    Mar 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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.

  9. #9
    Junior Member
    Join Date
    Mar 2011
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default 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

Similar Threads

  1. calling a java a class connected to derby from a batch file
    By Reem in forum What's Wrong With My Code?
    Replies: 4
    Last Post: October 31st, 2010, 03:01 PM
  2. Java (Derby) Help
    By Neon612 in forum JDBC & Databases
    Replies: 3
    Last Post: August 19th, 2010, 08:40 PM
  3. MySQL Database
    By pjeremy90 in forum Java Theory & Questions
    Replies: 2
    Last Post: June 12th, 2010, 10:34 AM
  4. org.apache.derby does not exist?
    By disclaimer in forum What's Wrong With My Code?
    Replies: 0
    Last Post: March 30th, 2010, 04:58 PM
  5. Database? How-To...
    By DeMolay8613 in forum JDBC & Databases
    Replies: 2
    Last Post: November 24th, 2009, 12:37 PM