Java: connectionURL points to local file system, how do I point to my project resources?

Posted on 2012-08-24
Last Modified: 2012-08-30
Hello Experts,

I created a derby db on my file system. I set my connection string to it. For example:

String connectionURL  = "jdbc:derby:C:\\JAVA\\firstdb";

Once I compile and send my jar file for distribution, my app connection will fail because it points to my local file system... makes sense...

how do I add a derby db to my project resources?
what would the connectionURL  string look like?

I appreciate your help.... in advance, thank you for your suggestions...

Question by:epifanio67
    LVL 86

    Accepted Solution

    Try using a relative path. Of course, that could break if the location from which the app is run and the data store path become out of synch. The only was to prevent that is to use an absolute path

    Author Closing Comment

    I am sorry...
    I thought I had closed the question...

    Thank you for your help....

    LVL 86

    Expert Comment

    np :)

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    nested class vs inner class 5 36
    wordsWithout 49 64
    powerN  challenge 3 36
    array6 challenfge 6 48
    For beginner Java programmers or at least those new to the Eclipse IDE, the following tutorial will show some (four) ways in which you can import your Java projects to your Eclipse workbench. Introduction While learning Java can be done with…
    Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
    Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
    This video teaches viewers about errors in exception handling.

    731 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now