hello, i'm getting the following (very annoying) error when trying to do
a simple mysql connection from a jsp on tomcat 4:

java.lang.NumberFormatException: mysql
        at java.lang.Integer.parseInt(Integer.java:414)
        at java.lang.Integer.parseInt(Integer.java:463)
        at
org.apache.jasper.compiler.Compiler.getJspLineErrors(Compiler.java:321)

why on earth is the compiler trying to convert the 'mysql' string in my
database url?!
i'm using the following code, which works perfectly from a servlet:

try {

        Class.forName("org.gjt.mm.mysql.Driver");

        connection =
DriverManager.getConnection("jdbc:mysql://mymachine/somedb",
"mysql","password");

        String sql = "select * from table;";

        PreparedStatement ps = connection.prepareStatement(sql);

        ResultSet result = ps.executeQuery();

        ResultSetMetaData rsmd = result.getMetaData();

        while (result.next()) {

                int i=0;

                Object obj =  result.getObject(i);

                if (obj != null) {
                        fields[i] = obj.toString();
                } else {
                        fields[i] = "no entry";
                }
        }

        ps.close();
        connection.close();

} catch (SQLException e) {

        out.println("sql error: " + e.getMessage() + "\n");

}

any help would be greatly appreciated... man, how I hate debugging
jsp... what a waste of time.

-oliver

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:

 http://archives.java.sun.com/jsp-interest.html
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.jsp
 http://www.jguru.com/faq/index.jsp
 http://www.jspinsider.com

Reply via email to