From: | Kris Jurka <books(at)ejurka(dot)com> |
---|---|
To: | Guillaume <lomig42(at)gmail(dot)com> |
Cc: | pgsql-jdbc(at)postgresql(dot)org |
Subject: | Re: jdbc and automagic casting |
Date: | 2011-09-19 18:38:22 |
Message-ID: | alpine.BSO.2.00.1109191435330.603@leary.csoft.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-jdbc |
On Mon, 19 Sep 2011, Guillaume wrote:
> INSERT INTO user_record (0, 'abc', '127.0.0.1') is valid and works.
> The string is automagically casted as an inet value.
>
> Using jdbc, this is not the case, and causes me loads of trouble (and
> exceptions).
> Is there a way around it?
If you are using setString with a parameter that's not a string, that's
not correct. You should use instead setObject(x, y, Types.OTHER).
> I do not have access to the java source code, there is thus no way to
> update the code to programatically force a CAST.
Without access to the source code you can use the connection url parameter
stringtype=unspecified.
http://jdbc.postgresql.org/documentation/head/connect.html#connection-parameters
Kris Jurka
From | Date | Subject | |
---|---|---|---|
Next Message | Jean-Max Reymond | 2011-09-19 20:03:26 | behavior at the end of a transaction |
Previous Message | Kris Jurka | 2011-09-19 18:35:22 | Re: binary patch problems |