aspose file tools*
The moose likes JDBC and the fly likes Connecting Java with Oracle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Connecting Java with Oracle" Watch "Connecting Java with Oracle" New topic
Author

Connecting Java with Oracle

besian hoxha
Greenhorn

Joined: May 21, 2012
Posts: 3
Hi,

I'm trying to connect with Oracle but there are some problem..
Can anyone help me please?

There is the code:





PROBLEM:



ConnectOracle@130c19b databaseoracle
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:164)
at ConnectOracle.getOracleConnection(ConnectOracle.java:83)
at ConnectOracle.getConnection(ConnectOracle.java:46)
at ConnectOracle.getModeli(ConnectOracle.java:125)
at ConnectOracle.main(ConnectOracle.java:205)
java.lang.NullPointerException
at ConnectOracle.getModeli(ConnectOracle.java:126)
at ConnectOracle.main(ConnectOracle.java:205)


[Added code tags - see UseCodeTags for details]
Nicola Garofalo
Ranch Hand

Joined: Apr 10, 2010
Posts: 308
Did you get the jar file containing the oracle connection driver and put it in your classpath?
It seems you didn't.

Bye,
Nicola
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36482
    
  16
I think this thread would sit better in the databases forum (connections probably fit better there than in the Oracle forum). Moving discussion.
William P O'Sullivan
Ranch Hand

Joined: Mar 28, 2012
Posts: 860

Nicola is correct.

Class.forName() will look in the $CLASSPATH/%CLASSPATH% of the application server at run-time.

Either include the oracle supplied jar in your web-inf/lib or install in the appservers shared lib folders.

WP
Martin Vajsar
Sheriff

Joined: Aug 22, 2010
Posts: 3435
    
  47

If needed, you can find links to Oracle JDBC drivers, as well as other useful Oracle related advice, in our Oracle FAQ page.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Connecting Java with Oracle
 
Similar Threads
java oracle conectivity
type 4 driver with oracle 9i
Oracle DBConnection Problem
NoClassDefFoundError
Cant connect to oracle.