File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JDBC and Relational Databases and the fly likes jdbc oracle hell...... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Reply locked New topic

jdbc oracle hell......

Rowan Chattaway
Ranch Hand

Joined: Jan 18, 2002
Posts: 75
I'm trying to create a jdbc racle:thin connection to a Oracle database through a jsp page. I'm using tomcat4.0 as my web server. My classpath is:
However when I run my jsp, I get the following:
Couldn't load database driver: oracle.jdbc.driver.OracleDriver
heres the code:
public String attemptConnection(String sql)
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
con = DriverManager.getConnection("jdbc racle:thin:@ MS", "rowan", "rowan");
stmt = con.createStatement();

catch(ClassNotFoundException e)
return("Couldn't load database driver: " + e.getMessage());
catch(SQLException e)
return("SQLException caught: " + e.getMessage());
if(con != null) con.close();
catch(SQLException ignored){}
return("connection appears to be fine...");

if anyone can help, it will be much appreciated, as I've been trying to get this going to the hours now, and I'm near death! and I really need to get this done or my boss will get annoyed.......
Many thanks,

The early bird may get the worm, but the second mouse gets the cheese.........<br /> <br />Sun Certified Programmer for Java 2 Platform<br />Sun Certified Web-Component Developer for J2EE Platform
Rowan Chattaway
Ranch Hand

Joined: Jan 18, 2002
Posts: 75
I've just ported it to JDeveloper which has it's own oc4j environment - and it works fine. How do I get Apache tomcat to find and use the jdbc driver??
I'm guessing it's a classpath problem but I've set it.......unless apache isn't using CLASSPATH....?? confused...
Mark Spritzler

Joined: Feb 05, 2001
Posts: 17276

In Tomcat you need to rename the file to classes12.jar and put it in the tomcat\common\lib directory.
I had had this problem before and this fixed it.

Perfect World Programming, LLC - iOS Apps
How to Ask Questions the Smart Way FAQ
David O'Meara

Joined: Mar 06, 2001
Posts: 13459

This has also been asked and answered in the Tomcat forum (here), so I'm closing this one so we don't all waste our time on duplicate conversations.
Please don't post the same question in multpile forums
I agree. Here's the link:
subject: jdbc oracle hell......
jQuery in Action, 3rd edition