Re: sequences in JDBC - Mailing list pgsql-jdbc

From Nick Fankhauser
Subject Re: sequences in JDBC
Date
Msg-id NEBBLAAHGLEEPCGOBHDGAEGHDLAA.nickf@ontko.com
Whole thread Raw
In response to Re: sequences in JDBC  (Dave Harkness <daveh@MEconomy.com>)
List pgsql-jdbc
Thanks Dave! That's exactly what I needed to know. -Nick

> The problem is that it is treating "nextval..." as a literal string and
> then trying to convert it to a number (as that is the column's type). You
> need to change it to this:
>
> final String address_lineInsert = "insert into address_line( address_id,
> address_line_id, address_line_text) values (?,
> nextval('address_id_seq'), ?)";
>
> This way Postgres will execute the nextval function as you wanted.
>
> Peace,
> Dave
>


pgsql-jdbc by date:

Previous
From: Dave Harkness
Date:
Subject: Re: sequences in JDBC
Next
From: "Nick Fankhauser"
Date:
Subject: Re: connection error