Jump to content


Check out our Community Blogs

Register and join over 40,000 other developers!


Recent Status Updates

View All Updates

Photo
- - - - -

NetBeans and Data Base connection

data base connection connection

This topic has been archived. This means that you cannot reply to this topic.
2 replies to this topic

#1 Petros

Petros

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 117 posts

Posted 16 February 2013 - 04:36 PM

Hi guys!

Hey, I'm trying to make my first connection to a database. I had successfully created and connected the data base in NetBeans. Also using SQL commands I had populated my table. How ever, that's not the case when coding. I received the following error:

 

         Unable to load the JDBC / ODBC bridge. java.lang.ClassNotFoundException: org.apache.derby.jdbc.ClientDriver

 

This error happens when I execute the following command:

 

          Class.forName("org.apache.derby.jdbc.ClientDriver");

 

I have found that the error appears when the CLASSPATH Environment Variable don't point to the *.Jar file with the driver.

I just changed to Window 8 and there is no CLASSPATH Environment Variable like I used to have on Windows XP. Do I

have to creat it? I wander, if that is the problem, what could I do if I build an application and the localhost don't have the 

CLASSPATH specifying those jar files??? Also, why when I use NetBeans I don't have any problems. I haved looked on my

disc for the name org.apache.derby.jdbc.ClientDriver.jar or any thing like it, but that such a file don't seems to be any where

on my disc. Any clue? Please! Thank you very much for any clue from you.


Java Java Doooooo!!!

#2 BlackRabbit

BlackRabbit

    CodeCall Legend

  • Expert Member
  • PipPipPipPipPipPipPipPip
  • 3871 posts

Posted 18 February 2013 - 05:55 AM

Yes, you have to, it's strange it wasn't created before anyway.

 

Anyway, just for checking's sake, if you explore the .jar in your project, do you see the ClientDriver ? or do you see the EmbeddedDriver ? because there is that alternative too.

 

you could also touch the properties file, like this:

 

jdbc.drivers = "org.apache.derby.jdbc.ClientDriver"  

jdbc.username = app  

jdbc.password = app  

jdbc.database = YOURDB

jdbc.url = jdbc:derby://localhost:1527/YOURDB;create=true



#3 Petros

Petros

    CC Addict

  • Advanced Member
  • PipPipPipPipPip
  • 117 posts

Posted 18 February 2013 - 11:54 AM

I can chose either of two. But with the same result.

Thanks, BlackRabit, I'll try that approach and see what happens.


Java Java Doooooo!!!




Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download