pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Nahum Castro <nahumcastro@gmail.com>
To: pgsql-jdbc@postgresql.org
Subject: next() error
Date: Thu, 3 Feb 2005 16:51:14 -0600
Message-ID: <714bb51a050203145120066735@mail.gmail.com> (raw)

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



view thread (3+ messages)  latest in thread

Message-ID: <714bb51a050203145120066735@mail.gmail.com>
Permalink:  ../714bb51a050203145120066735@mail.gmail.com/
Also on:    postgresql.org/message-id/714bb51a050203145120066735@mail.gmail.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-jdbc@postgresql.org
  Cc: nahumcastro@gmail.com
  Subject: Re: next() error
  In-Reply-To: <714bb51a050203145120066735@mail.gmail.com>
  References: <714bb51a050203145120066735@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox