This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hi, I have a servlet that calls a method on a seperate plain Java class. This class creates a connection and a statement with Oracle. I have the Class.forName method to get the connection. When I run this class by itself, it makes the connection, but once I put it into my tomcat webapp directory, it no longer works and I get Exceptions through Tomcat. I moved my Oracle driver classes to the c:\tomcat\webapps\web-inf\classes directory. Is this correct? I am also looking at the logs, so I can get the long exception that I can't see in my Win 98 Dos Window because it doesn't scroll back. What is the log file name that I would look for? Thanks Mark
I don't know for sure, but try putting the driver in the JVM's classpath, when Tomcat start's up -- that's how our HP App Server picks things up. As for the CommandLine window, increase the buffer size, so you cans scroll back and see what exceptions you get. Right click on the window, click properties, in the Layout tab, increase the screen buffer size to 300 or maybe 500.
If you are using classes12.zip (or a similarly named zip file) for the oracle class files,copy it and rename it to classes12.jar and put it in the common/lib directory under tomcat for full tomcat visibility. HTH Reg
Mark I am also using Oracle9i with tomcat. Try to code these lines into servlet: -Place classes12.zip in jre/lib/ext or tomcat classpath. DriverManager.registerDriver (new OracleDriver()); Connection conn = DriverManager.getConnection("jdbc racle ci8:@" + "yourserverinstance","scott", "tiger"); DatabaseMetaData meta = conn.getMetaData (); out.println("JDBC driver version is " + meta.getDriverVersion()); yourserverinstance-->This you can create using sqlnet tool or follow your setup. If you get version# then your tomcat to oracle setup is correct. I hope this will help. [ April 24, 2002: Message edited by: arun sahni ]
Arun Sahni<br />SCJP2,SWCD,<br />BEA Certified Specialist: Server <br />JCert Enterprise Developer for BEA.
java.lang.UnsatisfiedLinkError: do_openat oracle.jdbc.oci8.OCIDBAccess.do_open(Native Method) This looks like a problem with the installation of the OCI Driver. You may want to try using the thin driver instead and see if that solves your problem.
Thanks guys. I figured out what was going on. For those who might come accross this error. It wasn't a driver issue. The first problem was, and when I put the classes12.jar into the common/lib direcotyr of Tomcat, I was good. My problems were in the Query itself. Wrong field name, wrong field type. They way I found this out was to include a method called getHelp, in my plain Java code that the servlet calls. getHelp returns a String named, yes you guessed it "help". In various points I assign a value to help. Like in my catch in the getConnection() portion of my code. I assigned it Exception.getMessage(). I also assigned my query to help. And then I have my servlet call getHelp, so I can see the real problem. The error message Tomcat gave me led me down a wrong tree. I also jsut found out that I could have sent the stack trace to the out via Exception.printStackTrace(out); Thanks Mark [ April 25, 2002: Message edited by: Mark Spritzler ]