Win a copy of JDBC Workbook this week in the JDBC and Relational Databases forum
or A Day in Code in the A Day in Code 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
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

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: 43016
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: 43016
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

 
We should throw him a surprise party. It will cheer him up. We can use this tiny ad:
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic