Problem with JDBC Driver / Statement.executeQuery()

From: pgsql-bugs(at)postgresql(dot)org
To: pgsql-bugs(at)postgresql(dot)org
Subject: Problem with JDBC Driver / Statement.executeQuery()
Date: 2001-03-15 20:40:30
Message-ID: 200103152040.f2FKeUO38928@hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Kevin Rood (kevinrood(at)gdcemtral(dot)com) reports a bug with a severity of 2
The lower the number the more severe it is.

Short Description
Problem with JDBC Driver / Statement.executeQuery()

Long Description
I am using PostgreSQL and Tomcat on Red Hat Linux 7.0 to develop a database enabled webapp.

The combination seems to work fine except when I repeatedly request a page. It seems that around 7-11 requests in a row with a short time between requests will result in the exception and stack trace in example code.

The exception gets thrown at the line 's.executeQuery( query );'.

Any help is appreciated.

Sample Code
private boolean validUser( String userID, String password, Connection c ) throws SQLException {
String query = "SELECT gb_admin.user_id, password " +
"FROM gb_admin, gb_user " +
"WHERE gb_admin.user_id = gb_user.user_id AND " +
" gb_admin.user_id = '" + userID + "' AND " +
" gb_user.password = '" + password + "'";

Statement s = c.createStatement();
ResultSet rs = s.executeQuery( query );

if ( rs.next() ) {
rs.close();
s.close();
return true;
}
else {
rs.close();
s.close();
return false;
}

---------------------------
Here's the stack trace:

Error: 500
Location: /kevin/servlet/AdminLogin
Internal Servlet Error:

java.lang.NullPointerException
at org.postgresql.Connection.ExecSQL(Connection.java:312)
at org.postgresql.jdbc2.Statement.execute(Statement.java:273)
at org.postgresql.jdbc2.Statement.executeQuery(Statement.java:54)
at AdminLogin.isValidAdminUser(AdminLogin.java:120)
at AdminLogin.doGet(AdminLogin.java:77)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at org.apache.tomcat.core.ServletWrapper.doService(ServletWrapper.java:404)
at org.apache.tomcat.core.Handler.service(Handler.java:286)
at org.apache.tomcat.core.ServletWrapper.service(ServletWrapper.java:372)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.java:797)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:743)
at org.apache.tomcat.service.http.HttpConnectionHandler.processConnection(HttpConnectionHandler.java:210)
at org.apache.tomcat.service.TcpWorkerThread.runIt(PoolTcpEndpoint.java:416)
at org.apache.tomcat.util.ThreadPool$ControlRunnable.run(ThreadPool.java:498)
at java.lang.Thread.run(Thread.java:484)

No file was uploaded with this report

Browse pgsql-bugs by date

  From Date Subject
Next Message Thomas Lockhart 2001-03-15 23:40:33 Re: Using types in an inappropriate way causes crash of backend
Previous Message Lonnie Cumberland 2001-03-15 17:52:46 odbc and linux bugs?