tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Lawrence, Gareth" <G.R.Lawre...@massey.ac.nz>
Subject Mysql and Tomcat
Date Mon, 15 Apr 2002 04:52:56 GMT
Greetings All,

Just when I though everything was sweet I'm having a nasty problem.  I'm running:
Debian Linux, Tomcat 4.0.3, Mysql, Ant, MM JDBC driver.

Basically I've set everything up sweet and when I run a test file from the command line (java
test.class) I get a connection to the
database no problems.  Unfortunately when I try and do the same thing through a servlet loaded
onto Tomcat I get grief!!!  See below
I get two errors outputted in the browser window, the second one could be caused by the first
:-)

If anyway has any ideas about this, please let me know this is a desperate one :-(((

Thanks heaps and heaps,

Gareth

Code:
                
    try {
        //Registering the MySQL JDBC Driver
        Class.forName("org.gjt.mm.mysql.Driver").newInstance();
    }
        catch (Exception E) {
        out.println("<p>Exception: Created Driver</p>");
        System.err.println("Unable to load driver.");
        E.printStackTrace();
    }

    try {
        //create variable url containing connecting value
        String url="jdbc:mysql://localhost/weblearn";
        //Create Connection Object from java.sql.*
        Connection Conn = DriverManager.getConnection(url, "root", "");
    }
        //Exceptions if something went wrong
        catch (SQLException E) {
        out.println("<p>SQL Exception</p>");
    }
            
        

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message