|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.springframework.jdbc.support.lob.AbstractLobHandler org.springframework.jdbc.support.lob.DefaultLobHandler
public class DefaultLobHandler
Default implementation of the LobHandler
interface. Invokes
the direct accessor methods that java.sql.ResultSet
and java.sql.PreparedStatement
offer.
This LobHandler should work for any JDBC driver that is JDBC compliant
in terms of the spec's suggestions regarding simple BLOB and CLOB handling.
This does not apply to Oracle 9i, and only to a limited degree to Oracle 10g!
As a consequence, use OracleLobHandler
for accessing Oracle BLOBs/CLOBs.
setStreamAsLob(boolean)
,
ResultSet.getBytes(int)
,
ResultSet.getBinaryStream(int)
,
ResultSet.getString(int)
,
ResultSet.getAsciiStream(int)
,
ResultSet.getCharacterStream(int)
,
PreparedStatement.setBytes(int, byte[])
,
PreparedStatement.setBinaryStream(int, java.io.InputStream, int)
,
PreparedStatement.setString(int, java.lang.String)
,
PreparedStatement.setAsciiStream(int, java.io.InputStream, int)
,
PreparedStatement.setCharacterStream(int, java.io.Reader, int)
Nested Class Summary | |
---|---|
protected class |
DefaultLobHandler.DefaultLobCreator
|
Field Summary | |
---|---|
protected Log |
logger
|
Constructor Summary | |
---|---|
DefaultLobHandler()
|
Method Summary | |
---|---|
InputStream |
getBlobAsBinaryStream(ResultSet rs,
int columnIndex)
Retrieve the given column as binary stream from the given ResultSet. |
byte[] |
getBlobAsBytes(ResultSet rs,
int columnIndex)
Retrieve the given column as bytes from the given ResultSet. |
InputStream |
getClobAsAsciiStream(ResultSet rs,
int columnIndex)
Retrieve the given column as ASCII stream from the given ResultSet. |
Reader |
getClobAsCharacterStream(ResultSet rs,
int columnIndex)
Retrieve the given column as character stream from the given ResultSet. |
String |
getClobAsString(ResultSet rs,
int columnIndex)
Retrieve the given column as String from the given ResultSet. |
LobCreator |
getLobCreator()
Create a new LobCreator instance, i.e. a session for creating BLOBs and CLOBs. |
void |
setStreamAsLob(boolean streamAsLob)
Specify whether a submitted binary stream / character stream should be passed to the JDBC driver as explicit LOB content, using the JDBC 4.0 setBlob / setClob
method with a stream argument. |
Methods inherited from class org.springframework.jdbc.support.lob.AbstractLobHandler |
---|
getBlobAsBinaryStream, getBlobAsBytes, getClobAsAsciiStream, getClobAsCharacterStream, getClobAsString |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final Log logger
Constructor Detail |
---|
public DefaultLobHandler()
Method Detail |
---|
public void setStreamAsLob(boolean streamAsLob)
setBlob
/ setClob
method with a stream argument.
Default is "false", using the common JDBC 2.0 setBinaryStream
/ setCharacterStream
method for setting the content.
Switch this to "true" for explicit JDBC 4.0 usage, provided that
your JDBC driver actually supports those JDBC 4.0 operations.
public byte[] getBlobAsBytes(ResultSet rs, int columnIndex) throws SQLException
LobHandler
ResultSet.getBytes
or work with
ResultSet.getBlob
, depending on the database and driver.
rs
- the ResultSet to retrieve the content fromcolumnIndex
- the column index to use
null
in case of SQL NULL
SQLException
- if thrown by JDBC methodsResultSet.getBytes(int)
public InputStream getBlobAsBinaryStream(ResultSet rs, int columnIndex) throws SQLException
LobHandler
ResultSet.getBinaryStream
or work with
ResultSet.getBlob
, depending on the database and driver.
rs
- the ResultSet to retrieve the content fromcolumnIndex
- the column index to use
null
in case of SQL NULL
SQLException
- if thrown by JDBC methodsResultSet.getBinaryStream(int)
public String getClobAsString(ResultSet rs, int columnIndex) throws SQLException
LobHandler
ResultSet.getString
or work with
ResultSet.getClob
, depending on the database and driver.
rs
- the ResultSet to retrieve the content fromcolumnIndex
- the column index to use
null
in case of SQL NULL
SQLException
- if thrown by JDBC methodsResultSet.getString(int)
public InputStream getClobAsAsciiStream(ResultSet rs, int columnIndex) throws SQLException
LobHandler
ResultSet.getAsciiStream
or work with
ResultSet.getClob
, depending on the database and driver.
rs
- the ResultSet to retrieve the content fromcolumnIndex
- the column index to use
null
in case of SQL NULL
SQLException
- if thrown by JDBC methodsResultSet.getAsciiStream(int)
public Reader getClobAsCharacterStream(ResultSet rs, int columnIndex) throws SQLException
LobHandler
ResultSet.getCharacterStream
or work with
ResultSet.getClob
, depending on the database and driver.
rs
- the ResultSet to retrieve the content fromcolumnIndex
- the column index to use
SQLException
- if thrown by JDBC methodsResultSet.getCharacterStream(int)
public LobCreator getLobCreator()
LobHandler
LobCreator.close()
|
The Spring Framework | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |