Hello to everybody. I am using a try-catch pair. I have something like
this.
try
{
Class.forName("org.gjt.mm.mysql.Driver");
Connection
dbcon=DriverManager.getConnection("jdbc:mysql://isle:3306/footballtest",
"<username>", "<password>");
}
catch (ClassNotFoundException cnfe)
{
cnfe.printStackTrace();
}
catch (SQLExepction sqle)
{
sqle.printStackTrace();
}
but Tomcat just crashes when the: Connection
dbcon=DriverManager.getConnection("jdbc:mysql://isle:3306/footballtest",
"<username>", "<password>"); line is encountered. I have to say here that
the above code works fine if I use simple class to obtain connection with
the database. Any more suggestions.
Thank you.
Panos
-----Original Message-----
From: Dave Smith [mailto:sat-guru@home.com]
Sent: 02 October 2000 21:49
To: tomcat-user@jakarta.apache.org
Subject: Re: More Tomcat problems.
Panagiotis,
Are you using a try block around the code to catch SQLExceptions
in your development setup?
This is what is happening: you are throwing an exception without
a handler. The jvm just unwinds to the top and drops you out.
Try using something like this in the JSP:
<%@ page errorPage="error-page.jsp" %>
or else debug the connection code in an IDE first.
Regards,
Dave
----- Original Message -----
From: Panagiotis <mailto:panos@hotgen.com> Konstantinidis
To: tomcat-user@jakarta.apache.org <mailto:tomcat-user@jakarta.apache.org>
Sent: Thursday, November 30, 2000 12:45 PM
Subject: More Tomcat problems.
Hello there again, this is the second message I am sending regarding
problems with Tomcat. In my previous message Kief answered solved my
question correctly, so I would really appreciate if he could answer again
this one. It seems that I have exactly the same problem. I am running a JSP
file (lets say myFile.jsp) that open a conenction with the database on the
server. The code is like the following:
<% .....
String url = <the url string>;
String user = <the user string>;
String password = <the password string>;
Class.forName("org.gjt.mm.mysql.Driver");
Connection con = DriverManager.getConnection(url, user, password);
.....
%>
When the line Connection con = DriverManager.getConnection(url, user,
password); is encountered then Tomcat just goes off (and I get the error
message from Apache "Internal Server Error....."). Just like that, with no
error messages or anything. This is really weird because I have downloaded
and installed the latest versions of both Apache (v1.3.14) and Tomcat (v3.2)
and I have included the JDBC driver .jar file in my classpath.
I have looked in the "tomcat.log" file and there are no error messages. I
have looked in the "error.log" file in the Apache directory and I get the
error message (for one more time): [Thu Nov 30 17:47:39 2000] [error]
[client 192.168.0.25] Premature end of script headers:
c:/work/tomcat/jakarta-tomcat-3.2-b7/webapps/panos/myFile.jsp. I cannot
think of anything to do so if somebody knows more about that please help.
Thank you.
Panos
|