• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Cannot connect to Oracle Database No suitable Driver

 
michael turner
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All:

Any help rendered would be appreciated. (jdk 1.4.2_06, Tomcat 4.0,
Oracle DB 9i Windows XP)

I have a web app (Jasper report tool) and I cannot connect to a Oracle 9i database.

1)error received: "Apr 2, 2007 2:05:15 PM com.entDB.Enterprise_db connectToDatabase SEVERE: Function connectToDatabase() - Cannot load the driver, reason:java.sql.SQLException: No suitable driverCheck classpath for driver java.sql.SQLException: No suitable driver


2)CLASSPATH SETTING = C:\tomcat\common\lib\ojdbc14.jar


3)Source code:
protected boolean connectToDatabase() {

try {
// I tried this !!! Class.forName("oracle.jdbc.driver.OracleDriver");
DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
con = DriverManager.getConnection("URL,USER,PASSWORD ");
return true;
}catch (SQLException e) {
logger.error("Function connectToDatabase() - Cannot load the driver, reason:" + e.toString() + "Check classpath for driver ", e);
return false;
}

4.I placed a copy of the jar file in TOMCAT common lib, and server lib.
I have tried various solutions listed at different web sites without success. Has anyone had similiar problems? Can anyone assist?

thanks ......



[edited subject to remove "911" - nothing is on fire]
[ April 02, 2007: Message edited by: Jeanne Boyarsky ]
 
michael turner
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
*************** FOUND THE ERROR ******************

I was in a hurry when typing the error is:

con = DriverManager.getConnection("URL,USER,PASSWORD ");

This should be con = DriverManager.getConnection(URL,USER,PASSWORD);

For previously declared strings.

Thanks .......

:p
 
Mandar Velankar
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Michael,

I have gone through similar problem just 2 days earlier. Check out entier post
under my name.Follow the instructions given by Paul. Do not comment out Class.forName statement , it is necessary , it will load driver and register driver with DriverManager. Most of the time there is no requirement for registerDriver statement , Class.forName does it automatically.
First check whether it will load your driver class or not and then finally check your URL , it is also imp.
Normally URL is jdbc racle:thin:@localhost:1521:gj1
where gj1 is my database global SID (identifier).

Hope it will help you.



Regards,
Mandar Velankar
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic