prepared statements and sequences
От | Ryan Wexler |
---|---|
Тема | prepared statements and sequences |
Дата | |
Msg-id | Pine.LNX.4.44L0.0304012132120.32688-100000@wexwarez.com обсуждение исходный текст |
Ответы |
Re: prepared statements and sequences
|
Список | 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 по дате отправления: