Bug 147339 Database Image Support
The new IBlob interface in BIRT 2.0 does not support the PostgreSQL driver, which does blobs via byte array. As noted in a post to the Birt eclipse newsgroup entitled "2.0 BD Image Support" on Mon, 6 Feb 2006 22:03:29 +0000 (UTC), here's the solution that needs to integrated into BIRT. Could you please add this to the 2.1 release? org.eclipse.birt.report.data.oda.jdbc.ResultSet need to be changed to look like: /* * (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) { throw new JDBCException( ResourceConstants.RESULTSET_CANNOT_GET_BLOB_VALUE, e2); } } catch (SQLException e) { // try using get bytes/ try { byte[] bytes = rs.getBytes(columnName); return new Blob(SqlBlobUtil.newBlob(new ByteArrayInputStream( bytes))); } catch (SQLException e2) { throw new JDBCException( ResourceConstants.RESULTSET_CANNOT_GET_BLOB_VALUE, e2); } } } /* * (non-Javadoc) * * @see org.eclipse.datatools.connectivity.oda.IAdvancedQuery#getBlob(int) */ public IBlob getBlob(int index) throws OdaException { assertNotNull(rs); try { java.sql.Blob blob = rs.getBlob(index); return new Blob(blob); } // especially for MS Access, which does not support getBlob method catch (UnsupportedOperationException e1) { try { InputStream inputStream = rs.getBinaryStream(index); return new Blob(SqlBlobUtil.newBlob(inputStream)); } catch (SQLException e2) { throw new JDBCException( ResourceConstants.RESULTSET_CANNOT_GET_BLOB_VALUE, e2); } } catch (SQLException e) { // try using get bytes/ try { byte[] bytes = rs.getBytes(index); return new Blob(SqlBlobUtil.newBlob(new ByteArrayInputStream( bytes))); } catch (SQLException e2) { throw new JDBCException( ResourceConstants.RESULTSET_CANNOT_GET_BLOB_VALUE, e2); } } }
data/org.eclipse.birt.report.data.oda.jdbc/src/org/eclipse/birt/report/data/oda/jdbc/ResultSet.java
* 
	 * @see org.eclipse.datatools.connectivity.oda.IResultSet#getString(java.lang.String)
	 */
	public String getString( String columnName ) throws OdaException
	{
		assertNotNull( rs );
		try
		{
			
			return rs.getString( columnName );
		}
		catch ( SQLException e )
		{
			throw new JDBCException( ResourceConstants.RESULTSET_CANNOT_GET_STRING_VALUE,
					e );
		}
	}
	/*
	 * 
	 * @see org.eclipse.datatools.connectivity.oda.IResultSet#getInt(int)
	 */
	public int getInt( int index ) throws OdaException
	{
		assertNotNull( rs );
		try
		{
			
			return rs.getInt( index );
		}
		catch ( SQLException e )