tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dyu...@copper.net
Subject Java error <unknown> when someone hits JSP with Bean
Date Mon, 12 Jun 2000 14:46:01 GMT
Hello,

Environment:

1) Apache (latest version).
2) TomCat (latest version).
3) JDK 1.2.2
4) Bean is hitting MS Access 97 MDB

The page renders just fine in the browser exactly as coded but server side 
the Java Window crashes.  I get an "Exception" dialog that Java has caused 
an <unknown> error.

If I don't shutdown TomCat and Apache and restart them both, the machine 
blue screens when someone else hits the box.

Any ideas are appreciated.

CODE FOR BEAN:
==============
package News;

import java.lang.*;
import java.sql.*;

public class Component
{
    public String getArticles(int Month) throws Exception {
        String Result = "";
        String Driver = "sun.jdbc.odbc.JdbcOdbcDriver";
        String URL = "jdbc:odbc:HMG";
        String SQL = "SELECT * FROM LatestNews WHERE Month(Posted) = " + 
Month + " ORDER BY Posted DESC";

        Connection con = null;
        Statement stmt = null;
        ResultSet rs = null;

        try {
            Result += "<table border=0 width=100%>";
            Result += "<th class=tblTH>Posted<th class=tblTH>Article";

            Class.forName(Driver);
            con = DriverManager.getConnection(URL);
            stmt = con.createStatement();
            rs = stmt.executeQuery(SQL);

            while (rs.next()) {
                Result += "<tr>";
                    Result += "<td class=tblTD>" + rs.getString(2) + 
"</td>";
                    Result += "<td class=tblTD>" + rs.getString(3) + 
"</td>";
                Result += "</tr>";
           	}
		} catch (Exception ex) {
			Result = "<table border=0 width=100%>";
			Result += "<tr><td>Exception!!!";
        } finally {

            rs.close();
            stmt.close();
            con.close();

            Result += "</table>";
        }

        return Result;
    }

}



Mime
View raw message