NETBEANS JAVADB - How do I integrate a JavaDB DataBase into my main Java Package

Posted by Stefanos Kargas on Stack Overflow See other posts from Stack Overflow or by Stefanos Kargas
Published on 2010-06-06T13:35:53Z Indexed on 2010/06/06 13:42 UTC
Read the original article Hit count: 283

Filed under:
|
|

JAVA

I am working on a desktop application which uses JavaDB. I am using NetBeans 6.8 and JDK 6 Update 20

I created the database I need and connected to it through my application using ClientDriver:

    String driver = "org.apache.derby.jdbc.ClientDriver";
    String connectionURL = "jdbc:derby://localhost:1527/myDB;create=true;user=user;password=pass";

    try {
        Class.forName(driver);
    } catch (java.lang.ClassNotFoundException e) {
        e.printStackTrace();
    }
    try {
        schedoDBConnection = DriverManager.getConnection(connectionURL);
    } catch (Exception e) {
        e.printStackTrace();
    }

This works fine. But in that case the service of the database comes from NetBeans. If I move my application to another PC I won't be able to access my database. How can I integrate my JavaDB into my application?

© Stack Overflow or respective owner

Related posts about java

Related posts about netbeans