Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

javax.servlet.ServletException: org.gjt.mm.mysql.Driver

mac_doggiemac_doggie Member Posts: 488
Hi,

I just installed:

Java 2 SDK 1.4,
Apache Tomcat
and mysql-3.23.55-win

on my win98 machine

I also downloaded : mysql-connector-java-3.0.6-stable
from the www.MySql.com site.

I tried to acces a database from Java using this code:
[code]





<%@ page language="java" import="java.sql.*" %>

<%!
// define variables
String UId;
String FName;
String LName;

// define database parameters
String host="localhost";
String user="root";
String pass="1234";
String db="adresbook";
String conn;
%> <%
Class.forName("org.gjt.mm.mysql.Driver");

// create connection string
conn = "jdbc:mysql://" + host + "/" + db + "?user=" + user + "&password=" + pass;

// pass database parameters to JDBC driver
Connection Conn = DriverManager.getConnection(conn);

// query statement
Statement SQLStatement = Conn.createStatement();

// generate query
String Query = "SELECT uid, fname, lname FROM abook";

// get result
ResultSet SQLResult = SQLStatement.executeQuery(Query);

while(SQLResult.next())
{
UId = SQLResult.getString("uid");
FName = SQLResult.getString("fname");
LName = SQLResult.getString("lname");

out.println("<tr>" + UId + "" + FName + "" + LName + "");
}

// close connection
SQLResult.close();
SQLStatement.close();
Conn.close();

%>

Owner First name Last name


[/code]

I also u ncommented:
[code]

[/code]
and as you can see I typed in the name of the main database wich holds the userdata and altered the name of the usertable. Nothing worked

Now I can't even start Apache anymore. The logfile says:
[code]
2003-03-13 08:39:40 [org.apache.catalina.connector.warp.WarpConnector] Error accepting requests
java.net.SocketException: socket closed
at java.net.PlainSocketImpl.socketAccept(Native Method)
at java.net.PlainSocketImpl.accept(PlainSocketImpl.java:343)
at java.net.ServerSocket.implAccept(ServerSocket.java:438)
at java.net.ServerSocket.accept(ServerSocket.java:409)
at org.apache.catalina.connector.warp.WarpConnector.run(WarpConnector.java:590)
at java.lang.Thread.run(Thread.java:536)
[/code]

can anyone help me with this please ?
;-)
-mac-
mailto:programmersheaven@mac-doggie.nl
the Netherlands...

Comments

Sign In or Register to comment.