Win a copy of Functional Reactive Programming this week in the Other Languages forum!
    Bookmark Topic Watch Topic
  • New Topic

jdbc oracle hell......

 
Rowan Chattaway
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Report post to moderator
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.
 
Rowan Chattaway
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
 
David O'Meara
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Report post to moderator
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
 
    Bookmark Topic Watch Topic
  • New Topic