Results 1 to 14 of 14
Thread: JDBC Oracle Connection
- 11-04-2009, 08:05 PM #1
Member
- Join Date
- Nov 2009
- Posts
- 9
- Rep Power
- 0
JDBC Oracle Connection
I've searched, and tried many things, but cannot get an Oracle connection to work on our server...it works on my developement PC, but I move my .jar to the server and I get:
Exception in thread "main" java.lang.NoClassDefFoundError: oracle/jdbc/Oracle Driver
I started out with just the JRE installed, but have since installed the JDK in hopes that would solve it. I have copied both "classes111.jar" and "ojdbc.jar" to C:\Program Files\Java\jdk1.6.0_17\lib.
Most fixes for this error are "check your environment variables"...I've checked them and tried many things but no go...here's that they look like:
PATH=.; C:\Program Files\Java\jdk1.6.0_17\lib;C:\Program Files\Java\jdk1.6.0_17\lib\classes111.jar; C:\Program Files\Java\jre6\lib;D:\oracle\ora92\;D:\oracle\ora 92\bin;C:\Program Files\Oracle\jre\1.1.8\bin;C:\WINDOWS\system32;C:\ WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Intel\DMIX
CLASSPATH=C:\Program Files\Java\jdk1.6.0_17\lib; C:\Program Files\Java\jdk1.6.0_17\lib\classes111.jar
Is there anyone that can help me troubleshoot this???!
- 11-04-2009, 08:12 PM #2
Member
- Join Date
- Nov 2009
- Posts
- 9
- Rep Power
- 0
I probably should have mentioned a few more things, i am using Eclipse on my dev PC (wiht WinXP), and the server is Win2K3 Server, with the Oracle 9i client installed.
- 11-04-2009, 08:16 PM #3
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
Don't put that jar file in the JDK's folders or on your system's path. It only needs to be on your program's classpath.
- 11-04-2009, 08:30 PM #4
Member
- Join Date
- Nov 2009
- Posts
- 9
- Rep Power
- 0
I put my jar in
C:\alfa.jar
So I need to have the classes111.jar in that same directory?...and then change CLASSPATH to that location?
Then run
c:\java -jar alfa.jar
Tried that but still get the same error...
- 11-04-2009, 08:32 PM #5
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
You then need to provide
-cp classes111.jar
- 11-04-2009, 08:40 PM #6
Member
- Join Date
- Nov 2009
- Posts
- 9
- Rep Power
- 0
Tried that...still same error.
:(
I do appreciate you help
- 11-04-2009, 08:43 PM #7
Member
- Join Date
- Nov 2009
- Posts
- 9
- Rep Power
- 0
We might be making progress though, because this does not work:
c:\java oracle.jdbc.driver.OracleDriver
but this does:
c:\java -cp classes111.jar oracle.jdbc.driver.OracleDriver
- 11-04-2009, 08:53 PM #8
Member
- Join Date
- Nov 2009
- Posts
- 9
- Rep Power
- 0
Does the JDK have to be installed to use JDBC?
Does the Oracle Client?
- 11-05-2009, 07:09 AM #9
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
Please read the manual for the java command. What class file are you trying to run? That's the one you provide to java. You are currently running the oracle driver class which is surely not what you intend to do. Run your class file but provide the classes111.jar as a classpath argument i.e
c:\java -cp classes111.jar YourClassThatUsesTheOracleDriver
- 11-06-2009, 02:06 PM #10
Member
- Join Date
- Nov 2009
- Posts
- 9
- Rep Power
- 0
Yes, I understand that...but I had read somewhere that if your Oracle connection is failing that you can troubleshoot by simply trying the command:
java oracle.jdbc.driver.OracleDriver
and see what you get. If you get a:
"main" not found
then the Oracle Driver can be found, and the problem is elsewhere...if you get:
Exception in thread "main" java.lang.NoClassDefFoundError: oracle/jdbc/Oracle Driver
then theres something wrong with the environment. I was just trying to troubleshoot. The class file I am trying to run is named ALFA.jar, it currently resides in C:\ on the server. So I try:
c:\java -cp classes111.jar ALFA.jar
and I get the Error:
Exception in thread "main" java.lang.NoClassDefFoundError: oracle/jdbc/OracleDriver
???
thanks for the help
- 11-06-2009, 02:24 PM #11
Senior Member
- Join Date
- Aug 2009
- Posts
- 2,388
- Rep Power
- 6
What happened to the -jar option?
- 11-06-2009, 03:29 PM #12
just check it in command line javap oracle.jdbc.OracleDriver to make sure jar file is in path
Ramya:cool:
- 11-06-2009, 07:59 PM #13
Member
- Join Date
- Nov 2009
- Posts
- 9
- Rep Power
- 0
- 11-06-2009, 08:06 PM #14
Member
- Join Date
- Nov 2009
- Posts
- 9
- Rep Power
- 0
Similar Threads
-
oracle JDBC java
By silia_motor in forum JDBCReplies: 4Last Post: 05-10-2009, 09:37 AM -
connection with Oracle 10g
By Somitesh Chakraborty in forum New To JavaReplies: 5Last Post: 11-20-2008, 07:19 PM -
Using JDBC to connect to ORACLE database
By Java Tip in forum Java TipReplies: 0Last Post: 02-10-2008, 11:27 AM -
Jdbc Driver For Oracle
By Swamipsn in forum New To JavaReplies: 0Last Post: 08-14-2007, 04:31 AM -
Oracle and JDBC
By Eric in forum JDBCReplies: 3Last Post: 08-11-2007, 08:49 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks