This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes JDBC and the fly likes jdbc oracle hell...... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Databases » JDBC
Reply locked New topic
Author

jdbc oracle hell......

Rowan Chattaway
Ranch Hand

Joined: Jan 18, 2002
Posts: 75
Hi,
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:
.;C:\jdk1.3;C:\jdk1.3\lib\classes.zip;c:\tomcat4.0\common\lib\servlet.jar;C:\oracle\ora81\jdbc\lib\classes12.zip
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;
try
{
Class.forName("oracle.jdbc.driver.OracleDriver");
con = DriverManager.getConnection("jdbc racle:thin:@147.89.124.140:1527 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());
}
finally
{
try
{
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,
Rowan.


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
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

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.
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
David O'Meara
Rancher

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
Dave
 
 
subject: jdbc oracle hell......
 
Similar Threads
hashmap and jdbc
ORA-12514: TNS:listener could not resolve SERVICE_NAME given?
Problem in inserting record to Oracle Database.
jdbc oracle hell
Locate my data base?