Stephen. Thanks for the advice. As t why we are using blobs, here's my explanation, and I'd be interested in any other approaches:
We receive messages from Mastercard. They are formatted following ISO 8583 (basically binary). We unpack the message and write many (about 30) of the unpacked fields to our DB. For auditing and future use, we also store the original raw message as a blob. Message size ranges from 100-1000 bytes. Typical values are around 300 bytes. Ciao, Jonathan O'Connor XCOM Dublin Stephen Coy <[EMAIL PROTECTED]> Sent by: [EMAIL PROTECTED] 06.08.2003 13:31 Please respond to jboss-user To: [EMAIL PROTECTED] cc: Subject: Re: [JBoss-user] CMP support for blobs broken using Sybase Hi, The current JBoss implementation does the following mapping for JDBC access: Types.CLOB, LONGVARCHAR: use set/getCharacterStream Types.BLOB, LONGVARBINARY use set/getBinaryStream Types.BINARY, VARBINARY use set/getBytes So, you could try setting the JDBC type to LONGVARBINARY. I recently said the following to an Oracle user, and I think it applies to you as well: "In my opinion (knowing what I know now about EJB entity beans), you should not be storing LOBs in your primary entities anyway. Getting the LOB data to your client may result in multiple copies of it being instantiated in memory - and given the nature of LOBs (they can be BIG ;-) ), this may be quite expensive and it won't scale very well. I would either keep the LOB data in separate related tables, or use the same table and hide the LOB columns from the CMP engine by mapping the table to a couple of views. Then use a business facade style of session bean to load the LOB data in whatever fashion you see fit using pure JDBC or even the Oracle extensions. It may even be advantageous to load it directly from the client side using a business delegate and get full and proper advantage of the streaming interfaces. Use the CMP engine to get yourself up and running quickly (you seem to have accomplished that) and then refine it as above and I think your application will be much happier." Regards, Steve Coy On Wednesday, August 6, 2003, at 12:36 AM, Jonathan.O'[EMAIL PROTECTED] wrote: > Further migration problems have reared their head. The Sybase JDBC > driver > throws an exception when I try to write a blob using CMP. It complains > that SQL Type 1004 is not supported. This is SqlType.BLOB. > > On talking to colleagues who have written JDBC code for sybase and > blobs, > I have been told that we should use SqlType.BINARY and call > PreparedStatement.setBinaryStream() instead of setBytes(). > Whatever, I would like to hear of anybody out there who is using JBoss > (We're on 3.0.6) and Sybase 12.0 to write blobs (IMAGE in Sybase SQL). > > Finally, here's the stack trace: > 13:14:31,918 ERROR [Dispute] Could not create entity > java.sql.SQLException: JZ006: Caught IOException: java.io.IOException: > JZ0SL: Unsupported SQL type 2004. > at > com.sybase.jdbc2.jdbc.ErrorMessage.raiseError(ErrorMessage.java:526) > at > com.sybase.jdbc2.jdbc.ErrorMessage.raiseErrorCheckDead(ErrorMessage.jav > a:762) > at com.sybase.jdbc2.tds.Tds.handleIOE(Tds.java:3160) > at com.sybase.jdbc2.tds.Tds.language(Tds.java:702) > at > com.sybase.jdbc2.jdbc.SybStatement.sendQuery(SybStatement.java:1451) > at > com.sybase.jdbc2.jdbc.SybPreparedStatement.sendQuery(SybPreparedStateme > nt.java:1168) > at > com.sybase.jdbc2.jdbc.SybStatement.executeUpdate(SybStatement.java:1621 > ) > at > com.sybase.jdbc2.jdbc.SybPreparedStatement.executeUpdate(SybPreparedSta > tement.java:91) > at > org.jboss.resource.adapter.jdbc.local.LocalPreparedStatement.executeUpd > ate(LocalPreparedStatement.java:308) > at > org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.insertEntity(JDB > CCreateEntityCommand.java:196) > at > org.jboss.ejb.plugins.cmp.jdbc.JDBCCreateEntityCommand.execute(JDBCCrea > teEntityCommand.java:131) > at > org.jboss.ejb.plugins.cmp.jdbc.JDBCStoreManager.createEntity(JDBCStoreM > anager.java:527) > at > org.jboss.ejb.plugins.CMPPersistenceManager.createEntity(CMPPersistence > Manager.java:253) > at > org.jboss.resource.connectionmanager.CachedConnectionInterceptor.create > Entity(CachedConnectionInterceptor.jav > a:270) > at > org.jboss.ejb.EntityContainer.createLocalHome(EntityContainer.java:580) > at sun.reflect.GeneratedMethodAccessor40.invoke(Unknown Source) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso > rImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:324) > at > org.jboss.ejb.EntityContainer$ContainerInterceptor.invokeHome(EntityCon > tainer.java:1119) > at > org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractIntercepto > r.java:73) > at > org.jboss.ejb.plugins.EntitySynchronizationInterceptor.invokeHome(Entit > ySynchronizationInterceptor.java:207) > at > org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke > Home(CachedConnectionInterceptor.java: > 215) > at > org.jboss.ejb.plugins.AbstractInterceptor.invokeHome(AbstractIntercepto > r.java:73) > at > org.jboss.ejb.plugins.EntityInstanceInterceptor.invokeHome(EntityInstan > ceInterceptor.java:90) > at > org.jboss.ejb.plugins.EntityLockInterceptor.invokeHome(EntityLockInterc > eptor.java:79) > at > org.jboss.ejb.plugins.EntityCreationInterceptor.invokeHome(EntityCreati > onInterceptor.java:44) > at > org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterc > eptor.java:111) > at > org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxIntercepto > rCMT.java:228) > at > org.jboss.ejb.plugins.TxInterceptorCMT.invokeHome(TxInterceptorCMT.java > :62) > at > org.jboss.ejb.plugins.SecurityInterceptor.invokeHome(SecurityIntercepto > r.java:105) > at > org.jboss.ejb.plugins.LogInterceptor.invokeHome(LogInterceptor.java:129 > ) > at > org.jboss.ejb.EntityContainer.invokeHome(EntityContainer.java:487) > at > org.jboss.ejb.plugins.local.BaseLocalContainerInvoker.invokeHome(BaseLo > calContainerInvoker.java:230) > at > org.jboss.ejb.plugins.local.LocalHomeProxy.invoke(LocalHomeProxy.java:1 > 10) > at $Proxy145.create(Unknown Source) > at > xcom.traxbahn.bproc.ejb.DisputeBcBean.createNewDispute(DisputeBcBean.ja > va:84) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.ja > va:39) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso > rImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:324) > at > org.jboss.ejb.StatelessSessionContainer$ContainerInterceptor.invoke(Sta > telessSessionContainer.java:660) > at > org.jboss.resource.connectionmanager.CachedConnectionInterceptor.invoke > (CachedConnectionInterceptor.java:186) > > at > org.jboss.ejb.plugins.StatelessSessionInstanceInterceptor.invoke(Statel > essSessionInstanceInterceptor.java:77) > > at > org.jboss.ejb.plugins.AbstractTxInterceptor.invokeNext(AbstractTxInterc > eptor.java:107) > at > org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxIntercepto > rCMT.java:228) > at > org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:92) > at > org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.ja > va:130) > at > org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:204) > at > org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContaine > r.java:313) > at org.jboss.ejb.Container.invoke(Container.java:712) > at > org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517) > at > org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:38 > 2) > at sun.reflect.GeneratedMethodAccessor38.invoke(Unknown Source) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso > rImpl.java:25) > at java.lang.reflect.Method.invoke(Method.java:324) > at > sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261) > at sun.rmi.transport.Transport$1.run(Transport.java:148) > at java.security.AccessController.doPrivileged(Native Method) > at sun.rmi.transport.Transport.serviceCall(Transport.java:144) > at > sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460 > ) > at > sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.j > ava:701) > at java.lang.Thread.run(Thread.java:536) > 13:14:31,928 ERROR [STDERR] com.sybase.jdbc2.jdbc.SybSQLException: A > wrong > datastream has been sent to the server. The s > erver was expecting token 236 but got the token 33. This is an internal > error. > 13:14:31,928 ERROR [STDERR] at > com.sybase.jdbc2.tds.Tds.processEed(Tds.java:2672) > 13:14:31,928 ERROR [STDERR] at > com.sybase.jdbc2.tds.Tds.nextResult(Tds.java:2032) > 13:14:31,928 ERROR [STDERR] at > com.sybase.jdbc2.tds.Tds.doCommand(Tds.java:2718) > 13:14:31,928 ERROR [STDERR] at > com.sybase.jdbc2.tds.Tds.endTransaction(Tds.java:1586) > 13:14:31,928 ERROR [STDERR] at > com.sybase.jdbc2.jdbc.SybConnection.rollback(SybConnection.java:840) > 13:14:31,928 ERROR [STDERR] at > org.jboss.resource.adapter.jdbc.local.LocalManagedConnection.rollback(L > ocalManagedCon > nection.java:282) > 13:14:31,928 ERROR [STDERR] at > org.jboss.resource.connectionmanager.LocalTxConnectionManager$LocalConn > ectionEventLis > tener.rollback(LocalTxConnectionManager.java:658) > 13:14:31,928 ERROR [STDERR] at > org.jboss.tm.TxCapsule.rollbackResources(TxCapsule.java:1779) > 13:14:31,928 ERROR [STDERR] at > org.jboss.tm.TxCapsule.rollback(TxCapsule.java:475) > 13:14:31,928 ERROR [STDERR] at > org.jboss.tm.TransactionImpl.rollback(TransactionImpl.java:83) > 13:14:31,928 ERROR [STDERR] at > org.jboss.ejb.plugins.TxInterceptorCMT.runWithTransactions(TxIntercepto > rCMT.java:241) > > 13:14:31,928 ERROR [STDERR] at > org.jboss.ejb.plugins.TxInterceptorCMT.invoke(TxInterceptorCMT.java:92) > 13:14:31,928 ERROR [STDERR] at > org.jboss.ejb.plugins.SecurityInterceptor.invoke(SecurityInterceptor.ja > va:130) > 13:14:31,928 ERROR [STDERR] at > org.jboss.ejb.plugins.LogInterceptor.invoke(LogInterceptor.java:204) > 13:14:31,928 ERROR [STDERR] at > org.jboss.ejb.StatelessSessionContainer.invoke(StatelessSessionContaine > r.java:313) > 13:14:31,928 ERROR [STDERR] at > org.jboss.ejb.Container.invoke(Container.java:712) > 13:14:31,928 ERROR [STDERR] at > org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:517) > 13:14:31,928 ERROR [STDERR] at > org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:38 > 2) > 13:14:31,928 ERROR [STDERR] at > sun.reflect.GeneratedMethodAccessor38.invoke(Unknown Source) > 13:14:31,928 ERROR [STDERR] at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccesso > rImpl.java:25) > > 13:14:31,928 ERROR [STDERR] at > java.lang.reflect.Method.invoke(Method.java:324) > 13:14:31,928 ERROR [STDERR] at > sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:261) > 13:14:31,928 ERROR [STDERR] at > sun.rmi.transport.Transport$1.run(Transport.java:148) > 13:14:31,938 ERROR [STDERR] at > java.security.AccessController.doPrivileged(Native Method) > 13:14:31,938 ERROR [STDERR] at > sun.rmi.transport.Transport.serviceCall(Transport.java:144) > 13:14:31,938 ERROR [STDERR] at > sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460 > ) > 13:14:31,938 ERROR [STDERR] at > sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.j > ava:701) > 13:14:31,938 ERROR [STDERR] at > java.lang.Thread.run(Thread.java:536) > > Ciao, > Jonathan O'Connor > XCOM Dublin > > > > ------------------------------------------------------- > This SF.Net email sponsored by: Free pre-built ASP.NET sites including > Data Reports, E-commerce, Portals, and Forums are available now. > Download today and enter to win an XBOX or Visual Studio .NET. > http://aspnet.click-url.com/go/psa00100003ave/ > direct;at.aspnet_072303_01/01 > _______________________________________________ > JBoss-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/jboss-user ------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user ------------------------------------------------------- This SF.Net email sponsored by: Free pre-built ASP.NET sites including Data Reports, E-commerce, Portals, and Forums are available now. Download today and enter to win an XBOX or Visual Studio .NET. http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01 _______________________________________________ JBoss-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-user