tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Luong Phan <luongphan...@yahoo.com>
Subject Suitable Driver Error
Date Fri, 22 Aug 2003 08:31:29 GMT
Hi all,
 
In my web application, I use mysql supported by Redhat Linux 7.3 to store database, jakarta-tomcat-3.2.4,
mysql-connector-java-3.0.6-stable-bin.jar, and JSP.
 
Every time, I run the program:
 
import java.io.IOException;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;

public class Data {
 private Connection connection; 
 private Statement statement; 
 
 
 public Data() throws ClassNotFoundException,SQLException{
     
  String DBDriver=null;
  String url=null;
  String username=null;
  String password=null;
  
        password="myPassword";
        username="myUserName";
        url="dbc:mysql://localhost/gmds";
        DBDriver="com.mysql.jdbc.Driver";

    try{  
         Class.forName(DBDriver);
         connection=DriverManager.getConnection(url,username,password);
         statement=connection.createStatement();
       }catch(ClassNotFoundException e){
                     System.err.println("Failed to load JDBC/ODBC driver.");
                     e.printStackTrace();
      }catch(SQLException e){
                     System.err.println("Unable to connect");
                     e.printStackTrace();
      }
    }
...
I get the error:
Unable to connect
java.sql.SQLException: No suitable driver at java.sql.DriverManager.getConnection(DriverManager.java
  532)
...
 
What is suitable driver for my application? Please give me some words of advice!
 
Thanks a lot.
 
LuongPhan


---------------------------------
Do you Yahoo!?
The New Yahoo! Search - Faster. Easier. Bingo.
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message