• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

basic jdbc to oracle 10g

 
Stephen Huey
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is so basic, and I don't know why it's not working. I'm trying to include the pure Java driver in my classpath, but it doesn't seem to be finding it. The following program just prints out "error: driver not in CLASSPATH" even though I've tried adding the Oracle JAR file to my classpath in various ways:

1) CLASSPATH environment variable in Windows

2) Typing this on the command line:

C:\aTest>javac -classpath .;./ojdbc14.jar TestOracleConn.java

C:\aTest>java -classpath .;./ojdbc14.jar TestOracleConn
error: driver not in CLASSPATH


-------------------------------

Because I'm using j2sdk1.4.2 I'm using Oracle's ojdbc14.jar instead of the older classesXXX.jar file. I think that's all I need. If anyone has seen this, please point me in the right direction. It seems so simple, so it's probably pretty dumb! Here's the program:


[ December 09, 2004: Message edited by: Stephen Huey ]
 
Stephen Huey
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I GOT IT!

Either O'Reilly's Java Programming with Oracle JDBC is wrong on page 28, or more likely as I saw hinted at in some other post, they changed some of the driver's package structure for 10g (you can see this if you extract the ojdbc14.jar), so I modified my code as follows and it works:

 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stephen,
Does it work with classes12.jar? I'm defining "work" as "not throw a class not found error" for the purposes of that question.

Also, if you unzip ojdbc14.jar, does it contain com.oracle.jdbc.OracleDriver?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 35279
384
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Stephen,

Thanks for posting the solution! It's good to know about the package name change.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic