Do you use the same classpath at run time that you did at compile time? That's the first thing to look at.
However additional files may be required at run time that weren't needed at compile time. If the class for your JDBC driver is set in a config file, your program may be using Class.forName(driverClassName) to instantiate an instance of the driver. The compiler has no way of catching this, so it won't show up until you run the program.
So where is OraclePreparedStatement.class? It's probably buried in a jar file that you have available on your local machine, since the app runs there. It might be in something like $ORACLE_HOME/jdbc/lib/ojdbc14.jar. Add that to your run time classpath.
Ryan [ April 26, 2005: Message edited by: Ryan McGuire ]
Joined: Jan 04, 2001
Thanks for your reply.
I do not see ojdbc14.jar under the directory were I found classes12.jar and 111.jar.
There is a file called- ocrs12.jar in this directory.
I added this in classpath and run the file. but again the same error.
I can not search directories for ojdbc14.jar with my prevs. Will have to wait for Unix person to do this search. (I tried looking manually at few places that I could..)
If you have any other suggestions please let me know. I have been breaking my head over this problem for long now..
[ April 26, 2005: Message edited by: Gemini Moses ]
Joined: Feb 18, 2005
Look for ANY ojdbc*.jar file. The 14 is just what version I have. Try this on your Unix machine:
(I assume you have some way of setting $ORACLE_HOME.) If that doesn't come up with any filenames, try...
...and look for any file that looks promising. You could get real clever and try this:
I wonder if I might be missing something - you mentioned "where I found classes12.jar"...
I know that previous versions of the Oracle JDBC driver were in a file named "classes12.zip" (and as far as I can remember, the ZIP went in the classpath, and worked like a JAR - been a while, so that sounds iffy now). And in the later version that I am familiar with, it is in ojdbc14.jar... seems reasonable that in the middle at some point it may have been named classes12.jar.
... so I wonder if the classes12.jar you already found is the one you need. But then, you've mentioned it, which makes me think this might be something you already have in your classpath?
Or else, like I said, I'm missing something...
One last thing, that might help tip someone off to the real problem: do you have "oracle.jdbc.driver.OraclePreparedStatement" explicitly in your program? Or is that coming from your program referencing "PreparedStatement", and the specific reference to OraclePreparedStatement is burried in their code? If you're not sure, you can inspect the stack trace for the NoClassDefFoundError.
One (more?) last thing: maybe you could just download the JDBC driver from Oracle's site instead of trying to find it on your system.
Good luck, hope this helps.
Joined: Jan 04, 2001
Thanks Jon & Ryan for your replies.
I could find ojdbc14.jar in directory under 184.108.40.206_for_OC/jdbc/lib WHere as classes12.zip and 111.zip are under 220.127.116.11/jdbc/lib/
(Sorry it was typo by me in saying .jar instead of .zip)
I included these in my classpath. and now the error related to prepared statement is gone.