Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Using JDBC to connect oracle

 
sachin mesala
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is "some exception"? In which line does it happen?
 
sachin mesala
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How are you adding the JDBC driver to the classpath? It apparently isn't part of it.
 
sachin mesala
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
sachin mesala
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic