|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectcom.ibm.di.connector.Connector
com.ibm.di.connector.JDBCConnector
public class JDBCConnector
This connector provides access to JDBC/ODBC based systems. The connector will attempt to perform as much conversion between types as possible.
| Field Summary |
|---|
| Fields inherited from class com.ibm.di.connector.Connector |
|---|
ALL_MODES, myLog, PROPERTY_MESSAGE, PROPERTY_READER, PROPERTY_WRITER |
| Constructor Summary | |
|---|---|
JDBCConnector()
Constructor |
|
| Method Summary | |
|---|---|
void |
alterSession(String command)
Create a ALTER SESSION Sql statement, and execute it. |
void |
commit()
Commit the last transactions |
void |
deleteEntry(Entry entry,
SearchCriteria search)
Deletes an existing entry. |
String |
execSQL(String sql)
Executes an SQL statement. |
String |
execSQLSelect(String sql)
Executes an SQL statement, the returned values can be retrieved using getNextSQLSelectEntry() |
Entry |
findEntry(SearchCriteria search)
Finds an existing entry. |
Connection |
getConnection()
Returns the Connection handle for the currently open session. |
Entry |
getNextEntry()
Gets the nextEntry attribute of the JDBCConnector object |
Entry |
getNextSQLSelectEntry()
Gets the nextSQLSelectEntry entry |
int |
getNumSkipLookupAffected()
Returns the number of affected entries after skipping lookup |
boolean |
getParameterSubstitution()
Returns value of enableParamSubstitute parameter |
Statement |
getStatement()
Returns the Statement handle for the currently open session |
String |
getSubClause(SearchCriteria.rscSearch rs,
boolean ps)
Constructs an SQL where expression from an rscSearch class. |
String |
getVersion()
Return version information |
String |
getWhereClause(SearchCriteria search,
boolean ps)
Creates where clause for SQL statement |
void |
initialize(Object o)
Initialize the connector and discover syntax |
boolean |
isDeltaSupported()
Returns true if this connector is able to perform delta updates |
boolean |
isEOCflag()
Checks whether the end of cycle is reached |
boolean |
isInsertPaddingDisabled()
Returns true if padding is disabled for insert |
boolean |
isIOException(Throwable e)
Method checks exception type |
boolean |
isLookupPaddingDisabled()
Returns true if padding is disabled for lookup |
boolean |
isUpdatePaddingDisabled()
Returns true if padding is disabled for update |
void |
modEntry(Entry entry,
SearchCriteria search)
Modifies an existing entry. |
void |
putEntry(Entry entry)
Adds a new entry. |
Object |
querySchema(Object table)
Query for schema of table |
Vector<String> |
queryTables()
Queries for list Of tables |
void |
rollback()
Rolls back the transactions since the last commit |
void |
saveMetaData(ResultSetMetaData md)
Saves the Meta Data info |
void |
selectEntries()
Prepares for getNextEntry(). |
boolean |
setCommitMode(String mode)
Set the commit behavior of this JDBC Connector. |
void |
setCurrent(Entry entry,
SearchCriteria search)
Change the SearchCriteria search to find the entry sent as a parameter. |
void |
setEOCflag(boolean eoc)
Sets the EOC flag |
void |
setPaddingInInsert(boolean val)
Enables and disables the padding while insert |
void |
setPaddingInLookup(boolean val)
Enables and disables the padding while lookup |
void |
setPaddingInUpdate(boolean val)
Enables and disables the padding while update |
void |
setParameterSubstitution(boolean val)
set enableParamSubstitute parameter |
PreparedStatement |
setPreparedDeleteStatement(String preparedSql)
Sets a prepared statement for future calls to deleteEntry(). |
PreparedStatement |
setPreparedFindStatement(String preparedSql)
Sets a prepared statement for future calls to findEntries(). |
PreparedStatement |
setPreparedInsertStatement(String preparedSql)
Sets a prepared statement for future calls to putEntry(). |
PreparedStatement |
setPreparedModifyStatement(String preparedSql)
Sets a prepared statement for future calls to modEntry(). |
PreparedStatement |
setPreparedSelectStatement(String preparedSql)
Sets a prepared statement for future calls to selectEntries(). |
void |
setResultSet(ResultSet rs)
Instructs this connector to use the provided result set instead of its own. |
void |
setSessionParameters()
Sets the sessionParameters attribute of the JDBCConnector object |
String |
sqlValue(String name,
Object value,
boolean padString)
Converts java type to SQL type |
void |
terminate()
terminate - close handles and connections |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.ibm.di.connector.ConnectorInterface |
|---|
getConfiguration, getContext, getFindEntryCount, getFirstFindEntry, getMaxDuplicateEntries, getName, getNextClient, getNextFindEntry, getParam, getPushbackEntry, getRawConnectorConfiguration, isExceptionFatal, modEntry, pushback, queryOperations, queryReply, reconnect, registerScriptBeans, replyEntry, setConfiguration, setContext, setLog, setMaxDuplicateEntries, setName, setParam, setRSInterface, terminateServer |
| Constructor Detail |
|---|
public JDBCConnector()
| Method Detail |
|---|
public void initialize(Object o)
throws Exception
initialize in interface ConnectorInterfaceinitialize in class Connectoro - Ignored
Exception - Throws exception if required JDBC parameters are not set.
public void setSessionParameters()
throws SQLException
SQLException - Contains exception thrown during database operations
public void alterSession(String command)
throws SQLException
command - The rest of the ALTER SESSION statement
SQLException - Contains exception thrown during database operationspublic boolean isDeltaSupported()
isDeltaSupported in interface ConnectorInterfaceisDeltaSupported in class Connectorpublic boolean isIOException(Throwable e)
isIOException in interface ConnectorInterfaceisIOException in class Connectore - Exception
public void terminate()
terminate in interface ConnectorInterfaceterminate in class Connector
public void selectEntries()
throws Exception
selectEntries in interface ConnectorInterfaceselectEntries in class ConnectorException - Exception thrown during database operationsgetNextEntry()
public Entry getNextEntry()
throws Exception
getNextEntry in interface ConnectorInterfacegetNextEntry in class ConnectorException - Exception thrown during database operationsConnectorInterface.selectEntries()public void setPaddingInInsert(boolean val)
val - public void setPaddingInLookup(boolean val)
val - value to setpublic void setPaddingInUpdate(boolean val)
val - value to setpublic boolean isLookupPaddingDisabled()
public boolean isUpdatePaddingDisabled()
public boolean isInsertPaddingDisabled()
public Entry findEntry(SearchCriteria search)
throws Exception
findEntry in interface ConnectorInterfacefindEntry in class Connectorsearch - The search criteria used to locate the entry to be modified
Exception - derived from the connector's underlying classes
public void modEntry(Entry entry,
SearchCriteria search)
throws Exception
modEntry in interface ConnectorInterfacemodEntry in class Connectorentry - The entry datasearch - The search criteria used to locate the entry to be modified
Exception - Any exceptions thrown by the connector's underlying
classes
public void putEntry(Entry entry)
throws Exception
putEntry in interface ConnectorInterfaceputEntry in class Connectorentry - The entry object
Exception - Any exceptions thrown by the connector's underlying
classes
public void deleteEntry(Entry entry,
SearchCriteria search)
throws Exception
deleteEntry in interface ConnectorInterfacedeleteEntry in class Connectorentry - The entry datasearch - The search criteria used to locate the entry to be modified
Exception - derived from the connector's underlying classespublic String execSQL(String sql)
sql - The SQL statement to execute
public String execSQLSelect(String sql)
sql - The SQL statement to execute
public Entry getNextSQLSelectEntry()
throws Exception
Exception - if an error occursexecSQLSelect(java.lang.String)
public void commit()
throws SQLException
SQLException - Thrown if an error occurs
public void rollback()
throws SQLException
SQLException - Thrown if an error occurscommit(),
setCommitMode(java.lang.String)public boolean setCommitMode(String mode)
mode - The intended behavior. Possible values are:
commit()
public Vector<String> queryTables()
throws Exception
queryTables in class ConnectorException - Thrown if error occursVector
public Object querySchema(Object table)
throws Exception
querySchema in interface ConnectorInterfacequerySchema in class Connectortable - Entry object
Exception - Thrown if error occursEntry,
Vectorpublic Statement getStatement()
public void setResultSet(ResultSet rs)
throws Exception
rs - The new resultSet value
Exception - Thrown if error occurspublic Connection getConnection()
public String getWhereClause(SearchCriteria search,
boolean ps)
throws Exception
search - SearchCriteriaps - Boolean which determines if is a prepared statement.
Exception - Thrown if error occurs
public String getSubClause(SearchCriteria.rscSearch rs,
boolean ps)
throws Exception
rs - search criteriaps - Boolean which determines if it is a prepared statement.
Exception
public String sqlValue(String name,
Object value,
boolean padString)
name - name of the typevalue - typepadString - true if padding enabled
public void saveMetaData(ResultSetMetaData md)
throws SQLException
md - ResultSetMetaData
SQLException - Thrown if there is an error
public void setCurrent(Entry entry,
SearchCriteria search)
setCurrent in interface ConnectorInterfacesetCurrent in class Connectorentry - The entry we want to find for modification/deletesearch - The SearchCriteria we want to changepublic String getVersion()
getVersion in interface VersionInfoInterfacepublic void setParameterSubstitution(boolean val)
val - true if parameter substitution is enabledpublic boolean getParameterSubstitution()
public int getNumSkipLookupAffected()
getNumSkipLookupAffected in interface SkipLookupInterfacepublic boolean isEOCflag()
public void setEOCflag(boolean eoc)
eoc - true if EOC is reached
public PreparedStatement setPreparedSelectStatement(String preparedSql)
throws Exception
ps = thisConnector.connector.setPreparedSelectStatement("Select * from tableName where fieldName = ? and field2= ?")
ps.setInteger(1, someValue)
ps.setObject(2, someObject)
Once setPreparedSelectStatement is called, that PreparedStatement will be used for every selectEntries() from then on.
Calling the method with null as parameter could reset the behavior to using the GUI defined parameters.
preparedSql - The prepared statement (string) to use.
SQLException - if the PreparedStatement could not be created
Exception
public PreparedStatement setPreparedFindStatement(String preparedSql)
throws Exception
ps = thisConnector.connector.setPreparedFindStatement("Select * from tableName where fieldName = ? and field2= ?")
And this code could be put in the Before Lookup Hook:
ps.setInteger(1, someValue)
ps.setObject(2, someObject)
Once setPreparedFindStatement is called, that PreparedStatement will be used for every findEntries() from then on,
effectively overriding any Link Criteria.
Calling the method with null as parameter could reset the behavior to using the GUI defined parameters.
preparedSql - The prepared statement (string) to use.
SQLException - if the PreparedStatement could not be created
Exception
public PreparedStatement setPreparedModifyStatement(String preparedSql)
throws Exception
ps = thisConnector.connector.setPreparedModifyStatement("UPDATE tableName SET fieldName1 = ?, field2 = ? WHERE field3 = ?")
ps.setTime(1, conn.fieldName1)
ps.setObject(2, conn.field2)
ps.setInteger(3, conn.field3)
Once setPreparedModifyStatement is called, that PreparedStatement will be used for every modEntry() from then on,
effectively overriding any Link Criteria, and also ignoring all values in the conn Entry.
Calling the method with null as parameter will reset the behavior to using the GUI defined parameters.
preparedSql - The prepared statement (string) to use.
SQLException - if the PreparedStatement could not be created
Exception
public PreparedStatement setPreparedInsertStatement(String preparedSql)
throws Exception
ps = thisConnector.connector.setPreparedInsertStatement("INSERT into tableName (fieldName1,field2,field3) VALUES (?,?,?)")
ps.setString(1, conn.fieldName1)
ps.setObject(2, conn.field2)
ps.setInteger(3, conn.field3)
Once setPreparedInsertStatement is called, that PreparedStatement will be used for every putEntry() from then on,
effectively ignoring all values in the conn Entry.
Calling the method with null as parameter will reset the behavior to using the GUI defined parameters.
preparedSql - The prepared statement (string) to use.
SQLException - if the PreparedStatement could not be created
Exception
public PreparedStatement setPreparedDeleteStatement(String preparedSql)
throws Exception
ps = thisConnector.connector.setPreparedDeleteStatement("DELETE from tableName where fieldName1 = ? and field2 = ?")
ps.setTime(1, conn.fieldName1)
ps.setObject(2, conn.field2)
Here is an example showing how to delete several Entries:
ps = thisConnector.connector.setPreparedDeleteStatement("DELETE from tableName where fieldName1 = ? and field2 = ?")
while (...) {
ps.setTime(1, ...)
ps.setObject(2, ...)
thisConnector.connector.deleteEntry(null); //No need to provide an Entry when using prepared statement
}
thisConnector.connector.setPreparedDeleteStatement(null)
Once setPreparedDeleteStatement has been called, that PreparedStatement will be used for every deleteEntry() from then on,
effectively overriding any Link Criteria.
Calling the method with null as parameter will reset the behavior to using the GUI defined parameters.
preparedSql - The prepared statement (string) to use.
SQLException - if the PreparedStatement could not be created
Exception
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||