prepared statements and sequences - Mailing list pgsql-jdbc

From Ryan Wexler
Subject prepared statements and sequences
Date
Msg-id Pine.LNX.4.44L0.0304012132120.32688-100000@wexwarez.com
Whole thread Raw
Responses Re: prepared statements and sequences
List pgsql-jdbc
I am interfacing a postgresql db with jdbc using jdk1.4x on a linux box.
I have two questions/problems that I need help with.

1)Prepared Statments
I am trying to use a prepared statement and am successful except for date
fields.  I get a parse error when using the preparedStatement.setDate(x,
java.sql.Date);  Is this a postgres thing or a personal problem?  Is there
a workaround?






2)Sequences-
I am using sequences as unique identifiers, or rather I should say I would
like to use sequences.  I have successfully set up several sequences and
every time i insert an new row it automatically increments itself.  My
problem is whenever I insert a row I need to know
what the sequence is that was associated with the row inserted.  I
can't rely on doing a
max(sequenceid) kind of query because there maybe 10 rows inserted in that
time.  My method of inserting rows is just using a prepared statement and
in my insert statement i don't reference the sequence.  Is there a way to
get it to return the sequence id say when you call executeUpdate() on the
prepared statement?  Or what is the proper way to do this?


thanks a ton
ryan


pgsql-jdbc by date:

Previous
From: "Rohit Johry"
Date:
Subject: PLS HELP in connecting with jdbc driver
Next
From: "Paul Sorenson"
Date:
Subject: Re: PLS HELP in connecting with jdbc driver