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

Re: Statement as a parameter of a method

From: Kris Jurka <books(at)ejurka(dot)com>
To: Jean-Michel Zigna <jzigna(at)cls(dot)fr>
Cc: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Statement as a parameter of a method
Date: 2004-07-16 07:56:46
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-jdbc

On Fri, 16 Jul 2004, Jean-Michel Zigna wrote:

> It looks like if the statement parameter declared and used in Main and send 
> to the actu.setTheme method to execute the new query is closed when closing 
> the resultset in Actu.setTheme. We solved the problem by declaring a new 
> statement in Actu.setTheme and changing the signature a this method as below.
> Please, can you tell me if JDBC specifications are not compatible with the 
> old version of the source ? Can we declare a statement as a parameter of a 
> method, and if, what are the limits when using it in the method ? Do we 
> need to change a postgres parameter or setting ?

From the ResultSet javadoc:

A ResultSet object is automatically closed when the Statement object that 
generated it is closed, re-executed, or used to retrieve the next result 
from a sequence of multiple results.

This means you can only have one open ResultSet on a given Statement at a 
time which your original coding violates.

Kris Jurka

In response to

pgsql-jdbc by date

Next:From: Kris JurkaDate: 2004-07-16 08:43:46
Subject: Re: Adding JDK1.5 removing 1.1 support.
Previous:From: Jean-Michel ZignaDate: 2004-07-16 07:13:05
Subject: Statement as a parameter of a method

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