Results 1 to 2 of 2
  1. #1
    OmerHalit is offline Member
    Join Date
    Mar 2010
    Posts
    41
    Rep Power
    0

    Default Can't connect after build..

    Hi,

    I am using NetBeans 6.8. i have connected to database. I have completed my task. When i run the program under NetBeans, the program can communicate with the database. But after i build the program, my app can't communicate.

    I have noticed this. When i manually connect to database thru NetBeans (right click to JavaDB node and click connect) the app runs well. But when i disconnect, it doesnt connect itself from coding.

    This is what my code does after clicking the connection button:

    Java Code:
    Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
    con = DriverManager.getConnection("jdbc:derby://localhost:1527/SLearning","Learn","Learn");
    stmt = con.createStatement();
    I am also not sure what driver to use, embedded or client..? database will be reached locally only.

    do i need to add something else to connect manually.

    I hope i made myself clear..

    Thanks.

  2. #2
    OmerHalit is offline Member
    Join Date
    Mar 2010
    Posts
    41
    Rep Power
    0

    Default Solved

    Oh, sorry..

    I have just noticed that the code should be like this..

    Java Code:
    Class.forName("org.apache.derby.jdbc.EmbeddedDriver");
    con = DriverManager.getConnection("jdbc:derby:<databaseName>","Learn","Learn");
    stmt = con.createStatement();
    I used "localhost" with EmbeddedDriver.. that's why it cannot find my database and connect.. when i connect thru NetBeans it cannot find either. but it connects using NetBeans connection..

    Anyway thanks..

Similar Threads

  1. ant build dependencies
    By sardare in forum New To Java
    Replies: 0
    Last Post: 04-02-2009, 10:59 PM
  2. ant build
    By sardare in forum New To Java
    Replies: 4
    Last Post: 04-02-2009, 10:02 PM
  3. Unable to build
    By jkeller in forum Eclipse
    Replies: 1
    Last Post: 01-15-2009, 06:56 PM
  4. clean and Build
    By bhanu in forum Eclipse
    Replies: 3
    Last Post: 07-03-2008, 01:13 PM
  5. Replies: 0
    Last Post: 06-11-2008, 01:56 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
  •