You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Shun-Luoi Daniel Fong <sd...@engineering.uiowa.edu> on 2001/04/16 23:24:43 UTC

db driver unavailable

I hope this isn't a question I should have just figured out myself, but
either way...

I have a login.jsp where the user can enter their id and password and hit
the form's button to submit. It then goes to checklogin.jsp where the form
data is grabbed, then sent to a database to verify that the id/password
are in the db. 

To test, I am using the JavaBean from "Web Development with JavaServer
Pages" by Fields/Kolb, called ConnectionBean.java

1. In /home/httpd/html/gamezone/login.jsp, I have the following lines at
the beginning of the file:

<jsp:directive.page import="java.sql.*" errorPage="error.jsp" />
<jsp:useBean id="connection" class="ConnectionBean" scope="session" />


2. In /home/httpd/html/gamezone/WEB-INF/classes/ConnectionBean.java, I
have the following(regarding the connection):

import java.sql.*;
import javax.servlet.http.*;
 
 
public class ConnectionBean implements HttpSessionBindingListener {
  private Connection connection;
  private Statement statement;
 
  private static final String driver="org.gjt.mm.mysql.Driver";
  private static final String dbURL="jdbc:mysql://agent.eng.uiowa.edu/gzuser_db";
  private static final String login="guest";
  private static final String password="guest";
 
  public ConnectionBean() {
 
    try {
      Class.forName(driver);
      connection=DriverManager.getConnection(dbURL,login,password);
      statement=connection.createStatement();
    }
    catch (ClassNotFoundException e) {
      System.err.println("ConnectionBean: driver unavailable");
      connection = null;
    }
    catch (SQLException e) {
      System.err.println("ConnectionBean: driver not loaded");
      connection = null;


3. When I load login.jsp in the browser, I get the error
ConnectionBean: driver unavailable
ConnectionBean: in the valueBound method


4. I placed the mm.mysql-2.0.4-src.jar file in WEB-INF/lib so that the db
driver could be found.

5. I'm using Tomcat 3.2.1/Apache/Linux

Could somebody tell me what I'm doing wrong? I realize that it is the
ClassNotFoundException but I'm not sure what I need to do to fix it. If
you need more info from me, I'd be more than happy to provide it.

Thanks,
Luoi


-- 
D. Shun-Luoi Fong
821 Melrose Avenue
Iowa City, IA 52246
email: sdfong@engineering.uiowa.edu

-----------------------
Colossions 2:8 See to it that no one takes you captive through philosophy
or empty deception, according to the traditions of men, according to the
elementary principles of the world, rather than according to Christ.
-----------------------