Results 1 to 4 of 4
Like Tree1Likes
  • 1 Post By doWhile

Thread: deployment problem with Derby database

  1. #1
    newbie123 is offline Member
    Join Date
    Nov 2009
    Posts
    90
    Rep Power
    0

    Default deployment problem with Derby database

    I have a deployment problem for an app that uses a Derby database.

    First, I create a jar file that includes the database: jar cvf MyApp.jar *class MyAppsDatabase/* ...

    I then use a jar bundler to create a clickable app. To make the app work, I need to set the Derby property derby.system.home to point to the jar file that includes the database.

    With Apple's JarBundler, I can set this property, and the app works beautifully: derby.system.home=$APP_PACKAGE/Contents/Resources/Java/

    My problem lies with deployment to Windows machines. I have a bundler called jar2exe, but I cannot figure out how to set this Derby parameter so that the app finds the database when it runs.

    Does anyone have any experience with this particular bundler? If so, is there a way to set this Derby parameter?

    If not, is there some non-bundler-specific way to do this?

    Barring that, is there another Windows-based bundler that permits this Derby parameter to be set?

    This is driving me crazy; it seems like such a simple problem.

  2. #2
    doWhile is offline Moderator
    Join Date
    Jul 2010
    Location
    California
    Posts
    1,642
    Rep Power
    6

    Default Re: deployment problem with Derby database

    Have you tried setting a System property eg
    Java Code:
    System.getProperties().setProperty("derby.system.home", "my path");
    See Changing the system-wide properties programmatically
    Fubarable likes this.

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    25

    Default Re: deployment problem with Derby database

    Quote Originally Posted by doWhile View Post
    Have you tried setting a System property eg
    Java Code:
    System.getProperties().setProperty("derby.system.home", "my path");
    See Changing the system-wide properties programmatically
    Yep, you can even set these on the command line if desired and if you need different settings for different platforms.

  4. #4
    newbie123 is offline Member
    Join Date
    Nov 2009
    Posts
    90
    Rep Power
    0

    Default Re: deployment problem with Derby database

    I tried this, but it doesn't work. The problem seems to be with the second argument to setProperty( "derby.system.home", "my path" ). The argument need to point to inside the jar file, where the database resides. I have tried setting it to the current directory, which is presumably where the jar file is when the bundled app is clicked.

    I have used the following statement to set the URL for the database:

    String connectionURL = "jdbc:derby:jar:(Chem.jar)chemdb"

    where Chem.jar is the file where the database is located.

    When the app is run, an error message is returned that the database can't be found.

    If the database were not part of the jar file, I think this approach would work, but this would complicate the deployment. (I just want a bunch of synthetic organic chemists to be able to click an icon on a desktop and have the app access the underlying database; most don't even know what a command line is.)

Similar Threads

  1. Embedded Database : SQLite or Derby Database
    By vishnubrett in forum NetBeans
    Replies: 3
    Last Post: 03-26-2012, 10:50 AM
  2. Database connection with derby on server
    By idbirohit in forum New To Java
    Replies: 0
    Last Post: 09-23-2011, 10:18 AM
  3. Derby database problem
    By rjain in forum New To Java
    Replies: 1
    Last Post: 09-22-2011, 12:36 PM
  4. Deploy derby database
    By Muaz.Sh in forum NetBeans
    Replies: 11
    Last Post: 03-17-2011, 06:02 PM
  5. Using Derby Database in Netbeans
    By DavidG24 in forum New To Java
    Replies: 1
    Last Post: 09-14-2009, 01:29 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •