Skip site navigation (1) Skip section navigation (2)

RE: next() and PreparedStatement

From: "chris markiewicz" <cmarkiew(at)commnav(dot)com>
To: "'Mano lito'" <mdelas(at)msn(dot)com>, <pgsql-jdbc(at)postgresql(dot)org>
Subject: RE: next() and PreparedStatement
Date: 2001-08-28 11:38:40
Message-ID: 009e01c12fb5$fcbe23b0$77b846c6@cmarkiewicz (view raw or whole thread)
Lists: pgsql-jdbc
i believe that when you close the stmt, the rs is automatically closed.  you
have to leave the stmt open until you're done with the rs.

-----Original Message-----
From: pgsql-jdbc-owner(at)postgresql(dot)org
[mailto:pgsql-jdbc-owner(at)postgresql(dot)org]On Behalf Of Mano lito
Sent: Tuesday, August 28, 2001 7:14 AM
To: pgsql-jdbc(at)postgresql(dot)org
Subject: [JDBC] next() and PreparedStatement


  We are developing a project using PostgreSQL 7.1.2 and JDBC drivers to
  exchange information with the database. Here is a piece of code to explain
  our problem:

  PreparedStatement pstmt;
  Connection connection;
  ResultSet rs = null;
  String query = new String( "SELECT count(*) FROM foo_table WHERE
foo_code=?;" );
  pstmt = connection.prepareStatement( query );
  pstmt.setString( 1, foo );
  rs = pstmt.executeQuery( query );



  the next() method will cause a java.lang.NullPointerException
  when the ResultSet comes from a PreparedStatement!!! Is this problem
  originated by the JDBC driver? We downloaded it from
  but this error occurs again and again and in we see
  7.0.x drivers available but none 7.1 nor 7.1.2 exists...

  We'd appreciate any help you could give us.If your address is not the
  correct place to ask this questions please tell us.

  Thanks in advance.

Descargue GRATUITAMENTE MSN Explorer en

---------------------------(end of broadcast)---------------------------
TIP 1: subscribe and unsubscribe commands go to majordomo(at)postgresql(dot)org

In response to


pgsql-jdbc by date

Next:From: Dave CramerDate: 2001-08-28 12:06:45
Subject: Re: next() and PreparedStatement
Previous:From: Mano litoDate: 2001-08-28 11:13:34
Subject: next() and PreparedStatement

Privacy Policy | About PostgreSQL
Copyright © 1996-2015 The PostgreSQL Global Development Group