problem with zxJDBC and clobs

Jon Christopher <[email protected]> Wed, 20 Jan 2016 13:50:41 -0800
Newsgroups gmane.comp.lang.jython.user
Message-ID <CAMK40dqmb=WPp_KppkFeMvhJAqmAFGX5hvF25Den0AO4YEXC1Q@mail.gmail.com>
I've run into a problem with zxJDBC and clobs.  The code:

from com.ziclix.python.sql import zxJDBC as DBAPI
...
 crs.execute("update session set xml=? "
                "where "
                "id=1",
                [xml_clob],
                {0:DBAPI.CLOB})


Generates the error:

   crs.execute("update session set xml=? "
   Error: ORA-01461: can bind a LONG value only for insert into a LONG
column
   [SQLCode: 1461], [SQLState: 72000]



I have to use the actual clob datatype here, as using the STRING data type
produces:

   crs.execute("update session set xml=? "
   Error: error setting index [1], type [12] [SQLCode: 0]
   setString can only process strings of less than 32766 chararacters
[SQLCode: 17157]

The problem is no longer critical to me as I've managed to work around it
by using direct JDBC calls:

   ps=db.__connection__.prepareStatement("update session set xml=? "
                                          "where "
                                          "id=1"
                                          )
    ps.setStringForClob(1,xml_clob)
    ps.executeUpdate()


However, even with that workaround, I'm a bit nervous as to if that
statement executes in the same transaction as the others.

Is the zxJDBC clob code broken, or am I somehow using it incorrectly?

FWIW, I'm running Jython 2.7.0 installed via brew on Mac OS 10.10.5.

Thanks for any help you can provide.

-Jon

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=267308311&iu=/4140

_______________________________________________
Jython-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jython-users