| From: | boris <boris(at)localhost(dot)localdomain> | 
|---|---|
| To: | pgsql-jdbc(at)postgresql(dot)org | 
| Subject: | Re: jdbc and automagic casting | 
| Date: | 2011-09-19 15:47:37 | 
| Message-ID: | j57o4a$67k$1@speranza.aioe.org | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-jdbc | 
On 09/19/2011 10:39 AM, Guillaume wrote:
> Hello,
>
> I have an INSERT which does not behave the same under jdbc and psql.
>
> With psql, INSERTing a poperly formed VARCHAR into an inet column
> would work, eg.:
>
> =# \d user_record;
>                    Table "user_record"
>          Column        |          Type          | Modifiers
> ----------------------+------------------------+-----------
>   id                   | integer                |
>   username             | character varying(64)  |
>   registered_ip        | inet                     |
>
> 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?
>
> I do not have access to the java source code, there is thus no way to
> update the code to programatically force a CAST.
do you know if they used preparedstatement or build dynamic sql?
for now , I'm not sure if it would make a difference in this case..
>
> Thanks for any help,
> Guillaume
>
>
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Radosław Smogura | 2011-09-19 17:26:43 | Re: binary patch problems | 
| Previous Message | Bodor Andras | 2011-09-19 15:15:51 | Re: binary patch problems |