Project: Birt
Bug 375294 JBoss + Sybase database issue
Reported: 2012-03-26 05:12:15 | Status: resolved fixed

Build Identifier: 3.7.100.v20110510-0712 Hi, JBoss modify the UnsupportedOperationException send by sybase driver by a org.jboss.util.NestedSQLException Code of org.jboss.resource.adapter.jdbc.WrappedConnection : protected SQLException checkException(Throwable t) throws SQLException { Throwable result = null; if (mc != null) result = mc.connectionError(t); if (result instanceof SQLException) { throw (SQLException) result; } else { throw new NestedSQLException("Error", result); } } In org.eclipse.birt.report.data.oda.jdbc.ResultSet : /* (non-Javadoc) * @see org.eclipse.datatools.connectivity.oda.IAdvancedQuery#getBlob(java.lang.String) */ public IBlob getBlob( String columnName ) throws OdaException { assertNotNull( rs ); try { java.sql.Blob blob = rs.getBlob( columnName ); return new Blob( blob ); } // especially for MS Access, which does not support getBlob method catch ( UnsupportedOperationException e1 ) { try { InputStream inputStream = rs.getBinaryStream( columnName ); return new Blob( SqlBlobUtil.newBlob( inputStream ) ); } catch ( SQLException e2 ) { ... } } catch ( SQLException e ) { // especially for the PostgreSQL driver, which does blobs via byte // array try { byte[] bytes = rs.getBytes( columnName ); if( bytes == null ) return null; return new Blob( SqlBlobUtil.newBlob( new ByteArrayInputStream( bytes ) ) ); } catch ( SQLException e2 ) { .... } } } Example of correction: /* (non-Javadoc) * @see org.eclipse.datatools.connectivity.oda.IAdvancedQuery#getBlob(java.lang.String) */ public IBlob getBlob( String columnName ) throws OdaException { assertNotNull( rs ); try { java.sql.Blob blob = rs.getBlob( columnName ); return new Blob( blob ); } // especially for MS Access, which does not support getBlob method catch ( Exception e ) { Exception e1; if (e.getClass().getName().equals("org.jboss.util.NestedSQLException")) { Class cls = e.getClass(); Method meth = cls.getMethod("getNested", null); e1 = meth.invoke(e, null); } else { e1 = e; } if ( e1 instanceof UnsupportedOperationException ) { try { InputStream inputStream = rs.getBinaryStream( columnName ); return new Blob( SqlBlobUtil.newBlob( inputStream ) ); } catch ( SQLException e2 ) { ... } } else if( e1 instance SQLException ) { // especially for the PostgreSQL driver, which does blobs via byte // array try { byte[] bytes = rs.getBytes( columnName ); if( bytes == null ) return null; return new Blob( SqlBlobUtil.newBlob( new ByteArrayInputStream( bytes ) ) ); } catch ( SQLException e2 ) { .... } } } } Reproducible: Always Steps to Reproduce: 1. Install JBoos 2. Install Jconn3.jar (the sybase driver) in JBoss 3. Deploy Birt in JBoss 4. Try to generate a report

Files changed in fix:
data/org.eclipse.birt.report.data.oda.jdbc/src/org/eclipse/birt/report/data/oda/jdbc/ResultSet.java