aspose file tools*
The moose likes JDBC and the fly likes Connection problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Connection problem" Watch "Connection problem" New topic
Author

Connection problem

Manish Kapasiya
Greenhorn

Joined: May 29, 2014
Posts: 13
i am getting this exception..


what is the reason of getting this error and how can i resolve it.

Manish Kapasiya
Greenhorn

Joined: May 29, 2014
Posts: 13
Exception in thread "main" java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Unknown Source)
at DataBase.CustData..main(CustData.java)
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42635
    
  65
How are you adding the jar file(s) containing the driver to the classpath?


Ping & DNS - my free Android networking tools app
Manish Kapasiya
Greenhorn

Joined: May 29, 2014
Posts: 13
i have resolved the problem....
now i added the required jar files in the ext folder for extension class loader to locate... no need to set User environment variable.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18908
    
    8

Manish Kapasiya wrote:now i added the required jar files in the ext folder for extension class loader to locate... no need to set User environment variable.


You're going to regret that in a while, when you upgrade Java to a new version and find that its ext folder doesn't contain your JDBC driver. Of course by then you will have forgotten that you used the extensions directory trick and you will have to spend some time figuring out what's going on. I'd recommend that you spend a minute learning how to use the classpath and put your JDBC driver there.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Connection problem