public class JdbcReader extends DataReader
DataEndpoint.State
Modifier and Type | Field and Description |
---|---|
protected Record |
currentRecord |
fieldLineage, recordLineage
lastRecord, PRODUCT, PRODUCT_VERSION, VENDOR, XML_INPUT_FACTORY_KEY
BUFFER_SIZE, captureElapsedTime, DEFAULT_READ_BUFFER_SIZE
id, log, name, TIMESTAMP_FORMAT
Constructor and Description |
---|
JdbcReader(Connection connection,
String queryString)
Creates a new instance with the
autoCloseConnection property set to false . |
JdbcReader(Connection connection,
String queryString,
Object... parameters)
Creates a new instance with the
autoCloseConnection property set to false . |
JdbcReader(Connection connection,
String queryString,
Object[] parameters,
int[] parameterSqlTypes)
Creates a new instance with the
autoCloseConnection property set to false . |
JdbcReader(JdbcConnectionFactory factory,
String queryString)
Creates a new instance with the
autoCloseConnection property set to true . |
JdbcReader(JdbcConnectionFactory factory,
String queryString,
Object... parameters)
Creates a new instance with the
autoCloseConnection property set to true . |
JdbcReader(JdbcConnectionFactory factory,
String queryString,
Object[] parameters,
int[] parameterSqlTypes)
Creates a new instance with the
autoCloseConnection property set to true . |
Modifier and Type | Method and Description |
---|---|
DataException |
addExceptionProperties(DataException exception)
Adds this endpoint's current state to a
DataException . |
protected Record |
addLineage(Record record) |
void |
close()
Indicates that this endpoint has finished reading or writing.
|
boolean |
getAutoCloseConnection()
Indicates if the database connection in this endpoint should be closed when the endpoint is closed.
|
Integer |
getFetchSize()
The fetch size to set on the
Statement using Statement.setFetchSize(int) or null if the connection's default should be used (default null ). |
boolean |
getUseColumnLabel() |
JdbcValueReader |
getValueReader() |
boolean |
isLineageSupported() |
boolean |
isStrictTypeMapping()
Indicates if database types should be mapped to java type based only on
java.sql.Types as defined by Sun/Oracle (defaults to false). |
void |
open()
Makes this endpoint ready for reading or writing.
|
Record |
read()
Reads the next record from this
DataReader and increases the record-count by 1. |
protected Record |
readImpl()
Overridden by subclasses to read the next record from this
DataReader . |
JdbcReader |
setAutoCloseConnection(boolean closeConnection)
Indicates if the database connection in this endpoint should be closed when the endpoint is closed.
|
JdbcReader |
setFetchSize(Integer fetchSize)
The fetch size to set on the
Statement using Statement.setFetchSize(int) or null if the connection's default should be used (default null ). |
JdbcReader |
setSaveLineage(boolean saveLineage) |
JdbcReader |
setStrictTypeMapping(boolean strictTypeMapping)
Indicates if database types should be mapped to java type based only on
java.sql.Types as defined by Sun/Oracle (defaults to false). |
JdbcReader |
setUseColumnLabel(boolean useColumnLabel)
When set to
true , column labels (or aliases) will be used for field names instead
of the underlying, real column names. |
JdbcReader |
setValueReader(JdbcValueReader valueReader) |
available, getBufferSize, getNestedEndpoint, getNestedReader, getRootEndpoint, getRootReader, isExhausted, isSaveLineage, peek, pop, push, skip
decrementRecordCount, enableJmx, getLastRecord, getRecordCount, getRecordCountAsBigInteger, getRecordCountAsString, incrementRecordCount, isRecordCountBigInteger, resetRecordCount, toString
addElapsedtime, assertClosed, assertNotOpened, assertOpened, finalize, getClosedOn, getDescription, getElapsedTime, getElapsedTimeAsString, getOpenedOn, getOpenElapsedTime, getOpenElapsedTimeAsString, getSelfTime, getSelfTimeAsString, getState, isCaptureElapsedTime, isClosed, isOpen, setCaptureElapsedTime, setDescription
protected Record currentRecord
public JdbcReader(Connection connection, String queryString)
autoCloseConnection
property set to false
.connection
- queryString
- public JdbcReader(Connection connection, String queryString, Object... parameters)
autoCloseConnection
property set to false
.connection
- queryString
- parameters
- public JdbcReader(Connection connection, String queryString, Object[] parameters, int[] parameterSqlTypes)
autoCloseConnection
property set to false
.connection
- queryString
- parameters
- parameterSqlTypes
- public JdbcReader(JdbcConnectionFactory factory, String queryString) throws DataException
autoCloseConnection
property set to true
.factory
- queryString
- DataException
public JdbcReader(JdbcConnectionFactory factory, String queryString, Object... parameters)
autoCloseConnection
property set to true
.factory
- queryString
- parameters
- public JdbcReader(JdbcConnectionFactory factory, String queryString, Object[] parameters, int[] parameterSqlTypes)
autoCloseConnection
property set to true
.factory
- queryString
- parameters
- parameterSqlTypes
- public boolean getAutoCloseConnection()
false
if this instance was constructed with a Connection
or true
if constructed with a JdbcConnectionFactory
.public JdbcReader setAutoCloseConnection(boolean closeConnection)
false
if this instance was constructed with a Connection
or true
if constructed with a JdbcConnectionFactory
.public JdbcValueReader getValueReader()
public JdbcReader setValueReader(JdbcValueReader valueReader)
public boolean getUseColumnLabel()
public Integer getFetchSize()
Statement
using Statement.setFetchSize(int)
or null
if the connection's default should be used (default null
).public JdbcReader setFetchSize(Integer fetchSize)
Statement
using Statement.setFetchSize(int)
or null
if the connection's default should be used (default null
).public JdbcReader setUseColumnLabel(boolean useColumnLabel)
true
, column labels (or aliases) will be used for field names instead
of the underlying, real column names. Defaults to false
.public JdbcReader setSaveLineage(boolean saveLineage)
setSaveLineage
in class DataReader
public boolean isStrictTypeMapping()
java.sql.Types
as defined by Sun/Oracle (defaults to false).
Otherwise, the column display size and scale will be considered for numeric types.public JdbcReader setStrictTypeMapping(boolean strictTypeMapping)
java.sql.Types
as defined by Sun/Oracle (defaults to false).
Otherwise, the column display size and scale will be considered for numeric types.public DataException addExceptionProperties(DataException exception)
Endpoint
DataException
. Since this method is called whenever an
exception is thrown, subclasses should override it to add their specific information.addExceptionProperties
in class DataReader
public Record read() throws DataException
DataReader
DataReader
and increases the record-count by 1.
This method will first read any pushed (DataReader.push(Record)
) records before reading from the underlying source.
If no record is available, null
will be returned. This method blocks until a record is available,
the end of the stream is reached, or an exception is thrown.
Any exception raised while reading will be converted to a DataException
using DataObject.exception(Throwable)
.
Subclasses generally do not need to override this method, instead they should implement DataReader.readImpl()
.
read
in class DataReader
DataException
DataReader.push(Record)
,
DataReader.peek(int)
,
DataReader.read()
protected Record readImpl() throws Throwable
DataReader
DataReader
. The default
implementation of DataReader.read()
now insures that this method will not be called again after it returns
a null
.
If no record is available, null
will be returned.
readImpl
in class DataReader
Throwable
public boolean isLineageSupported()
isLineageSupported
in class DataReader
protected Record addLineage(Record record)
addLineage
in class DataReader
public void open()
DataEndpoint
open
in class DataEndpoint
public void close()
DataEndpoint
close
in class DataEndpoint
Copyright (c) 2006-2024 North Concepts Inc. All Rights Reserved.