The moose likes JDBC and Relational Databases and the fly likes Connecting Java with Oracle 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 "Connecting Java with Oracle" Watch "Connecting Java with Oracle" New topic

Connecting Java with Oracle

besian hoxha

Joined: May 21, 2012
Posts: 3

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

There is the code:


ConnectOracle@130c19b databaseoracle
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
at Method)
at java.lang.ClassLoader.loadClass(
at sun.misc.Launcher$AppClassLoader.loadClass(
at java.lang.ClassLoader.loadClass(
at java.lang.ClassLoader.loadClassInternal(
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(
at ConnectOracle.getOracleConnection(
at ConnectOracle.getConnection(
at ConnectOracle.getModeli(
at ConnectOracle.main(
at ConnectOracle.getModeli(
at ConnectOracle.main(

[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.

Campbell Ritchie

Joined: Oct 13, 2005
Posts: 44483
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: 859

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.

Martin Vajsar

Joined: Aug 22, 2010
Posts: 3719

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:
subject: Connecting Java with Oracle
It's not a secret anymore!