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

steps to installing Oracle jdbc driver

 
Annette L'Heureux
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to write a servlet that will connect to an oracle database and display records. However for the past 2 weeks I've been stuck, and just can't seem to get it to work. Has anyone done this before?
I've installed the drivers from the cd with the oracle installer, set the classpath to point to the classes111.zip file, and set my path to point to the lib folder. Do I need to do anything else?
In my code, I've registered the driver with the line:
DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver()
When I compile, I get an error 302 - cannot access class oracle.jdbc.driver.OracleDriver
What have I forgotten to do?
Annette
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try registering the driver using this:
Class.forName("oracle.jdbc.driver.OracleDriver");
instead of using the registerDriver() method.
 
Annette L'Heureux
Ranch Hand
Posts: 135
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks!
that seemed to work. I'm using it in a servlet, so my next questions should probably go to the servlet forum.
Thanks again!
Annette
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All drivers are written so they automatically instantiate themselves and then register themselves. All the Class.forName() does is load the specified class. The rest is done by the driver itself.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic