Re: JDBC4 with SQLXML and postgresql-8.4-702.jdbc4.jar - Mailing list pgsql-jdbc

From Michael musset
Subject Re: JDBC4 with SQLXML and postgresql-8.4-702.jdbc4.jar
Date
Msg-id AANLkTikg5vHvq7sG4J8T7JBYiTdYZMROHgMCKTnDCCV2@mail.gmail.com
Whole thread Raw
In response to JDBC4 with SQLXML and postgresql-8.4-702.jdbc4.jar  (Michael musset <mickamusset@gmail.com>)
Responses Re: JDBC4 with SQLXML and postgresql-8.4-702.jdbc4.jar
List pgsql-jdbc
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.


how can i do that ?

thanks for the help,

On Thu, Oct 21, 2010 at 10:27 AM, Kris Jurka <jurka@ejurka.com> wrote:

No it won't work with the 9.0 JDBC driver either.  The same problem exists in both versions.

Kris


On 10/21/2010 1:26 AM, Michael musset wrote:
Thank you very much, and about that :

Yes the bug appeared when I do an updaterow() to the resultset.


i've decided to migrate to postgresql 9.

will it work with JDBC4 Postgresql Driver, Version 9.0-801
<http://jdbc.postgresql.org/download/postgresql-9.0-801.jdbc4.jar> ?


thanks,

On Thu, Oct 21, 2010 at 10:21 AM, Kris Jurka <books@ejurka.com
<mailto:books@ejurka.com>> wrote:



   On Tue, 19 Oct 2010, Michael musset wrote:

       java.lang.ClassCastException: org.postgresql.jdbc4.Jdbc4SQLXML
       cannot be
       cast to [B
       atorg.postgresql.jdbc2.AbstractJdbc2ResultSet.updateRowBuffer(AbstractJdbc2Re
       sultSet.java:1729)
       atorg.postgresql.jdbc2.AbstractJdbc2ResultSet.updateRow(AbstractJdbc2ResultSe
       t.java:1291)


       SQLXML sqlxml = con.createSQLXML();
       DOMResult domResult=sqlxml.setResult(DOMResult.class)
       domResult.setNode(xmldocumentDOM);

       stmt.setSQLXML(1, sqlxml);
       stmt.execute();


   Your sample code and stacktrace don't seem to match, but I see what
   the problem is.  The updatable ResultSet code isn't prepared for
   handling a SQLXML object.  It's slightly tricky to fix because the
   code in question is in a JDBC2 class while SQLXML is JDBC4 only.
     I'll look into it.

   Kris Jurka




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




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

pgsql-jdbc by date:

Previous
From: Thomas Kellerer
Date:
Subject: Columns with domains from other schemas and DatabaseMetaData
Next
From: Craig Ringer
Date:
Subject: Re: JDBC4 with SQLXML and postgresql-8.4-702.jdbc4.jar