File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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 Java 8 in Action this week in the Java 8 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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: jdbc oracle hell......
 
Similar Threads
jdbc oracle hell
ORA-12514: TNS:listener could not resolve SERVICE_NAME given?
Locate my data base?
Problem in inserting record to Oracle Database.
hashmap and jdbc