tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Catherine Shepherd" <c...@imperiumglobal.com>
Subject RE: Urgent : Error connecting to mysql Database from JSP pagedeployed on tomcat server
Date Sat, 15 Jun 2002 17:35:50 GMT
Firstly perhaps this is a question for a Java forum.  However, it seems you
are not instantiating your driver properly.  This is a connection test class
that works fine connecting from a Tomcat instance on Win2K to a MySQL
instance on a remote Red Hat 7.2 box using the MM.MySQL driver
(http://mmmysql.sourceforge.net/).  Try it out on your system.  If you are
using a different driver you'll need to change the DBDRIVER String.

package com.imperiumglobal.tools.db;
import java.sql.*;
public class ConnectionTester {
  public static void main(String[] args) {
    String DBDRIVER = "org.gjt.mm.mysql.Driver";
    String DBURL = "jdbc:mysql://[hostname]/[dbname]";
    String DBUSER = "[username]";
    String DBPASSWORD = "[db password]";
    System.out.println("trying connection...");
    try {
      Class.forName(DBDRIVER).newInstance();
      Connection conn =
        DriverManager.getConnection(
          DBURL + "?user=" + DBUSER + "&password=" + DBPASSWORD);
      System.out.println("good connection");
    } catch (Exception e) {
      System.out.println("no connection: " + e);
    }
  }
}

James

-----Original Message-----
From: Jayanta Halder [mailto:JHALDER@dfg.ca.gov]
Sent: 14 June 2002 16:35
To: tomcat-user@jakarta.apache.org
Subject: Urgent : Error connecting to mysql Database from JSP
pagedeployed on tomcat server

While running the application i am getting following error ....

Cannot load JDBC driver class 'null'
java.lang.NullPointerException:



--
To unsubscribe, e-mail:   <mailto:tomcat-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-user-help@jakarta.apache.org>


Mime
View raw message