Win a copy of Cloud Native PatternsE this week in the Cloud forum
or Natural Language Processing in the AI/ML forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Devaka Cooray
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Bear Bibeault
Sheriffs:
  • Paul Clapham
  • Knute Snortum
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Piet Souris
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Tim Holloway
  • Frits Walraven
  • Ganesh Patekar

Using JDBC to connect oracle

 
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.

 
Rancher
Posts: 43011
76
  • 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: 43011
76
  • 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.
 
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

 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!