com.j_spaces.sadapter.GenericJDBC.lob
Class DefaultLobHandler

java.lang.Object
  extended by com.j_spaces.sadapter.GenericJDBC.lob.DefaultLobHandler
All Implemented Interfaces:
ILobHandler
Direct Known Subclasses:
OracleLobHandler

public class DefaultLobHandler
extends Object
implements ILobHandler

Default implementation of the ILobHandler interface.

This LobHandler should work for any JDBC driver that is JDBC compliant in terms of the spec's suggestions regarding simple BLOB handling. This does not apply to Oracle 9i - in this case use OracleLobHandler.

Since:
5.1

Constructor Summary
DefaultLobHandler()
           
 
Method Summary
 byte[] getBlobAsBytes(ResultSet rs, int columnIndex)
          Retrieve the given column as bytes from the given ResultSet.
 byte[] getBlobAsBytes(ResultSet rs, String columnName)
          Retrieve the given column as bytes from the given ResultSet.
 void init()
          Initialize lob handler
 void setBlobAsBytes(PreparedStatement ps, int paramIndex, byte[] content)
          Set the given content as bytes on the given statement, using the given parameter index.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultLobHandler

public DefaultLobHandler()
Method Detail

getBlobAsBytes

public byte[] getBlobAsBytes(ResultSet rs,
                             int columnIndex)
                      throws SQLException
Description copied from interface: ILobHandler
Retrieve the given column as bytes from the given ResultSet.

Specified by:
getBlobAsBytes in interface ILobHandler
Parameters:
rs - the ResultSet to retrieve the content from
columnIndex - the column index to use
Returns:
the content as byte array.
Throws:
SQLException - if thrown by JDBC methods

setBlobAsBytes

public void setBlobAsBytes(PreparedStatement ps,
                           int paramIndex,
                           byte[] content)
                    throws SQLException
Description copied from interface: ILobHandler
Set the given content as bytes on the given statement, using the given parameter index.

Specified by:
setBlobAsBytes in interface ILobHandler
Parameters:
ps - the PreparedStatement to the set the content on
paramIndex - the parameter index to use
content - the content as byte array
Throws:
SQLException - if thrown by JDBC methods

init

public void init()
          throws Exception
Description copied from interface: ILobHandler
Initialize lob handler

Specified by:
init in interface ILobHandler
Throws:
Exception

getBlobAsBytes

public byte[] getBlobAsBytes(ResultSet rs,
                             String columnName)
                      throws SQLException
Description copied from interface: ILobHandler
Retrieve the given column as bytes from the given ResultSet.

Specified by:
getBlobAsBytes in interface ILobHandler
Parameters:
rs - the ResultSet to retrieve the content from
columnName - the column name to use
Returns:
the content as byte array.
Throws:
SQLException - if thrown by JDBC methods