Re: JDBC4 with SQLXML and postgresql-8.4-702.jdbc4.jar

From: Michael musset <mickamusset(at)gmail(dot)com>
To: Craig Ringer <craig(at)postnewspapers(dot)com(dot)au>
Cc: Kris Jurka <jurka(at)ejurka(dot)com>, pgsql-jdbc(at)postgresql(dot)org
Subject: Re: JDBC4 with SQLXML and postgresql-8.4-702.jdbc4.jar
Date: 2010-10-23 04:34:59
Message-ID: AANLkTi=gGjLoHEDk8oqfjvamZXwmiwO=UhbbDEaHaG9x@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

Ok, this one is a little bit stupid :

ret.updateObject("DATA",(java.sql.Types.SQLXML)writer.toString());

by the way, i'm using :

/postgresql-9.0-801.jdbc4.jar ( i thought that it is better to use
postgresql 9 )

thx,

On Sat, Oct 23, 2010 at 6:20 AM, Michael musset <mickamusset(at)gmail(dot)com>wrote:

> Thanks,
>
> sorry for my poor level in Java/JDBC :
>
> but how do you use that ?
>
> i've tried :
>
> ret.updateObject("DATA",writer.toString() ,java.sql.Types.SQLXML);
>
> but it's still doesn't work :
>
>
> ERROR: column "DATA" is of type xml but expression is of type character
> varying
> Hint: You will need to rewrite or cast the expression.
>
>
> neither this one :
>
> ret.updateObject("DATA",(java.sql.Types.SQLXML)writer.toString());
>
>
> sorry,
>
>
> On Sat, Oct 23, 2010 at 6:09 AM, Craig Ringer <craig(at)postnewspapers(dot)com(dot)au
> > wrote:
>
>> On 23/10/2010 11:53 AM, Michael musset wrote:
>>
>>> So, what I have to do ?
>>>
>>> i've tried to convert my xml into String but it still doesn't work :
>>>
>>> ret.updateString("DATA", myXmlString);
>>>
>>>
>>> the error appear when i did a updaterow in my resultset
>>>
>>>
>>> the error is:
>>>
>>> org.postgresql.util.PSQLException: ERROR: column "DATA" is of type xml
>>> but expression is of type character varying
>>> Hint: You will need to rewrite or cast the expression.
>>>
>>
>> It's one of those irritating areas where PostgreSQL's overzealous refusal
>> to cast ::text or ::varchar for interpretation as literals of another type
>> bites you.
>>
>> You need to use updateObject("DATA", java.sql.Types.SQLXML) so the JDBC
>> driver knows what type to specify.
>>
>> --
>> Craig Ringer
>>
>> Tech-related writing at http://soapyfrogs.blogspot.com/
>>
>
>

--
Michael Musset,
Tel: 06 26 06 29 89

In response to

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kris Jurka 2010-10-23 06:24:05 Re: JDBC4 with SQLXML and postgresql-8.4-702.jdbc4.jar
Previous Message Michael musset 2010-10-23 04:20:58 Re: JDBC4 with SQLXML and postgresql-8.4-702.jdbc4.jar