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