File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JDBC and the fly likes Using JDBC to connect oracle Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Using JDBC to connect oracle" Watch "Using JDBC to connect oracle" New topic
Author

Using JDBC to connect oracle

sachin mesala
Greenhorn

Joined: Jan 09, 2008
Posts: 17
Hi everyone,

I am using oracle 10g, my jdk is 1.4 and my IDE is eclipse and I am trying to connect the oracle data base with the following code, but I am always getting some exception.

I know time is precious.

Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39548
    
  27
What is "some exception"? In which line does it happen?


Ping & DNS - updated with new look and Ping home screen widget
sachin mesala
Greenhorn

Joined: Jan 09, 2008
Posts: 17
Originally posted by Ulf Dittmer:
What is "some exception"? In which line does it happen?


Its on the mine number 9 and the exception is

exception occuredjava.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 39548
    
  27
How are you adding the JDBC driver to the classpath? It apparently isn't part of it.
sachin mesala
Greenhorn

Joined: Jan 09, 2008
Posts: 17
Originally posted by Ulf Dittmer:
How are you adding the JDBC driver to the classpath? It apparently isn't part of it.


Hi,

i really dont know how to add the JDBC driver to the classpath, can you guide me please.
sachin mesala
Greenhorn

Joined: Jan 09, 2008
Posts: 17
Originally posted by Ulf Dittmer:
How are you adding the JDBC driver to the classpath? It apparently isn't part of it.


Hi, I gave in the environment variables , in the user variables I gave variable classpath and the value as . ;C:\oracle\ora92\jdbc\lib\classes12.jar.

But i even tried with the �. Classes14.jar

Still same error.
Roger Chung-Wee
Ranch Hand

Joined: Sep 29, 2002
Posts: 1683
Are you running this from eclipse? If so, you must add the JAR file containing the driver to the build path.

Right click on the project and select Properties. In the left column select Java Build Path. To the right select the Libraries tab. Click the Add External JARs... button. Search through the file system until you find the JAR file and Click OK.

You may need to rebuild your project to pick up the latest classpath.


SCJP 1.4, SCWCD 1.3, SCBCD 1.3
sachin mesala
Greenhorn

Joined: Jan 09, 2008
Posts: 17
Originally posted by Roger Chung-Wee:
Are you running this from eclipse? If so, you must add the JAR file containing the driver to the build path.

Right click on the project and select Properties. In the left column select Java Build Path. To the right select the Libraries tab. Click the Add External JARs... button. Search through the file system until you find the JAR file and Click OK.

You may need to rebuild your project to pick up the latest classpath.



Hi,

I did like but i am getting error as

Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
localhost:1521:aks
sachin mesala
Greenhorn

Joined: Jan 09, 2008
Posts: 17
Originally posted by sachin mesala:



Hi,

yes i am using eclipse and i did the way you said but the error is



Listener refused the connection with the following error:
ORA-12505, TNS:listener does not currently know of SID given in connect descriptor
The Connection descriptor used by the client was:
localhost:1521:aks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Using JDBC to connect oracle
 
Similar Threads
Urgent....
Connecting to a remote mysql database
cannot connect to oracle using datadirect JDBC driver
SQLException : The Network Adapter could not establish connection
not able to connect with 10g