next() error - Mailing list pgsql-jdbc
From | Nahum Castro |
---|---|
Subject | next() error |
Date | |
Msg-id | 714bb51a050203145120066735@mail.gmail.com Whole thread Raw |
Responses |
Re: next() error
|
List | pgsql-jdbc |
I am using postgresql 8 and the 8 JDBC 3 driver. I get the next error: javax.servlet.ServletException: ResultSet not positioned properly, perhaps you need to call next. This code used to work on postgresql 7.4.6 and 215 JDBC 3 driver Has changed something on the server or on the driver? Thanks for your help. This is the code on a jsp page: ------------------------------------------------------------------------------------- <%@ page contentType="text/html; charset=iso-8859-1" language="java" import="java.sql.*" errorPage="" %> <%@ include file="Connections/connPubs.jsp" %> <% String RecordsetPubs1 = "1"; if (request.getParameter("au_id") != null) { RecordsetPubs1 = (String)request.getParameter("au_id"); } %> <% Driver DriverRecordsetPubs1 = (Driver)Class.forName(connPubs_DRIVER).newInstance(); Connection ConnRecordsetPubs1 = DriverManager.getConnection(connPubs_STRING,connPubs_USERNAME,connPubs_PASSWORD); PreparedStatement StatementRecordsetPubs1 = ConnRecordsetPubs1.prepareStatement("SELECT * FROM public.authors WHERE au_id = " + RecordsetPubs1 + ""); ResultSet RecordsetPubs1 = StatementRecordsetPubs1.executeQuery(); boolean RecordsetPubs1_isEmpty = ! RecordsetPubs1.next(); boolean RecordsetPubs1_hasData = ! RecordsetPubs1_isEmpty; Object RecordsetPubs1_data; int RecordsetPubs1_numRows = 0; %> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <table align="center" border="1"> <tr> <td align="left" width="50%">au_id</td> <td align="left" width="50%"><%=(((RecordsetPubs1_data = RecordsetPubs1.getObject("au_id"))==null || RecordsetPubs1.wasNull())?"":RecordsetPubs1_data)%></td> </tr> <tr> <td align="left" width="50%">au_lname</td> <td align="left" width="50%"><%=(((RecordsetPubs1_data = RecordsetPubs1.getObject("au_lname"))==null || RecordsetPubs1.wasNull())?"":RecordsetPubs1_data)%></td> </tr> <tr> <td align="left" width="50%">au_fname</td> <td align="left" width="50%"><%=(((RecordsetPubs1_data = RecordsetPubs1.getObject("au_fname"))==null || RecordsetPubs1.wasNull())?"":RecordsetPubs1_data)%></td> </tr> <tr> <td align="left" width="50%">phone</td> <td align="left" width="50%"><%=(((RecordsetPubs1_data = RecordsetPubs1.getObject("phone"))==null || RecordsetPubs1.wasNull())?"":RecordsetPubs1_data)%></td> </tr> <tr> <td align="left" width="50%">address</td> <td align="left" width="50%"><%=(((RecordsetPubs1_data = RecordsetPubs1.getObject("address"))==null || RecordsetPubs1.wasNull())?"":RecordsetPubs1_data)%></td> </tr> <tr> <td align="left" width="50%">city</td> <td align="left" width="50%"><%=(((RecordsetPubs1_data = RecordsetPubs1.getObject("city"))==null || RecordsetPubs1.wasNull())?"":RecordsetPubs1_data)%></td> </tr> <tr> <td align="left" width="50%">state</td> <td align="left" width="50%"><%=(((RecordsetPubs1_data = RecordsetPubs1.getObject("state"))==null || RecordsetPubs1.wasNull())?"":RecordsetPubs1_data)%></td> </tr> <tr> <td align="left" width="50%">zip</td> <td align="left" width="50%"><%=(((RecordsetPubs1_data = RecordsetPubs1.getObject("zip"))==null || RecordsetPubs1.wasNull())?"":RecordsetPubs1_data)%></td> </tr> </table> </body> </html> <% RecordsetPubs1.close(); StatementRecordsetPubs1.close(); ConnRecordsetPubs1.close(); %> -------------------------------------------------------------------------------------- -- Nahum Castro González León, Guanajuato, México
pgsql-jdbc by date: