Back to basics: you have to study servlet lifecycle.
<however>
Move connection opening code into doGet
since you close it and never reopen.
</however>
Marco
----- Original Message -----
From: "andrew tollin"
> Thank you Marco,
>
> I have attempted to close the statement along with the connection within
the
> doGet method as follows:
> finally {
> //close the database connection.
> try {
> if (stmt !=null) stmt.close();
> if (con !=null) con.close();
> }
> catch (SQLException e) {}
> }
>
> I open the connection in the init() method as follows. I dont quite
> understand what my problem is! Help
>
> public void init(ServletConfig config)
> throws ServletException
> {
> super.init(config);
> try {
> // Loads the driver
> Class.forName("org.gjt.mm.mysql.Driver");
>
> // Get a Connection to the database
> con = DriverManager.getConnection (url);
> }
> catch (Exception E) {
> System.err.println("Unable to load driver.");
> E.printStackTrace();
> } // end catch
>
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html