Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

jdbc oracle hell......

 
Ranch Hand
Posts: 75
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Rancher
Posts: 13459
Android Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
    Bookmark Topic Watch Topic
  • New Topic