pg.ddx.io  pgsql-jdbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Kris Jurka <books@ejurka.com>
To: Mike Clements <mclement@progress.com>
Cc: PostgreSQL JDBC List <pgsql-jdbc@postgresql.org>
Subject: Re: Fetching generated keys
Date: Tue, 6 Mar 2007 17:42:25 -0500 (EST)
Message-ID: <Pine.BSO.4.64.0703061740470.4723@leary.csoft.net> (raw)
In-Reply-To: <626C0646ACE5D544BC9675C1FB81846B338938@MAIL03.bedford.progress.com>
References: <626C0646ACE5D544BC9675C1FB81846B338938@MAIL03.bedford.progress.com>



On Tue, 6 Mar 2007, Mike Clements wrote:

> 2. call executeQuery() and use the result set.
>
> If I call statement.executeQuery(), it throws an exception saying the
> connection is already closed ?!?!
>

I have no idea what you're testing, but the attached works fine for me. 
Could you provide individual test cases for any and all problems you are 
seeing?

Kris Jurka

Attachments:

Returning.java (text/plain, 496B) download import java.sql.*; public class Returning { public static void main(String args[]) throws Exception { Class.forName("org.postgresql.Driver"); Connection conn = DriverManager.getConnection("jdbc:postgresql://localhost:5820/jurka","jurka",""); Statement stmt = conn.createStatement(); stmt.execute("CREATE TEMP TABLE t (a int, b int)"); ResultSet rs = stmt.executeQuery("INSERT INTO t VALUES (1,2) RETURNING b"); rs.next(); System.out.println(rs.getInt(1)); } }

view thread (19+ messages)  latest in thread

Message-ID: <Pine.BSO.4.64.0703061740470.4723@leary.csoft.net>
Permalink:  ../Pine.BSO.4.64.0703061740470.4723@leary.csoft.net/
Also on:    postgresql.org/message-id/Pine.BSO.4.64.0703061740470.4723@leary.csoft.net

 · 

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: books@ejurka.com, mclement@progress.com
  Subject: Re: Fetching generated keys
  In-Reply-To: <Pine.BSO.4.64.0703061740470.4723@leary.csoft.net>
  References: <626C0646ACE5D544BC9675C1FB81846B338938@MAIL03.bedford.progress.com> <Pine.BSO.4.64.0703061740470.4723@leary.csoft.net>

* 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