This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
The moose likes JDBC and Relational Databases 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 and Relational Databases
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
Rancher

Joined: Mar 22, 2005
Posts: 42958
    
  73
How are you adding the jar file(s) containing the driver to the classpath?
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
Sheriff

Joined: Oct 14, 2005
Posts: 19719
    
  10

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.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Connection problem
 
It's not a secret anymore!