aspose file tools*
The moose likes JSP and the fly likes Oracle JDBC driver and JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSP
Bookmark "Oracle JDBC driver and JSP" Watch "Oracle JDBC driver and JSP" New topic
Author

Oracle JDBC driver and JSP

Winston Smith
Ranch Hand

Joined: Jun 06, 2003
Posts: 136
I've created a bean which connects to a database. The following import statement is included in the bean class file:
import oracle.jdbc.driver.OracleDriver;
The bean works fine as a stand-alone program, however, when I try to create the bean in a JSP page, Tomcat returns a ClassNotFound Exception for driver.OracleDriver. If the driver is already imported in the .class file, why can't it be seen in the JSP page? I'm thinking I may need to place the driver file (class12.jar) somewhere in the Tomcat directory. Also, I'm running everything on the same machine, so JSP should have access to the driver.
Any suggestions?
Thanks,
WS


for (int i = today; i < endOfTime; i++) { code(); }
Manish Sharma
Greenhorn

Joined: Apr 11, 2003
Posts: 10
Hi

You just put the class12.jar file into the web-inf\lib directory and also all required jar files.
related to your applications for example if you are using mail service so put the mail.jar and activation.jar into that.
hope it will help you.
waiting for reply.
with regards
Manish
Originally posted by Winston Smith:
I've created a bean which connects to a database. The following import statement is included in the bean class file:
import oracle.jdbc.driver.OracleDriver;
The bean works fine as a stand-alone program, however, when I try to create the bean in a JSP page, Tomcat returns a ClassNotFound Exception for driver.OracleDriver. If the driver is already imported in the .class file, why can't it be seen in the JSP page? I'm thinking I may need to place the driver file (class12.jar) somewhere in the Tomcat directory. Also, I'm running everything on the same machine, so JSP should have access to the driver.
Any suggestions?
Thanks,
WS
Winston Smith
Ranch Hand

Joined: Jun 06, 2003
Posts: 136
Thanks, Manish! I don't have a web-inf/lib directory, so I ended up putting it in the bin directory and it's working from there! Hahhaa, I was dreading coming to work this morning because I was going to do battle with this Oracle driver, but you've saved me from the torture!
Thanks again,
WS
Manish Sharma
Greenhorn

Joined: Apr 11, 2003
Posts: 10
Hi
Thats very good your code is running now but my advice is to you that you should make a web-inf directory into your webapplication directory and put web.xml,related jar files. if you need to transfer your web-application to another machine or webserver directly put that directory in it. no need put again all jar into webserver's bin directory. it will be complete application directory.
waiting for reply.
with regards
Manish Sharma

Originally posted by Winston Smith:
Thanks, Manish! I don't have a web-inf/lib directory, so I ended up putting it in the bin directory and it's working from there! Hahhaa, I was dreading coming to work this morning because I was going to do battle with this Oracle driver, but you've saved me from the torture!
Thanks again,
WS
bharat nagpal
Ranch Hand

Joined: Oct 26, 2002
Posts: 76
Generally When webserver starts it picks all the jar files from WebServer\lib directory and put them in classpath for all the applications running in the webserver. and If you want some file in the classpath for a particular application you can put the file in the directory mentioned by manish.and the third way is to put the file in the classpath of the system(machine).
just by putting in bin directory i don't think it would be in classpath!!! how cum !!!
 
wood burning stoves
 
subject: Oracle JDBC driver and JSP