db-ojb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Mogley" <mmog...@adelphia.net>
Subject trouble inserting blob into mysql
Date Sun, 23 Nov 2003 03:56:56 GMT
I have a MySQL table with a BLOB column.  

The corresponding field in the Java class is a byte array.  

The repository field-descriptor mapping is:

    <field-descriptor name="data" column="DATA" jdbc-type="BLOB"/>

When I try to do:

    persistenceBroker.store(objectWithBlob) 

I get the following stacktrace:


    Caused by: java.sql.SQLException: Unknown Types value
            at com.mysql.jdbc.PreparedStatement.setObject(PreparedStatement.java:925)
            at com.mysql.jdbc.PreparedStatement.setObject(PreparedStatement.java:953)
            at org.apache.commons.dbcp.DelegatingPreparedStatement.setObject(DelegatingPreparedStatement.java:254)
            at org.apache.ojb.broker.platforms.PlatformDefaultImpl.setObjectForStatement(PlatformDefaultImpl.java:265)
            at org.apache.ojb.broker.platforms.PlatformMySQLImpl.setObjectForStatement(PlatformMySQLImpl.java:80)
            at org.apache.ojb.broker.accesslayer.StatementManager.bindInsert(StatementManager.java:518)
            at org.apache.ojb.broker.accesslayer.JdbcAccessImpl.executeInsert(JdbcAccessImpl.java:231)

My version info:

- latest OJB from CVS as of today
- MySql 4.0.11a
- Connect/J 3.0.9 JDBC driver (production)

Lookiing at the driver source, it seems that the com.my.sql.jdbc.PreparedStatement.setObject
method is one big switch statement with no branch for BLOB or CLOB types.  There IS however
a PreparedStatement.setBlob method.

Am I doing something wrong in trying to use OJB to read/write BLOBS in MySQL?  Or is this
a bug?

Any help is very appreciated.

Michael

P.S.  Glad to hear Matthew successfully banished the Oracle LOB headache!
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message