com.ibm.as400.access
Class AS400JDBCManagedDataSource
java.lang.Object
com.ibm.as400.access.AS400JDBCManagedDataSource
- All Implemented Interfaces:
- Cloneable, DataSource, Referenceable, Serializable
- Direct Known Subclasses:
- AS400JDBCManagedConnectionPoolDataSource
- public class AS400JDBCManagedDataSource
- extends Object
- implements DataSource, Referenceable, Serializable, Cloneable
This implementation of javax.sql.DataSource can be used to produce Connection objects that will automatically participate in connection pooling, and are managed by the Toolbox's built-in connection pooling manager.
A DataSource is a factory for connections to the physical data source that this DataSource object represents. An alternative to the DriverManager facility, a DataSource object is the preferred means of getting a connection. An object that implements the DataSource interface will typically be registered with a naming service based on the Java Naming and Directory (JNDI) API.
A DataSource object has properties that can be modified when necessary. For example, if the data source is moved to a different system, the property for the system can be changed. The benefit is that because the data source's properties can be changed, any code accessing that data source does not need to be changed.
A driver that is accessed via a DataSource object does not register itself with the DriverManager. Rather, a DataSource object is retrieved though a lookup operation and then used to create a Connection object. With a basic implementation, the connection obtained through a DataSource object is identical to a connection obtained through the DriverManager facility.
Caution: To avoid the pitfalls of "double-managed" pools, do not use this class in conjunction with a separate connection pool manager, such as that available in WebSphere. When a separate pool manager is provided, use AS400JDBCDataSource
instead.
- See Also:
AS400JDBCManagedConnectionPoolDataSource
,
AS400JDBCDataSource
,
AS400JDBCConnectionPoolDataSource
,
AS400JDBCXADataSource
,
Serialized Form
Method Summary |
boolean |
checkPoolHealth(boolean logStatistics)
Verifies the health of the connection pool. |
Object |
clone()
Method to create a clone of AS400JDBCManagedDataSource. |
void |
closePool()
Shuts down the connection pool in an orderly manner. |
String |
getAccess()
Returns the level of database access for the connection. |
int |
getBehaviorOverride()
Returns what behaviors of the Toolbox JDBC driver have been overridden.
|
int |
getBidiStringType()
Returns the output string type of bidi data, as defined by the CDRA
(Character Data Representation Architecture). |
int |
getBlockCriteria()
Returns the criteria for retrieving data from the system in
blocks of records. |
int |
getBlockSize()
Returns the block size in kilobytes to retrieve from the i5/OS system and
cache on the client. |
Connection |
getConnection()
Returns a database connection.
|
Connection |
getConnection(String user,
String password)
Returns a database connection using the specified user and password.
|
String |
getCursorSensitivity()
Returns the value of the cursorSensitivity property. |
String |
getDatabaseName()
Returns the value of the databaseName property. |
String |
getDataSourceName()
Returns the value of the dataSourceName property.
|
String |
getDateFormat()
Returns the date format used in date literals within SQL statements. |
String |
getDateSeparator()
Returns the date separator used in date literals within SQL statements.
|
String |
getDecfloatRoundingMode()
Returns the decfloat rounding mode. |
String |
getDecimalSeparator()
Returns the decimal separator used in numeric literals within SQL statements. |
String |
getDescription()
Returns the description of the data source. |
String |
getDriver()
Returns the JDBC driver implementation.
|
String |
getErrors()
Returns the amount of detail for error messages originating from
the i5/OS system. |
String |
getIgnoreWarnings()
Returns the ignore warnings property.
|
String |
getLibraries()
Returns the libraries to add to the server job's library list.
|
int |
getLobThreshold()
Returns the maximum LOB (large object) size in bytes that
can be retrieved as part of a result set. |
int |
getLoginTimeout()
Returns the timeout value in seconds.
|
PrintWriter |
getLogWriter()
Returns the log writer for this data source. |
int |
getMaximumPrecision()
Gets the maximum precision property. |
int |
getMaximumScale()
Gets the maximum scale property. |
int |
getMetadataSource()
Indicates how to retrieve DatabaseMetaData.
|
int |
getMetaDataSource()
Indicates how to retrieve DatabaseMetaData.
|
int |
getMinimumDivideScale()
Gets the minimum divide scale property. |
String |
getNaming()
Returns the naming convention used when referring to tables. |
String |
getPackage()
Returns the base name of the SQL package. |
int |
getPackageCcsid()
Gets the package CCSID property, which indicates the
CCSID in which statements are sent to the i5/OS system and
also the CCSID of the package they are stored in.
|
int |
getPackageCCSID()
Gets the package CCSID property, which indicates the
CCSID in which statements are sent to the i5/OS system and
also the CCSID of the package they are stored in.
|
String |
getPackageCriteria()
Returns the type of SQL statement to be stored in the SQL package. |
String |
getPackageError()
Returns the action to take when SQL package errors occur. |
String |
getPackageLibrary()
Returns the library for the SQL package. |
String |
getProxyServer()
Returns the name of the proxy server. |
String |
getQaqqinilib()
Returns the QAQQINI library name. |
String |
getQaqqiniLibrary()
Returns the QAQQINI library name. |
int |
getQueryOptimizeGoal()
Returns the "query optimize goal" property |
int |
getQueryStorageLimit()
Returns the storage limit in megabytes, that should be used for statements executing a query in a connection.
|
int |
getReceiveBufferSize()
Gets the socket 'receive buffer size' option. |
Reference |
getReference()
Returns the Reference object for the data source object.
|
String |
getRemarks()
Returns the source of the text for REMARKS columns in ResultSets returned
by DatabaseMetaData methods. |
String |
getSecondaryUrl()
Returns the secondary URL. |
String |
getSecondaryURL()
Returns the secondary URL. |
int |
getSendBufferSize()
Gets the socket 'send buffer size' option. |
String |
getServerName()
Returns the value of the serverName property. |
int |
getServerTrace()
Returns the level of tracing started on the JDBC server job.
|
int |
getServerTraceCategories()
Returns the level of tracing started on the JDBC server job.
|
long |
getSoLinger()
Gets the socket 'linger' option, in milliseconds. |
String |
getSort()
Returns how the i5/OS system sorts records before sending them to the
client. |
String |
getSortLanguage()
Returns the three-character language id to use for selection of a sort sequence. |
String |
getSortTable()
Returns the library and file name of a sort sequence table stored on the
i5/OS system. |
String |
getSortWeight()
Returns how the i5/OS system treats case while sorting records. |
long |
getSoTimeout()
Gets the socket 'timeout' option in milliseconds. |
String |
getTimeFormat()
Returns the time format used in time literals with SQL statements. |
String |
getTimeSeparator()
Returns the time separator used in time literals within SQL
statements. |
String |
getToolboxTrace()
Returns the toolbox trace category. |
String |
getToolboxTraceCategory()
Returns the toolbox trace category. |
String |
getTransactionIsolation()
Returns the i5/OS system's transaction isolation. |
String |
getTranslateHex()
Gets the translate hex property, which indicates how
the parser will treat hexadecimal literals. |
String |
getUser()
Returns the value of the 'user' property. |
int |
getXALooselyCoupledSupport()
Returns the value of the "XA loosely couple support" property.
|
void |
invalidate(String user,
String password)
Invalidates all pooled connections for the specified user/password.
|
boolean |
isAutoCommit()
Returns whether auto-commit mode is the default connection mode for new connections. |
boolean |
isAutocommitException()
Returns whether commit or rollback throws SQLException when autocommit is enabled. |
boolean |
isBidiImplicitReordering()
Indicates whether bidi implicit reordering is used. |
boolean |
isBidiNumericOrdering()
Indicates whether bidi numeric ordering round trip is used. |
boolean |
isBigDecimal()
Indicates whether a big decimal value is returned. |
boolean |
isCursorHold()
Indicates whether the cursor is held. |
boolean |
isDataCompression()
Indicates whether data compression is used. |
boolean |
isDataTruncation()
Indicates whether data truncation is used. |
boolean |
isExtendedDynamic()
Indicates whether extended dynamic support is used. |
boolean |
isExtendedMetadata()
Indicates whether the driver should request extended metadata from the
i5/OS system. |
boolean |
isExtendedMetaData()
Indicates whether the driver should request extended metadata from the
i5/OS system. |
boolean |
isFullOpen()
Indicates whether the i5/OS system fully opens a file when performing a query.
|
boolean |
isHoldInputLocators()
Returns the value of the "hold input locators" property |
boolean |
isHoldStatements()
Returns the value of the "hold statements" property |
boolean |
isKeepAlive()
Gets the socket 'keepalive' option. |
boolean |
isLazyClose()
Indicates whether to delay closing cursors until subsequent requests. |
boolean |
isPackageAdd()
Indicates whether to add newly prepared statements to the
SQL package specified on the "package" property. |
boolean |
isPackageCache()
Indicates whether a subset of the SQL package information is cached in client memory.
|
boolean |
isPackageClear()
Deprecated. |
boolean |
isPrefetch()
Indicates whether data is prefetched upon executing a SELECT statement.
|
boolean |
isPrompt()
Indicates whether the user is prompted if a user name or password is
needed to connect to the i5/OS system. |
boolean |
isRollbackCursorHold()
Returns the value of the "rollback cursor hold" property. |
boolean |
isSavePasswordWhenSerialized()
Indicates whether the password is saved locally with the rest of
the properties when this data source object is serialized.
|
boolean |
isSecure()
Indicates whether a Secure Socket Layer (SSL) connection is used to communicate
with the i5/OS system. |
boolean |
isTcpNoDelay()
Gets the socket 'TCP no delay' option. |
boolean |
isThreadUsed()
Indicates whether a thread is used. |
boolean |
isTrace()
Indicates whether trace messages should be logged. |
boolean |
isTranslateBinary()
Indicates whether binary data is translated. |
boolean |
isTranslateBoolean()
Indicates how Boolean objects are interpreted when setting the value
for a character field/parameter using the PreparedStatement.setObject(),
CallableStatement.setObject() or ResultSet.updateObject() methods. |
boolean |
isTrueAutocommit()
Indicates whether true auto commit support is used. |
boolean |
isTrueAutoCommit()
Indicates whether true auto commit support is used. |
void |
setAccess(String access)
Sets the level of database access for the connection. |
void |
setAutoCommit(boolean value)
Sets whether auto-commit mode is the default connection mode for new connections. |
void |
setAutocommitException(boolean value)
Sets whether commit or rollback throws SQLException when autocommit is enabled. |
void |
setBehaviorOverride(int behaviors)
Sets the Toolbox JDBC Driver behaviors to override. |
void |
setBidiImplicitReordering(boolean value)
Sets whether bidi implicit reordering is used. |
void |
setBidiNumericOrdering(boolean value)
Sets whether bidi numeric ordering round trip is used. |
void |
setBidiStringType(int bidiStringType)
Sets the output string type of bidi data, as defined by the CDRA (Character Data
Representation Architecture). |
void |
setBigDecimal(boolean value)
Sets whether a big decimal value is returned. |
void |
setBlockCriteria(int blockCriteria)
Sets the criteria for retrieving data from the i5/OS system in
blocks of records. |
void |
setBlockSize(int blockSize)
Sets the block size in kilobytes to retrieve from the i5/OS system and
cache on the client. |
void |
setCursorHold(boolean cursorHold)
Sets whether the cursor is held. |
void |
setCursorSensitivity(String cursorSensitivity)
Sets the cursor sensitivity to be requested from the database. |
void |
setDatabaseName(String databaseName)
Sets the databaseName property.
|
void |
setDataCompression(boolean compression)
Sets whether to use data compression. |
void |
setDataSourceName(String dataSourceName)
Sets the dataSourceName property.
|
void |
setDataTruncation(boolean truncation)
Sets whether to use data truncation. |
void |
setDateFormat(String dateFormat)
Sets the date format used in date literals within SQL statements. |
void |
setDateSeparator(String dateSeparator)
Sets the date separator used in date literals within SQL statements.
|
void |
setDecfloatRoundingMode(String decfloatRoundingMode)
Sets the decfloat rounding mode. |
void |
setDecimalSeparator(String decimalSeparator)
Sets the decimal separator used in numeric literals within SQL
statements. |
void |
setDescription(String description)
Sets the data source description. |
void |
setDriver(String driver)
Sets the JDBC driver implementation.
|
void |
setErrors(String errors)
Sets the amount of detail to be returned in the message for errors
occurring on the i5/OS system. |
void |
setExtendedDynamic(boolean extendedDynamic)
Sets whether to use extended dynamic support. |
void |
setExtendedMetadata(boolean extendedMetaData)
Sets whether the driver should request extended metadata from the
i5/OS system. |
void |
setExtendedMetaData(boolean extendedMetaData)
Sets whether the driver should request extended metadata from the
i5/OS system. |
void |
setFullOpen(boolean fullOpen)
Sets whether to fully open a file when performing a query.
|
void |
setHoldInputLocators(boolean hold)
Sets the "hold input locators" property |
void |
setHoldStatements(boolean hold)
Sets the "hold statements" property |
void |
setIgnoreWarnings(String ignoreWarnings)
Sets the ignore warnings property. |
void |
setKeepAlive(boolean keepAlive)
Turns on the socket 'keepAlive' property. |
void |
setLazyClose(boolean lazyClose)
Sets whether to delay closing cursors until subsequent requests. |
void |
setLibraries(String libraries)
Sets the libraries to add to the server job's library list.
|
void |
setLobThreshold(int threshold)
Sets the maximum LOB (large object) size in bytes that
can be retrieved as part of a result set. |
void |
setLoginTimeout(int timeout)
Sets the maximum time in seconds that this data source can wait while attempting to connect to a database.
|
void |
setLogWriter(PrintWriter writer)
Sets the log writer for this data source.
|
void |
setMaximumPrecision(int precision)
Sets the maximum precision property. |
void |
setMaximumScale(int scale)
Sets the maximum scale property. |
void |
setMetadataSource(int mds)
Sets how to retrieve DatabaseMetaData.
|
void |
setMetaDataSource(int mds)
Sets how to retrieve DatabaseMetaData.
|
void |
setMinimumDivideScale(int scale)
Sets the minimum divide scale property. |
void |
setNaming(String naming)
Sets the naming convention used when referring to tables. |
void |
setPackage(String packageName)
Sets the base name of the SQL package. |
void |
setPackageAdd(boolean add)
Sets whether to add newly prepared statements to the SQL package
specified on the "package" property. |
void |
setPackageCache(boolean cache)
Sets whether to cache a subset of the SQL package information in client memory.
|
void |
setPackageCcsid(int ccsid)
Sets the package CCSID property, which indicates the
CCSID in which statements are sent to the i5/OS system and
also the CCSID of the package they are stored in.
|
void |
setPackageCCSID(int ccsid)
Sets the package CCSID property, which indicates the
CCSID in which statements are sent to the i5/OS system and
also the CCSID of the package they are stored in.
|
void |
setPackageClear(boolean clear)
Deprecated. |
void |
setPackageCriteria(String packageCriteria)
Sets the type of SQL statement to be stored in the SQL package. |
void |
setPackageError(String packageError)
Sets the action to take when SQL package errors occur. |
void |
setPackageLibrary(String packageLibrary)
Sets the library for the SQL package. |
void |
setPassword(String password)
Sets the 'password' property. |
void |
setPrefetch(boolean prefetch)
Sets whether to prefetch data upon executing a SELECT statement.
|
void |
setPrompt(boolean prompt)
Sets whether the user should be prompted if a user name or password is
needed to connect to the i5/OS system. |
void |
setProperties(Properties newProperties)
Sets the properties for this datasource. |
void |
setProperties(String propertiesString)
Sets the properties based on ";" delimited string of properties, in same
fashion as URL properties specified with
DriverManager.getConnection(urlProperties). |
void |
setProxyServer(String proxyServer)
Sets the name of the proxy server. |
void |
setQaqqinilib(String libraryName)
Sets the QAQQINI library name. |
void |
setQaqqiniLibrary(String libraryName)
Sets the QAQQINI library name. |
void |
setQueryOptimizeGoal(int goal)
Sets the "query optimize goal" property |
void |
setQueryStorageLimit(int limit)
Sets the storage limit in megabytes, that should be used for statements executing a query in a connection.
|
void |
setReceiveBufferSize(int size)
Sets the socket 'receive buffer size' option to the
specified value. |
void |
setRemarks(String remarks)
Sets the source of the text for REMARKS columns in ResultSets returned
by DatabaseMetaData methods. |
void |
setRollbackCursorHold(boolean hold)
Sets the "rollback cursor hold" property |
void |
setSavePasswordWhenSerialized(boolean savePassword)
Sets whether to save the password locally with the rest of the properties when
this data source object is serialized.
|
void |
setSecondaryUrl(String url)
Sets the secondary URL to be used for a connection on the middle-tier's
DriverManager in a multiple tier environment, if it is different than
already specified. |
void |
setSecondaryURL(String url)
Sets the secondary URL to be used for a connection on the middle-tier's
DriverManager in a multiple tier environment, if it is different than
already specified. |
void |
setSecure(boolean secure)
Sets whether a Secure Socket Layer (SSL) connection is used to communicate
with the i5/OS system. |
void |
setSendBufferSize(int size)
Sets the socket 'send buffer size' option to the
specified value. |
void |
setServerName(String serverName)
Sets the serverName property. |
void |
setServerTrace(int traceCategories)
Enables tracing of the JDBC server job.
|
void |
setServerTraceCategories(int traceCategories)
Enables tracing of the JDBC server job.
|
void |
setSoLinger(long milliseconds)
Sets the socket 'linger' property to the
specified linger time in milliseconds. |
void |
setSort(String sort)
Sets how the i5/OS system sorts records before sending them to the client. |
void |
setSortLanguage(String language)
Sets the three-character language id to use for selection of a sort sequence.
|
void |
setSortTable(String table)
Sets the library and file name of a sort sequence table stored on the
i5/OS system.
|
void |
setSortWeight(String sortWeight)
Sets how the i5/OS system treats case while sorting records. |
void |
setSoTimeout(long milliseconds)
Enables/disables socket timeout with the
specified value in milliseconds. |
void |
setTcpNoDelay(boolean noDelay)
Sets the socket 'TCP no delay' option. |
void |
setThreadUsed(boolean threadUsed)
Sets whether a thread is used. |
void |
setTimeFormat(String timeFormat)
Sets the time format used in time literals with SQL statements. |
void |
setTimeSeparator(String timeSeparator)
Sets the time separator used in time literals within SQL statements.
|
void |
setToolboxTrace(String traceCategory)
Sets the toolbox trace category, which indicates
what trace points and diagnostic messages should be logged. |
void |
setToolboxTraceCategory(String traceCategory)
Sets the toolbox trace category, which indicates
what trace points and diagnostic messages should be logged. |
void |
setTrace(boolean trace)
Sets whether trace messages should be logged. |
void |
setTransactionIsolation(String transactionIsolation)
Sets the i5/OS system's transaction isolation. |
void |
setTranslateBinary(boolean translate)
Sets whether binary data is translated. |
void |
setTranslateBoolean(boolean translate)
Sets how Boolean objects are interpreted when setting the value
for a character field/parameter using the PreparedStatement.setObject(),
CallableStatement.setObject() or ResultSet.updateObject() methods. |
void |
setTranslateHex(String parseOption)
Sets the translate hex property, which indicates how
the parser will treat hexadecimal literals. |
void |
setTrueAutocommit(boolean value)
Sets whether true auto commit support is used. |
void |
setTrueAutoCommit(boolean value)
Sets whether true auto commit support is used. |
void |
setUser(String user)
Sets the 'user' property. |
void |
setXALooselyCoupledSupport(int lcs)
Sets whether lock sharing is allowed for loosely coupled transaction branches.
|
String |
toString()
Returns the string representation of the object. |
MAX_STORAGE_LIMIT
public static final int MAX_STORAGE_LIMIT
- The maximum storage space that can be used to execute a query.
- See Also:
- Constant Field Values
SERVER_TRACE_START_DATABASE_MONITOR
public static final int SERVER_TRACE_START_DATABASE_MONITOR
- Start the database monitor on the JDBC server job.
This constant is used when setting the level of tracing for the JDBC server job.
The numeric value of this constant is 2.
- See Also:
- Constant Field Values
SERVER_TRACE_DEBUG_SERVER_JOB
public static final int SERVER_TRACE_DEBUG_SERVER_JOB
- Start debug on the JDBC server job.
This constant is used when setting the level of tracing for the JDBC server job.
The numeric value of this constant is 4.
- See Also:
- Constant Field Values
SERVER_TRACE_SAVE_SERVER_JOBLOG
public static final int SERVER_TRACE_SAVE_SERVER_JOBLOG
- Save the joblog when the JDBC server job ends.
This constant is used when setting the level of tracing for the JDBC server job.
The numeric value of this constant is 8.
- See Also:
- Constant Field Values
SERVER_TRACE_TRACE_SERVER_JOB
public static final int SERVER_TRACE_TRACE_SERVER_JOB
- Start job trace on the JDBC server job.
This constant is used when setting the level of tracing for the JDBC server job.
The numeric value of this constant is 16.
- See Also:
- Constant Field Values
SERVER_TRACE_SAVE_SQL_INFORMATION
public static final int SERVER_TRACE_SAVE_SQL_INFORMATION
- Save SQL information.
This constant is used when setting the level of tracing for the JDBC server job.
The numeric value of this constant is 32.
- See Also:
- Constant Field Values
AS400JDBCManagedDataSource
public AS400JDBCManagedDataSource()
- Constructs a default AS400JDBCManagedDataSource object.
AS400JDBCManagedDataSource
public AS400JDBCManagedDataSource(String serverName)
- Constructs an AS400JDBCManagedDataSource object to the specified serverName.
- Parameters:
serverName
- The name of the i5/OS system.
AS400JDBCManagedDataSource
public AS400JDBCManagedDataSource(String serverName,
String user,
String password)
- Constructs an AS400JDBCManagedDataSource object with the specified signon information.
- Parameters:
serverName
- The name of the i5/OS system.user
- The user id.password
- The user password.
AS400JDBCManagedDataSource
public AS400JDBCManagedDataSource(String serverName,
String user,
String password,
String keyRingName,
String keyRingPassword)
- Constructs an AS400JDBCManagedDataSource object with the specified signon information
to use for SSL communications with the i5/OS system.
- Parameters:
serverName
- The name of the system.user
- The user id.password
- The user password.keyRingName
- The key ring class name to be used for SSL communications with the system.keyRingPassword
- The password for the key ring class to be used for SSL communications with the system.
checkPoolHealth
public boolean checkPoolHealth(boolean logStatistics)
- Verifies the health of the connection pool. For example: That the connection counts are consistent with the connection list lengths, and that all the daemons are still running.
Note: This method is provided for use as a diagnostic tool only. It temporarily "freezes" the connection pool while it collects statistics and examines the pool state.
- Parameters:
logStatistics
- If true, additional information is logged.
- Returns:
- true if connection pool exists and appears healthy; false otherwise.
clone
public Object clone()
- Method to create a clone of AS400JDBCManagedDataSource. This does a shallow
copy, with the exception of JDProperties, which also gets cloned.
closePool
public void closePool()
- Shuts down the connection pool in an orderly manner. Closes all connections in the pool.
- Throws:
Throwable
- If an error occurs.
getAccess
public String getAccess()
- Returns the level of database access for the connection.
- Returns:
- The access level. Valid values include: "all" (all SQL statements allowed),
"read call" (SELECT and CALL statements allowed), and "read only" (SELECT statements only).
The default value is "all".
getBehaviorOverride
public int getBehaviorOverride()
- Returns what behaviors of the Toolbox JDBC driver have been overridden.
Multiple behaviors can be overridden in combination by adding
the constants and passing that sum on the setBehaviorOverride() method.
- Returns:
- The behaviors that have been overridden.
The return value is a combination of the following:
- 1 - Do not throw an exception if Statement.executeQuery() or
PreparedStatement.executeQuery() do not return a result set.
Instead, return null for the result set.
getBidiStringType
public int getBidiStringType()
- Returns the output string type of bidi data, as defined by the CDRA
(Character Data Representation Architecture). See
BidiStringType for more information and valid values. -1 will be returned
if the value has not been set.
getBlockCriteria
public int getBlockCriteria()
- Returns the criteria for retrieving data from the system in
blocks of records. Specifying a non-zero value for this property
will reduce the frequency of communication to the system, and
therefore increase performance.
- Returns:
- The block criteria.
Valid values include:
- 0 (no record blocking)
- 1 (block if FOR FETCH ONLY is specified)
- 2 (block if FOR UPDATE is specified) - The default value.
getBlockSize
public int getBlockSize()
- Returns the block size in kilobytes to retrieve from the i5/OS system and
cache on the client. This property has no effect unless the block criteria
property is non-zero. Larger block sizes reduce the frequency of
communication to the system, and therefore may increase performance.
- Returns:
- The block size in kilobytes.
Valid values include:
- 0
- 8
- 16
- 32 - The default value.
- 64
- 128
- 256
- 512
getConnection
public Connection getConnection()
throws SQLException
- Returns a database connection.
Note: If a dataSourceName has been specified (via setDataSourceName()
, this method will return a pooled connection. Otherwise it will return a non-pooled connection.
If pooling, the very first call to one of the getConnection() methods for this class will create and initialize the connection pool, and may have slow response. Therefore it is advisable for the application to make an initial "dummy" call to getConnection().
If the connection pool is at or near capacity, a non-pooled connection may be returned.
It is the responsibility of the caller to ultimately call Connection.close() to release the connection, even if the connection has become unusable.
- Specified by:
getConnection
in interface DataSource
- Returns:
- The connection.
- Throws:
SQLException
- If a database error occurs.- See Also:
setDataSourceName(java.lang.String)
getConnection
public Connection getConnection(String user,
String password)
throws SQLException
- Returns a database connection using the specified user and password.
Note: If a dataSourceName has been specified (via setDataSourceName()
, this method will return a pooled connection. Otherwise it will return a non-pooled connection.
If pooling, the very first call to one of the getConnection() methods for this class will create and initialize the connection pool, and may have slow response. Therefore it is advisable for the application to make an initial "dummy" call to getConnection().
If the connection pool is at or near capacity, a non-pooled connection may be returned.
It is the responsibility of the caller to ultimately call Connection.close() to release the connection, even if the connection has become unusable.
- Specified by:
getConnection
in interface DataSource
- Parameters:
user
- The database user.password
- The database password.
- Returns:
- The connection
- Throws:
SQLException
- If a database error occurs.- See Also:
setDataSourceName(java.lang.String)
getCursorSensitivity
public String getCursorSensitivity()
- Returns the value of the cursorSensitivity property. If the resultSetType is
ResultSet.TYPE_FORWARD_ONLY or ResultSet.TYPE_SCROLL_SENSITIVE, the value of this property
will control what cursor sensitivity is requested from the database. If the resultSetType
is ResultSet.TYPE_SCROLL_INSENSITIVE, this property will be ignored.
- Returns:
- The cursor sensitivity.
Valid values include:
- "asensitive"
- "insensitive"
- "sensitive"
The default is "asensitive".
This property is ignored when connecting to systems
running V5R1 and earlier versions of OS/400.
getDatabaseName
public String getDatabaseName()
- Returns the value of the databaseName property. For more information see
the documentation for the setDatabaseName() method in this class.
- Returns:
- The database name.
getDataSourceName
public String getDataSourceName()
- Returns the value of the dataSourceName property.
This property is used to name an underlying data source when connection pooling is used.
- Returns:
- The data source name.
getDateFormat
public String getDateFormat()
- Returns the date format used in date literals within SQL statements.
- Returns:
- The date format.
Valid values include:
- "mdy"
- "dmy"
- "ymd"
- "usa"
- "iso"
- "eur"
- "jis"
- "julian"
- "" (server job value) - default.
The default is based on the server job.
getDateSeparator
public String getDateSeparator()
- Returns the date separator used in date literals within SQL statements.
This property has no effect unless the "data format" property is set to:
"julian", "mdy", "dmy", or "ymd".
- Returns:
- The date separator.
Valid values include:
- "/" (slash)
- "-" (dash)
- "." (period)
- "," (comma)
- " " (space)
- "" (server job value) - default.
The default value is based on the server job.
getDecfloatRoundingMode
public String getDecfloatRoundingMode()
- Returns the decfloat rounding mode.
- Returns:
- The decfloat rounding mode.
Valid values include:
- "half even" - default
- "half up"
- "down"
- "ceiling"
- "floor"
- "half down"
- "up"
getDecimalSeparator
public String getDecimalSeparator()
- Returns the decimal separator used in numeric literals within SQL statements.
- Returns:
- The decimal separator.
Valid values include:
- "." (period)
- "," (comma)
- "" (server job value) - default.
The default value is based on the server job.
getIgnoreWarnings
public String getIgnoreWarnings()
- Returns the ignore warnings property.
Specifies a list of SQL states for which the driver should not create warning objects.
- Returns:
- The ignore warnings.
getDescription
public String getDescription()
- Returns the description of the data source.
- Returns:
- The description.
getDriver
public String getDriver()
- Returns the JDBC driver implementation.
This property has no
effect if the "secondary URL" property is set.
This property cannot be set to "native" if the
environment is not an i5/OS Java Virtual
Machine.
Valid values include:
- "toolbox" (use the IBM Toolbox for Java JDBC driver)
- "native" (use the IBM Developer Kit for Java JDBC driver)
The default value is "toolbox".
getErrors
public String getErrors()
- Returns the amount of detail for error messages originating from
the i5/OS system.
- Returns:
- The error message level.
Valid values include: "basic" and "full". The default value is "basic".
getLibraries
public String getLibraries()
- Returns the libraries to add to the server job's library list.
The libraries are delimited by commas or spaces, and
"*LIBL" may be used as a place holder for the server job's
current library list. The library list is used for resolving
unqualified stored procedure calls and finding schemas in
DatabaseMetaData catalog methods. If "*LIBL" is not specified,
the specified libraries will replace the server job's current library list.
- Returns:
- The library list.
getLobThreshold
public int getLobThreshold()
- Returns the maximum LOB (large object) size in bytes that
can be retrieved as part of a result set. LOBs that are larger
than this threshold will be retrieved in pieces using extra
communication to the i5/OS system. Larger LOB thresholds will reduce
the frequency of communication to the system, but will download
more LOB data, even if it is not used. Smaller LOB thresholds may
increase frequency of communication to the system, but will only
download LOB data as it is needed.
- Returns:
- The lob threshold. Valid range is 0-16777216.
The default value is 32768.
getLoginTimeout
public int getLoginTimeout()
- Returns the timeout value in seconds.
Note: This value is not used or supported by the Toolbox JDBC driver.
Rather, the timeout value is determined by the i5/OS system.
- Specified by:
getLoginTimeout
in interface DataSource
- Returns:
- the maximum time in seconds that this data source can wait while attempting to connect to a database.
getLogWriter
public PrintWriter getLogWriter()
throws SQLException
- Returns the log writer for this data source.
- Specified by:
getLogWriter
in interface DataSource
- Returns:
- The log writer for this data source.
- Throws:
SQLException
- If a database error occurs.
getMetaDataSource
public int getMetaDataSource()
- Indicates how to retrieve DatabaseMetaData.
If set to 0, database metadata will be retrieved through the ROI data flow.
If set to 1, database metadata will be retrieved by calling system stored procedures.
The methods that currently are available through stored procedures are:
getColumnPrivileges
- Returns:
- the metadata setting.
The default value is 1.
getMetadataSource
public int getMetadataSource()
- Indicates how to retrieve DatabaseMetaData.
If set to 0, database metadata will be retrieved through the ROI data flow.
If set to 1, database metadata will be retrieved by calling system stored procedures.
The methods that currently are available through stored procedures are:
getColumnPrivileges
- Returns:
- the metadata setting.
The default value is 1.
Note: this method is the same as getMetaDataSource() so that it corresponds to the connection property name
getNaming
public String getNaming()
- Returns the naming convention used when referring to tables.
- Returns:
- The naming convention. Valid values include: "sql" (e.g. schema.table)
and "system" (e.g. schema/table). The default value is "sql".
getPackage
public String getPackage()
- Returns the base name of the SQL package. Note that only the
first seven characters are used to generate the name of the SQL package on the i5/OS system.
This property has no effect unless
the extended dynamic property is set to true. In addition, this property
must be set if the extended dynamic property is set to true.
- Returns:
- The base name of the SQL package.
getPackageCriteria
public String getPackageCriteria()
- Returns the type of SQL statement to be stored in the SQL package. This can
be useful to improve the performance of complex join conditions. This
property has no effect unless the extended dynamic property is set to true.
- Returns:
- The type of SQL statement.
Valid values include: "default" (only store SQL statements with parameter
markers in the package) and "select" (store all SQL SELECT statements
in the package). The default value is "default".
getPackageError
public String getPackageError()
- Returns the action to take when SQL package errors occur. When an SQL package
error occurs, the driver will optionally throw an SQLException or post a
warning to the Connection, based on the value of this property. This property
has no effect unless the extended dynamic property is set to true.
- Returns:
- The action to take when SQL errors occur.
Valid values include: "exception", "warning", and "none". The default value is "warning".
getPackageLibrary
public String getPackageLibrary()
- Returns the library for the SQL package. This property has no effect unless
the extended dynamic property is set to true.
- Returns:
- The SQL package library. The default library is "QGPL".
getProxyServer
public String getProxyServer()
- Returns the name of the proxy server.
- Returns:
- The proxy server.
getQueryOptimizeGoal
public int getQueryOptimizeGoal()
- Returns the "query optimize goal" property
- Returns:
- The optimization goal
Possible values include:
- 0 = Optimize query for first block of data (*ALLIO) when extended dynamic packages are used; Optimize query for entire result set (*FIRSTIO) when packages are not used
- 1 = Optimize query for first block of data (*FIRSTIO)
- 2 = Optimize query for entire result set (*ALLIO)
getQueryStorageLimit
public int getQueryStorageLimit()
- Returns the storage limit in megabytes, that should be used for statements executing a query in a connection.
Note, this setting is ignored when running to V5R4 i5/OS or earlier
Valid values are -1 to MAX_STORAGE_LIMIT megabytes.
The default value is -1 meaning there is no limit.
getReference
public Reference getReference()
throws NamingException
- Returns the Reference object for the data source object.
This is used by JNDI when bound in a JNDI naming service.
Contains the information necessary to reconstruct the data source
object when it is later retrieved from JNDI via an object factory.
- Specified by:
getReference
in interface Referenceable
- Returns:
- A Reference object of the data source object.
- Throws:
NamingException
- If a naming error occurs in resolving the object.
getRemarks
public String getRemarks()
- Returns the source of the text for REMARKS columns in ResultSets returned
by DatabaseMetaData methods.
- Returns:
- The text source.
Valid values include: "sql" (SQL object comment) and "system" (i5/OS object description).
The default value is "system".
getSecondaryUrl
public String getSecondaryUrl()
- Returns the secondary URL.
- Returns:
- The secondary URL.
getSecondaryURL
public String getSecondaryURL()
- Returns the secondary URL.
- Returns:
- The secondary URL.
Note: this method is the same as setSecondaryUrl() so that it corresponds to the connection property name
getServerName
public String getServerName()
- Returns the value of the serverName property.
- Returns:
- The system name.
getServerTraceCategories
public int getServerTraceCategories()
- Returns the level of tracing started on the JDBC server job.
If tracing is enabled, tracing is started when
the client connects to the i5/OS system and ends when the connection
is disconnected. Tracing must be started before connecting to
the system since the client enables tracing only at connect time.
Trace data is collected in spooled files on the system. Multiple
levels of tracing can be turned on in combination by adding
the constants and passing that sum on the set method. For example,
dataSource.setServerTraceCategories(AS400JDBCManagedDataSource.SERVER_TRACE_START_DATABASE_MONITOR + AS400JDBCManagedDataSource.SERVER_TRACE_SAVE_SERVER_JOBLOG);
- Returns:
- The tracing level.
The value is a combination of the following:
- SERVER_TRACE_START_DATABASE_MONITOR - Start the database monitor on the JDBC server job.
The numeric value of this constant is 2.
- SERVER_TRACE_DEBUG_SERVER_JOB - Start debug on the JDBC server job.
The numeric value of this constant is 4.
- SERVER_TRACE_SAVE_SERVER_JOBLOG - Save the joblog when the JDBC server job ends.
The numeric value of this constant is 8.
- SERVER_TRACE_TRACE_SERVER_JOB - Start job trace on the JDBC server job.
The numeric value of this constant is 16.
- SERVER_TRACE_SAVE_SQL_INFORMATION - Save SQL information.
The numeric value of this constant is 32.
Tracing the JDBC server job will use significant amounts of system resources.
Additional processor resource is used to collect the data, and additional
storage is used to save the data. Turn on tracing only to debug
a problem as directed by IBM service.
getServerTrace
public int getServerTrace()
- Returns the level of tracing started on the JDBC server job.
If tracing is enabled, tracing is started when
the client connects to the i5/OS system and ends when the connection
is disconnected. Tracing must be started before connecting to
the system since the client enables tracing only at connect time.
Trace data is collected in spooled files on the system. Multiple
levels of tracing can be turned on in combination by adding
the constants and passing that sum on the set method. For example,
dataSource.setServerTraceCategories(AS400JDBCManagedDataSource.SERVER_TRACE_START_DATABASE_MONITOR + AS400JDBCManagedDataSource.SERVER_TRACE_SAVE_SERVER_JOBLOG);
- Returns:
- The tracing level.
The value is a combination of the following:
- SERVER_TRACE_START_DATABASE_MONITOR - Start the database monitor on the JDBC server job.
The numeric value of this constant is 2.
- SERVER_TRACE_DEBUG_SERVER_JOB - Start debug on the JDBC server job.
The numeric value of this constant is 4.
- SERVER_TRACE_SAVE_SERVER_JOBLOG - Save the joblog when the JDBC server job ends.
The numeric value of this constant is 8.
- SERVER_TRACE_TRACE_SERVER_JOB - Start job trace on the JDBC server job.
The numeric value of this constant is 16.
- SERVER_TRACE_SAVE_SQL_INFORMATION - Save SQL information.
The numeric value of this constant is 32.
Tracing the JDBC server job will use significant amounts of system resources.
Additional processor resource is used to collect the data, and additional
storage is used to save the data. Turn on tracing only to debug
a problem as directed by IBM service.
Note: this method is the same as getServerTraceCategories() so that it corresponds to the connection property name
getSort
public String getSort()
- Returns how the i5/OS system sorts records before sending them to the
client.
- Returns:
- The sort value.
Valid values include:
- "hex" (base the sort on hexadecimal values)
- "language" (base the sort on the language set in the sort language property)
- "table" (base the sort on the sort sequence table set in the sort table property)
The default value is "hex".
getSortLanguage
public String getSortLanguage()
- Returns the three-character language id to use for selection of a sort sequence.
- Returns:
- The three-character language id.
The default value is ENU.
getSortTable
public String getSortTable()
- Returns the library and file name of a sort sequence table stored on the
i5/OS system.
- Returns:
- The qualified sort table name.
getSortWeight
public String getSortWeight()
- Returns how the i5/OS system treats case while sorting records.
- Returns:
- The sort weight.
Valid values include: "shared" (upper- and lower-case characters are sorted as the
same character) and "unique" (upper- and lower-case characters are sorted as
different characters). The default value is "shared".
getTimeFormat
public String getTimeFormat()
- Returns the time format used in time literals with SQL statements.
- Returns:
- The time format.
Valid values include:
- "hms"
- "usa"
- "iso"
- "eur"
- "jis"
- "" (server job value) - default.
The default value is based on the server job.
getTimeSeparator
public String getTimeSeparator()
- Returns the time separator used in time literals within SQL
statements.
- Returns:
- The time separator.
Valid values include:
- ":" (colon)
- "." (period)
- "," (comma)
- " " (space)
- "" (server job value) - default.
The default value is based on the server job.
getTransactionIsolation
public String getTransactionIsolation()
- Returns the i5/OS system's transaction isolation.
- Returns:
- The transaction isolation level.
Valid values include:
- "none"
- "read uncommitted" - The default value.
- "read committed"
- "repeatable read"
- "serializable"
getQaqqiniLibrary
public String getQaqqiniLibrary()
- Returns the QAQQINI library name.
- Returns:
- The QAQQINI library name.
getQaqqinilib
public String getQaqqinilib()
- Returns the QAQQINI library name.
- Returns:
- The QAQQINI library name.
Note: this method is the same as getQaqqiniLibrary() so that it corresponds to the connection property name
getUser
public String getUser()
- Returns the value of the 'user' property.
- Returns:
- The user.
getXALooselyCoupledSupport
public int getXALooselyCoupledSupport()
- Returns the value of the "XA loosely couple support" property.
This indicates whether lock sharing is allowed for loosely coupled transaction branches.
- Returns:
- The "XA loosely coupled support" setting.
Possible values include:
- 0 = Locks cannot be shared
- 1 = Locks can be shared
invalidate
public void invalidate(String user,
String password)
- Invalidates all pooled connections for the specified user/password.
All current available (unallocated) connections for this user/password are closed.
As active connections with this user/password are returned to the pool, they are closed.
- Parameters:
user
- The database user.password
- The database password.
isAutoCommit
public boolean isAutoCommit()
- Returns whether auto-commit mode is the default connection mode for new connections.
- Returns:
- Auto commit.
The default value is true.
isAutocommitException
public boolean isAutocommitException()
- Returns whether commit or rollback throws SQLException when autocommit is enabled.
- Returns:
- Autocommit Exception.
The default value is false.
isBidiImplicitReordering
public boolean isBidiImplicitReordering()
- Indicates whether bidi implicit reordering is used.
- Returns:
- true if bidi implicit reordering is used; false otherwise.
The default value is true.
isBidiNumericOrdering
public boolean isBidiNumericOrdering()
- Indicates whether bidi numeric ordering round trip is used.
- Returns:
- true if bidi numeric ordering round trip is used; false otherwise.
The default value is false.
isBigDecimal
public boolean isBigDecimal()
- Indicates whether a big decimal value is returned.
- Returns:
- true if a big decimal is returned; false otherwise.
The default value is true.
isCursorHold
public boolean isCursorHold()
- Indicates whether the cursor is held.
- Returns:
- true if the cursor is held; false otherwise.
The default value is true.
isDataCompression
public boolean isDataCompression()
- Indicates whether data compression is used.
- Returns:
- true if data compression is used; false otherwise.
The default value is true.
isDataTruncation
public boolean isDataTruncation()
- Indicates whether data truncation is used.
- Returns:
- true if data truncation is used; false otherwise.
The default value is true.
isExtendedDynamic
public boolean isExtendedDynamic()
- Indicates whether extended dynamic support is used. Extended dynamic
support provides a mechanism for caching dynamic SQL statements on
the i5/OS system. The first time a particular SQL statement is prepared, it is
stored in an SQL package on the system.
If the package does not exist, it will be automatically created.
On subsequent prepares of the
same SQL statement, the system can skip a significant part of the
processing by using information stored in the SQL package.
- Returns:
- true if extended dynamic support is used; false otherwise.
The default value is not to use extended dynamic support.
isExtendedMetaData
public boolean isExtendedMetaData()
- Indicates whether the driver should request extended metadata from the
i5/OS system. If this property is set to true, the accuracy of the information
that is returned from ResultSetMetaData methods getColumnLabel(int),
isReadOnly(int), isSearchable(int), and isWriteable(int) will be increased.
In addition, the ResultSetMetaData method getSchemaName(int) will be supported with this
property set to true. However, performance will be slower with this
property on. Leave this property set to its default (false) unless you
need more specific information from those methods.
For example, without this property turned on, isSearchable(int) will
always return true even though the correct answer may be false because
the driver does not have enough information from the system to make a judgment. Setting
this property to true forces the driver to get the correct data from the system.
- Returns:
- true if extended metadata will be requested; false otherwise.
The default value is false.
isExtendedMetadata
public boolean isExtendedMetadata()
- Indicates whether the driver should request extended metadata from the
i5/OS system. If this property is set to true, the accuracy of the information
that is returned from ResultSetMetaData methods getColumnLabel(int),
isReadOnly(int), isSearchable(int), and isWriteable(int) will be increased.
In addition, the ResultSetMetaData method getSchemaName(int) will be supported with this
property set to true. However, performance will be slower with this
property on. Leave this property set to its default (false) unless you
need more specific information from those methods.
For example, without this property turned on, isSearchable(int) will
always return true even though the correct answer may be false because
the driver does not have enough information from the system to make a judgment. Setting
this property to true forces the driver to get the correct data from the i5/OS system.
- Returns:
- true if extended metadata will be requested; false otherwise.
The default value is false.
Note: this method is the same as isExtendedMetaData() so that it corresponds to the connection property name
isFullOpen
public boolean isFullOpen()
- Indicates whether the i5/OS system fully opens a file when performing a query.
By default the system optimizes opens so they perform better. In
certain cases an optimized open will fail. In some
cases a query will fail when a database performance monitor
is turned on even though the same query works with the monitor
turned off. In this case set the full open property to true.
This disables optimization on the system.
- Returns:
- true if files are fully opened; false otherwise.
The default value is false.
isHoldInputLocators
public boolean isHoldInputLocators()
- Returns the value of the "hold input locators" property
- Returns:
- true If input locators are held.
isHoldStatements
public boolean isHoldStatements()
- Returns the value of the "hold statements" property
- Returns:
- true If statements are held.
isLazyClose
public boolean isLazyClose()
- Indicates whether to delay closing cursors until subsequent requests.
- Returns:
- true to delay closing cursors until subsequent requests; false otherwise.
The default value is false.
isPackageAdd
public boolean isPackageAdd()
- Indicates whether to add newly prepared statements to the
SQL package specified on the "package" property. This property
has no effect unless the extended dynamic property is set to true;
- Returns:
- true If newly prepared statements should be added to the SQL package specified
on the "package" property; false otherwise.
The default value is true.
isPackageCache
public boolean isPackageCache()
- Indicates whether a subset of the SQL package information is cached in client memory.
Caching SQL packages locally
reduces the amount of communication to the i5/OS system for prepares and describes. This
property has no effect unless the extended dynamic property is set to true.
- Returns:
- true if caching is used; false otherwise.
The defalut value is false.
isPackageClear
public boolean isPackageClear()
- Deprecated.
- Indicates whether SQL packages are cleared when they become full. This method
has been deprecated. Package clearing and the decision for the
threshold where package clearing is needed is now handled
automatically by the database.
- Returns:
- Always false. This method is deprecated.
isPrefetch
public boolean isPrefetch()
- Indicates whether data is prefetched upon executing a SELECT statement.
This will increase performance when accessing the initial rows in the result set.
- Returns:
- If prefetch is used; false otherwise.
The default value is prefetch data.
isPrompt
public boolean isPrompt()
- Indicates whether the user is prompted if a user name or password is
needed to connect to the i5/OS system. If a connection can not be made
without prompting the user, and this property is set to false, then an
attempt to connect will fail throwing an exception.
- Returns:
- true if the user is prompted for signon information; false otherwise.
The default value is false.
isRollbackCursorHold
public boolean isRollbackCursorHold()
- Returns the value of the "rollback cursor hold" property.
- Returns:
- true if cursors are held across rollbacks; false otherwise.
isSavePasswordWhenSerialized
public boolean isSavePasswordWhenSerialized()
- Indicates whether the password is saved locally with the rest of
the properties when this data source object is serialized.
If the password is saved, it is up to the application to protect
the serialized form of the object because it contains all necessary
information to connect to the i5/OS system. The default is false. It
is a security risk to save the password with the rest of the
properties so by default the password is not saved. If the programmer
chooses to accept this risk, call setSavePasswordWhenSerialized(true)
to force the Toolbox to save the password with the other properties
when the data source object is serialized.
- Returns:
- true if the password is saved with the rest of the properties when the
data source object is serialized; false otherwise.
The default value is false.
isSecure
public boolean isSecure()
- Indicates whether a Secure Socket Layer (SSL) connection is used to communicate
with the i5/OS system. SSL connections are only available when connecting to systems
at V4R4 or later.
- Returns:
- true if Secure Socket Layer connection is used; false otherwise.
The default value is false.
isThreadUsed
public boolean isThreadUsed()
- Indicates whether a thread is used.
- Returns:
- true if a thread is used; false otherwise.
The default value is true.
isTrace
public boolean isTrace()
- Indicates whether trace messages should be logged.
- Returns:
- true if trace message are logged; false otherwise.
The default value is false.
isTranslateBinary
public boolean isTranslateBinary()
- Indicates whether binary data is translated. If this property is set
to true, then BINARY and VARBINARY fields are treated as CHAR and
VARCHAR fields.
- Returns:
- true if binary data is translated; false otherwise.
The default value is false.
isTranslateBoolean
public boolean isTranslateBoolean()
- Indicates how Boolean objects are interpreted when setting the value
for a character field/parameter using the PreparedStatement.setObject(),
CallableStatement.setObject() or ResultSet.updateObject() methods. Setting the
property to "true", would store the Boolean object in the character field as either
"true" or "false". Setting the property to "false", would store the Boolean object
in the character field as either "1" or "0".
- Returns:
- true if boolean data is translated; false otherwise.
The default value is true.
isTrueAutoCommit
public boolean isTrueAutoCommit()
- Indicates whether true auto commit support is used.
- Returns:
- true if true auto commit support is used; false otherwise.
The default value is false.
isTrueAutocommit
public boolean isTrueAutocommit()
- Indicates whether true auto commit support is used.
- Returns:
- true if true auto commit support is used; false otherwise.
The default value is false.
Note: this method is the same as isTrueAutoCommit() so that it corresponds to the connection property name
setAccess
public void setAccess(String access)
- Sets the level of database access for the connection.
- Parameters:
access
- The access level.
Valid values include:
- "all" (all SQL statements allowed)
- "read call" (SELECT and CALL statements allowed)
- "read only" (SELECT statements only)
The default value is "all".
setAutoCommit
public void setAutoCommit(boolean value)
- Sets whether auto-commit mode is the default connection mode for new connections.
- Parameters:
value
- The default value is true.
setAutocommitException
public void setAutocommitException(boolean value)
- Sets whether commit or rollback throws SQLException when autocommit is enabled.
- Parameters:
value
- The default value is false.
setTrueAutoCommit
public void setTrueAutoCommit(boolean value)
- Sets whether true auto commit support is used.
- Parameters:
value
- true if true auto commit support should be used; false otherwise.
The default value is false.
setTrueAutocommit
public void setTrueAutocommit(boolean value)
- Sets whether true auto commit support is used.
- Parameters:
value
- true if true auto commit support should be used; false otherwise.
The default value is false.
Note: this method is the same as setTrueAutoCommit() so that it corresponds to the connection property nameproperty name
setBehaviorOverride
public void setBehaviorOverride(int behaviors)
- Sets the Toolbox JDBC Driver behaviors to override. Multiple
behaviors can be changed in combination by adding
the constants and passing that sum on the this method.
- Parameters:
behaviors
- The driver behaviors to override.
Valid values include:
- 1 - Do not throw an exception if Statement.executeQuery() or
PreparedStatement.executeQuery() do not return a result set.
Instead, return null for the result set.
Carefully consider the result of overriding the default behavior of the
driver. For example, setting the value of this property to 1 means
the driver will no longer thrown an exception even though the JDBC 3.0
specification states throwing an exception is the correct behavior.
Be sure your application correctly handles the altered behavior.
setBidiStringType
public void setBidiStringType(int bidiStringType)
- Sets the output string type of bidi data, as defined by the CDRA (Character Data
Representation Architecture). See
BidiStringType for more information and valid values.
setBidiImplicitReordering
public void setBidiImplicitReordering(boolean value)
- Sets whether bidi implicit reordering is used.
- Parameters:
value
- true if implicit reordering should be used; false otherwise.
The default value is true.
setBidiNumericOrdering
public void setBidiNumericOrdering(boolean value)
- Sets whether bidi numeric ordering round trip is used.
- Parameters:
value
- true if numeric ordering round trip should be used; false otherwise.
The default value is false.
setBigDecimal
public void setBigDecimal(boolean value)
- Sets whether a big decimal value is returned.
- Parameters:
value
- true if a big decimal is returned; false otherwise.
The default value is true.
setBlockCriteria
public void setBlockCriteria(int blockCriteria)
- Sets the criteria for retrieving data from the i5/OS system in
blocks of records. Specifying a non-zero value for this property
will reduce the frequency of communication to the system, and
therefore increase performance.
- Parameters:
blockCriteria
- The block criteria.
Valid values include:
- 0 (no record blocking)
- 1 (block if FOR FETCH ONLY is specified)
- 2 (block if FOR UPDATE is specified) - The default value.
setBlockSize
public void setBlockSize(int blockSize)
- Sets the block size in kilobytes to retrieve from the i5/OS system and
cache on the client. This property has no effect unless the block criteria
property is non-zero. Larger block sizes reduce the frequency of
communication to the system, and therefore may increase performance.
- Parameters:
blockSize
- The block size in kilobytes.
Valid values include:
- 0
- 8
- 16
- 32 - The default value.
- 64
- 128
- 256
- 512
setCursorSensitivity
public void setCursorSensitivity(String cursorSensitivity)
- Sets the cursor sensitivity to be requested from the database. If the resultSetType is
ResultSet.TYPE_FORWARD_ONLY or ResultSet.TYPE_SCROLL_SENSITIVE, the value of this property
will control what cursor sensitivity is requested from the database. If the resultSetType
is ResultSet.TYPE_SCROLL_INSENSITIVE, this property will be ignored.
Valid values include:
- "asensitive"
- "insensitive"
- "sensitive"
The default is "asensitive".
This property is ignored when connecting to systems
running V5R1 and earlier versions of OS/400.
setCursorHold
public void setCursorHold(boolean cursorHold)
- Sets whether the cursor is held.
- Parameters:
cursorHold
- true if the cursor is held; false otherwise. The default value is true.
setDatabaseName
public void setDatabaseName(String databaseName)
- Sets the databaseName property.
This property is ignored when connecting to systems
running V5R1 and earlier versions of OS/400.
If a database name is specified it must exist in the relational
database directory on the i5/OS system. Use i5/OS command WRKRDBDIRE
to view the directory.
The following criteria are used to determine
which database is accessed:
- If a database name is specified, that database is used. Attempts
to connect will fail if the database does not exist.
- If special value *SYSBAS is specified, the system default database is used.
- If a database name is not specified, the database specified
in the job description for the user profile is used.
- If a database name is not specified and a database is not specified
in the job description for the user profile, the system default
database is used.
- Parameters:
databaseName
- The database name or *SYSBAS.
- Throws:
ExtendedIllegalStateException
- If the data source is already in use.
setDataCompression
public void setDataCompression(boolean compression)
- Sets whether to use data compression. The default value is true.
- Parameters:
compression
- true if data compression is used; false otherwise.
setDataSourceName
public void setDataSourceName(String dataSourceName)
- Sets the dataSourceName property.
This property can be used for connection pooling implementations.
dataSourceName is assumed to be bound (via JNDI) to an instance of
AS400JDBCManagedConnectionPoolDataSource
.
Note: The properties of the specified datasource will override all similarly-named properties of this object. For example, if the specified datasource has a "serverName" property, then that value will be used by getConnection()
, and any value set via setServerName()
will be disregarded.
Note: If a dataSourceName is not specified, the getConnection()
methods will simply return non-pooled connections.
- Parameters:
dataSourceName
- The data source name.
- Throws:
ExtendedIllegalStateException
- If the data source is already in use.
setDataTruncation
public void setDataTruncation(boolean truncation)
- Sets whether to use data truncation. The default value is true.
- Parameters:
truncation
- true if data truncation is used; false otherwise.
setDateFormat
public void setDateFormat(String dateFormat)
- Sets the date format used in date literals within SQL statements.
- Parameters:
dateFormat
- The date format.
Valid values include:
- "mdy"
- "dmy"
- "ymd"
- "usa"
- "iso"
- "eur"
- "jis"
- "julian"
- "" (server job value) - default.
The default is based on the server job.
setDateSeparator
public void setDateSeparator(String dateSeparator)
- Sets the date separator used in date literals within SQL statements.
This property has no effect unless the "data format" property is set to:
"julian", "mdy", "dmy", or "ymd".
- Parameters:
dateSeparator
- The date separator.
Valid values include:
- "/" (slash)
- "-" (dash)
- "." (period)
- "," (comma)
- " " (space)
- "" (server job value) - default.
The default value is based on the server job.
setDecfloatRoundingMode
public void setDecfloatRoundingMode(String decfloatRoundingMode)
- Sets the decfloat rounding mode.
- Parameters:
decfloatRoundingMode
- The decfloat rounding mode.
Valid values include:
- "half even" - default
- "half up"
- "down"
- "ceiling"
- "floor"
- "half down"
- "up"
setDecimalSeparator
public void setDecimalSeparator(String decimalSeparator)
- Sets the decimal separator used in numeric literals within SQL
statements.
- Parameters:
decimalSeparator
- The decimal separator.
Valid values include:
- "." (period)
- "," (comma)
- "" (server job value) - default.
The default value is based on the server job.
setIgnoreWarnings
public void setIgnoreWarnings(String ignoreWarnings)
- Sets the ignore warnings property.
- Parameters:
ignoreWarnings
- Specifies a list of SQL states for which the driver should not create warning objects.
setDescription
public void setDescription(String description)
- Sets the data source description.
- Parameters:
description
- The description.
setSort
public void setSort(String sort)
- Sets how the i5/OS system sorts records before sending them to the client.
- Parameters:
sort
- The sort value.
Valid values include:
- "hex" (base the sort on hexadecimal values)
- "language" (base the sort on the language set in the sort language property)
- "table" (base the sort on the sort sequence table set in the sort table property).
The default value is "hex".
setErrors
public void setErrors(String errors)
- Sets the amount of detail to be returned in the message for errors
occurring on the i5/OS system.
- Parameters:
errors
- The error message level.
Valid values include: "basic" and "full". The default value is "basic".
setExtendedDynamic
public void setExtendedDynamic(boolean extendedDynamic)
- Sets whether to use extended dynamic support. Extended dynamic
support provides a mechanism for caching dynamic SQL statements on
the i5/OS system. The first time a particular SQL statement is prepared, it is
stored in an SQL package on the system.
If the package does not exist, it will be automatically created.
On subsequent prepares of the
same SQL statement, the system can skip a significant part of the
processing by using information stored in the SQL package. If this
is set to "true", then a package name must be set using the "package"
property.
- Parameters:
extendedDynamic
- If extended dynamic support is used; false otherwise.
The default value is not to use extended dynamic support.
setExtendedMetaData
public void setExtendedMetaData(boolean extendedMetaData)
- Sets whether the driver should request extended metadata from the
i5/OS system. This property is ignored when connecting to systems
running V5R1 and earlier versions of OS/400.
If this property is set to true and connecting to a system running
V5R2 or later version of i5/OS, the accuracy of the information
that is returned from ResultSetMetaData methods getColumnLabel(int),
isReadOnly(int), isSearchable(int), and isWriteable(int) will be increased.
In addition, the ResultSetMetaData method getSchemaName(int) will be supported with this
property set to true. However, performance will be slower with this
property on. Leave this property set to its default (false) unless you
need more specific information from those methods.
For example, without this property turned on, isSearchable(int) will
always return true even though the correct answer may be false because
the driver does not have enough information from the system to make a judgment. Setting
this property to true forces the driver to get the correct data from the system.
- Parameters:
extendedMetaData
- True to request extended metadata from the system, false otherwise.
The default value is false.
setExtendedMetadata
public void setExtendedMetadata(boolean extendedMetaData)
- Sets whether the driver should request extended metadata from the
i5/OS system. This property is ignored when connecting to systems
running OS/400 V5R1 and earlier.
If this property is set to true and connecting to a system running
OS/400 V5R2 or i5/OS, the accuracy of the information
that is returned from ResultSetMetaData methods getColumnLabel(int),
isReadOnly(int), isSearchable(int), and isWriteable(int) will be increased.
In addition, the ResultSetMetaData method getSchemaName(int) will be supported with this
property set to true. However, performance will be slower with this
property on. Leave this property set to its default (false) unless you
need more specific information from those methods.
For example, without this property turned on, isSearchable(int) will
always return true even though the correct answer may be false because
the driver does not have enough information from the system to make a judgment. Setting
this property to true forces the driver to get the correct data from the system.
- Parameters:
extendedMetaData
- True to request extended metadata from the system, false otherwise.
The default value is false.
Note: this method is the same as setExtendedMetaData() so that it corresponds to the connection property name
setFullOpen
public void setFullOpen(boolean fullOpen)
- Sets whether to fully open a file when performing a query.
By default the i5/OS system optimizes opens so they perform better.
In most cases optimization functions correctly and improves
performance. Running a query repeatedly
when a database performance monitor is turned on may fail
because of the optimization, however.
Leave this property set to its default (false) until
you experience errors running queries with monitors
turned on. At that time set the property to true which
will disable the optimization.
- Parameters:
fullOpen
- True to fully open a file (turn off optimizations), false
to allow optimizations. The default value is false.
setHoldInputLocators
public void setHoldInputLocators(boolean hold)
- Sets the "hold input locators" property
- Parameters:
hold
- True to hold input locators. The default value is true.
setHoldStatements
public void setHoldStatements(boolean hold)
- Sets the "hold statements" property
- Parameters:
hold
- True to hold statements. The default value is false.
setLazyClose
public void setLazyClose(boolean lazyClose)
- Sets whether to delay closing cursors until subsequent requests.
- Parameters:
lazyClose
- true to delay closing cursors until subsequent requests; false otherwise.
The default value is false.
setLibraries
public void setLibraries(String libraries)
- Sets the libraries to add to the server job's library list.
The libraries are delimited by commas or spaces, and
"*LIBL" may be used as a place holder for the server job's
current library list. The library list is used for resolving
unqualified stored procedure calls and finding schemas in
DatabaseMetaData catalog methods. If "*LIBL" is not specified,
the specified libraries will replace the server job's
current library list.
- Parameters:
libraries
- The library list.
setLobThreshold
public void setLobThreshold(int threshold)
- Sets the maximum LOB (large object) size in bytes that
can be retrieved as part of a result set. LOBs that are larger
than this threshold will be retrieved in pieces using extra
communication to the i5/OS system. Larger LOB thresholds will reduce
the frequency of communication to the system, but will download
more LOB data, even if it is not used. Smaller LOB thresholds may
increase frequency of communication to the system, but will only
download LOB data as it is needed.
- Parameters:
threshold
- The lob threshold. Valid range is 0-16777216.
The default value is 32768.
setLoginTimeout
public void setLoginTimeout(int timeout)
throws SQLException
- Sets the maximum time in seconds that this data source can wait while attempting to connect to a database.
A value of zero specifies that the timeout is the system default if one exists; otherwise it specifies that
there is no timeout. The default value is initially zero.
Note: This value is not used or supported by the Toolbox JDBC driver.
Rather, the timeout value is determined by the i5/OS system.
- Specified by:
setLoginTimeout
in interface DataSource
- Parameters:
timeout
- The login timeout in seconds.
- Throws:
SQLException
setLogWriter
public void setLogWriter(PrintWriter writer)
throws SQLException
- Sets the log writer for this data source.
Note: The specified PrintWriter might not be retained when an object is obtained via JNDI, that is, by a call to javax.naming.Context.lookup(). Therefore, use this method only on the DataSource object that is used directly by your application (rather than on the "template" DataSource object that was bound in JNDI).
- Specified by:
setLogWriter
in interface DataSource
- Parameters:
writer
- The log writer; to disable, set to null.
- Throws:
SQLException
- If a database error occurs.
setMetaDataSource
public void setMetaDataSource(int mds)
- Sets how to retrieve DatabaseMetaData.
If set to 0, database metadata will be retrieved through the ROI data flow.
If set to 1, database metadata will be retrieved by calling system stored procedures.
The methods that currently are available through stored procedures are:
getColumnPrivileges
- Parameters:
mds
- The setting for metadata source
The default value is 1.
setMetadataSource
public void setMetadataSource(int mds)
- Sets how to retrieve DatabaseMetaData.
If set to 0, database metadata will be retrieved through the ROI data flow.
If set to 1, database metadata will be retrieved by calling system stored procedures.
The methods that currently are available through stored procedures are:
getColumnPrivileges
- Parameters:
mds
- The setting for metadata source
The default value is 1.
Note: this method is the same as setMetaDataSource() so that it corresponds to the connection property name
setNaming
public void setNaming(String naming)
- Sets the naming convention used when referring to tables.
- Parameters:
naming
- The naming convention. Valid values include: "sql" (e.g. schema.table)
and "system" (e.g. schema/table). The default value is "sql".
setPackage
public void setPackage(String packageName)
- Sets the base name of the SQL package. Note that only the
first seven characters are used to generate the name of the SQL package on the i5/OS system.
This property has no effect unless
the extended dynamic property is set to true. In addition, this property
must be set if the extended dynamic property is set to true.
- Parameters:
packageName
- The base name of the SQL package.
setPackageAdd
public void setPackageAdd(boolean add)
- Sets whether to add newly prepared statements to the SQL package
specified on the "package" property. This property
has no effect unless the extended dynamic property is set to true.
- Parameters:
add
- True if newly prepared statements should be added to the SQL package specified on
the "package" property; false otherwise.
The default value is true.
setPackageCache
public void setPackageCache(boolean cache)
- Sets whether to cache a subset of the SQL package information in client memory.
Caching SQL packages locally
reduces the amount of communication to the i5/OS system for prepares and describes. This
property has no effect unless the extended dynamic property is set to true.
- Parameters:
cache
- True if caching is used; false otherwise. The default value is false.
setPackageClear
public void setPackageClear(boolean clear)
- Deprecated.
- Sets whether to clear SQL packages when they become full. This method
has been deprecated. Package clearing and the decision for the
threshold where package clearing is needed is now handled
automatically by the database.
- Parameters:
clear
- If the SQL package are cleared when full; false otherwise.
setPackageCriteria
public void setPackageCriteria(String packageCriteria)
- Sets the type of SQL statement to be stored in the SQL package. This can
be useful to improve the performance of complex join conditions. This
property has no effect unless the extended dynamic property is set to true.
- Parameters:
packageCriteria
- The type of SQL statement.
Valid values include: "default" (only store SQL statements with parameter
markers in the package), and "select" (store all SQL SELECT statements
in the package). The default value is "default".
setPackageError
public void setPackageError(String packageError)
- Sets the action to take when SQL package errors occur. When an SQL package
error occurs, the driver will optionally throw an SQLException or post a
warning to the Connection, based on the value of this property. This property
has no effect unless the extended dynamic property is set to true.
- Parameters:
packageError
- The action when SQL errors occur.
Valid values include: "exception", "warning", and "none". The default value is "warning".
setPackageLibrary
public void setPackageLibrary(String packageLibrary)
- Sets the library for the SQL package. This property has no effect unless
the extended dynamic property is set to true.
- Parameters:
packageLibrary
- The SQL package library. The default library is "QGPL".
setPassword
public void setPassword(String password)
- Sets the 'password' property.
- Parameters:
password
- The password.
setPrefetch
public void setPrefetch(boolean prefetch)
- Sets whether to prefetch data upon executing a SELECT statement.
This will increase performance when accessing the initial rows in the result set.
- Parameters:
prefetch
- If prefetch is used; false otherwise.
The default value is to prefectch data.
setPrompt
public void setPrompt(boolean prompt)
- Sets whether the user should be prompted if a user name or password is
needed to connect to the i5/OS system. If a connection can not be made
without prompting the user, and this property is set to false, then an
attempt to connect will fail.
- Parameters:
prompt
- true if the user is prompted for signon information; false otherwise.
The default value is false.
setProperties
public void setProperties(String propertiesString)
- Sets the properties based on ";" delimited string of properties, in same
fashion as URL properties specified with
DriverManager.getConnection(urlProperties). This method simply parses
property string and then calls setPropertes(Properties). This method is
intended as an enhancement so that the user does not have to write new
code to call the setters for new/deleted properties.
- Parameters:
propertiesString
- list of ";" delimited properties
setProperties
public void setProperties(Properties newProperties)
- Sets the properties for this datasource. This method is intended as an
enhancement so that the user does not have to write new code to call the
setters for new/deleted properties.
- Parameters:
newProperties
- object containing updated property values
setProxyServer
public void setProxyServer(String proxyServer)
- Sets the name of the proxy server.
- Parameters:
proxyServer
- The proxy server.
setQueryOptimizeGoal
public void setQueryOptimizeGoal(int goal)
- Sets the "query optimize goal" property
- Parameters:
goal
- - the optimization goal
Valid values include:
- 0 = Optimize query for first block of data (*ALLIO) when extended dynamic packages are used; Optimize query for entire result set (*FIRSTIO) when packages are not used
- 1 = Optimize query for first block of data (*FIRSTIO)
- 2 = Optimize query for entire result set (*ALLIO)
The default value is 0.
setQueryStorageLimit
public void setQueryStorageLimit(int limit)
- Sets the storage limit in megabytes, that should be used for statements executing a query in a connection.
Note, this setting is ignored when running to V5R4 i5/OS or earlier
- Parameters:
limit
- - the storage limit (in megabytes)
Valid values are -1 to MAX_STORAGE_LIMIT megabytes.
The default value is -1 meaning there is no limit.
setRemarks
public void setRemarks(String remarks)
- Sets the source of the text for REMARKS columns in ResultSets returned
by DatabaseMetaData methods.
- Parameters:
remarks
- The text source.
Valid values include: "sql" (SQL object comment) and "system" (i5/OS object description).
The default value is "system".
setRollbackCursorHold
public void setRollbackCursorHold(boolean hold)
- Sets the "rollback cursor hold" property
- Parameters:
hold
- True to hold cursor across rollbacks. The default value is false.
setSecondaryUrl
public void setSecondaryUrl(String url)
- Sets the secondary URL to be used for a connection on the middle-tier's
DriverManager in a multiple tier environment, if it is different than
already specified. This property allows you to use this driver to connect
to databases other than DB2 for i5/OS. Use a backslash as an escape character
before backslashes and semicolons in the URL.
- Parameters:
url
- The secondary URL.
setSecondaryURL
public void setSecondaryURL(String url)
- Sets the secondary URL to be used for a connection on the middle-tier's
DriverManager in a multiple tier environment, if it is different than
already specified. This property allows you to use this driver to connect
to databases other than DB2 for i5/OS. Use a backslash as an escape character
before backslashes and semicolons in the URL.
- Parameters:
url
- The secondary URL.
Note: this method is the same as setSecondaryUrl() so that it corresponds to the connection property name
setSecure
public void setSecure(boolean secure)
- Sets whether a Secure Socket Layer (SSL) connection is used to communicate
with the i5/OS system. SSL connections are only available when connecting to systems
at V4R4 or later.
- Parameters:
secure
- true if Secure Socket Layer connection is used; false otherwise.
The default value is false.
- Throws:
ExtendedIllegalStateException
- If the data source was constructed with a keyring and secure is false.
setServerName
public void setServerName(String serverName)
- Sets the serverName property.
- Parameters:
serverName
- The system name.
- Throws:
ExtendedIllegalStateException
- If the data source is already in use.
setServerTraceCategories
public void setServerTraceCategories(int traceCategories)
- Enables tracing of the JDBC server job.
If tracing is enabled, tracing is started when
the client connects to the i5/OS system, and ends when the connection
is disconnected. Tracing must be started before connecting to
the system since the client enables tracing only at connect time.
Trace data is collected in spooled files on the system. Multiple
levels of tracing can be turned on in combination by adding
the constants and passing that sum on the set method. For example,
dataSource.setServerTraceCategories(AS400JDBCManagedDataSource.SERVER_TRACE_START_DATABASE_MONITOR + AS400JDBCManagedDataSource.SERVER_TRACE_SAVE_SERVER_JOBLOG);
- Parameters:
traceCategories
- level of tracing to start.
Valid values include:
- SERVER_TRACE_START_DATABASE_MONITOR - Start the database monitor on the JDBC server job.
The numeric value of this constant is 2.
- SERVER_TRACE_DEBUG_SERVER_JOB - Start debug on the JDBC server job.
The numeric value of this constant is 4.
- SERVER_TRACE_SAVE_SERVER_JOBLOG - Save the joblog when the JDBC server job ends.
The numeric value of this constant is 8.
- SERVER_TRACE_TRACE_SERVER_JOB - Start job trace on the JDBC server job.
The numeric value of this constant is 16.
- SERVER_TRACE_SAVE_SQL_INFORMATION - Save SQL information.
The numeric value of this constant is 32.
Tracing the JDBC server job will use significant amounts of system resources.
Additional processor resource is used to collect the data, and additional
storage is used to save the data. Turn on tracing only to debug
a problem as directed by IBM service.
setServerTrace
public void setServerTrace(int traceCategories)
- Enables tracing of the JDBC server job.
If tracing is enabled, tracing is started when
the client connects to the i5/OS system, and ends when the connection
is disconnected. Tracing must be started before connecting to
the system since the client enables tracing only at connect time.
Trace data is collected in spooled files on the system. Multiple
levels of tracing can be turned on in combination by adding
the constants and passing that sum on the set method. For example,
dataSource.setServerTraceCategories(AS400JDBCManagedDataSource.SERVER_TRACE_START_DATABASE_MONITOR + AS400JDBCManagedDataSource.SERVER_TRACE_SAVE_SERVER_JOBLOG);
- Parameters:
traceCategories
- level of tracing to start.
Valid values include:
- SERVER_TRACE_START_DATABASE_MONITOR - Start the database monitor on the JDBC server job.
The numeric value of this constant is 2.
- SERVER_TRACE_DEBUG_SERVER_JOB - Start debug on the JDBC server job.
The numeric value of this constant is 4.
- SERVER_TRACE_SAVE_SERVER_JOBLOG - Save the joblog when the JDBC server job ends.
The numeric value of this constant is 8.
- SERVER_TRACE_TRACE_SERVER_JOB - Start job trace on the JDBC server job.
The numeric value of this constant is 16.
- SERVER_TRACE_SAVE_SQL_INFORMATION - Save SQL information.
The numeric value of this constant is 32.
Tracing the JDBC server job will use significant amounts of system resources.
Additional processor resource is used to collect the data, and additional
storage is used to save the data. Turn on tracing only to debug
a problem as directed by IBM service.
Note: this method is the same as setServerTraceCategories() so that it corresponds to the connection property name
setDriver
public void setDriver(String driver)
- Sets the JDBC driver implementation.
This property has no
effect if the "secondary URL" property is set.
This property cannot be set to "native" if the
environment is not an i5/OS Java Virtual
Machine.
param driver The driver value.
Valid values include:
- "toolbox" (use the IBM Toolbox for Java JDBC driver)
- "native" (use the IBM Developer Kit for Java JDBC driver)
The default value is "toolbox".
setSavePasswordWhenSerialized
public void setSavePasswordWhenSerialized(boolean savePassword)
- Sets whether to save the password locally with the rest of the properties when
this data source object is serialized.
If the password is saved, it is up to the application to protect
the serialized form of the object because it contains all necessary
information to connect to the i5/OS system. The default is false. It
is a security risk to save the password with the rest of the
properties so by default the password is not saved. If the application
programmer chooses to accept this risk, set this property to true
to force the Toolbox to save the password with the other properties
when the data source object is serialized.
- Parameters:
savePassword
- true if the password is saved; false otherwise.
The default value is false
setSortLanguage
public void setSortLanguage(String language)
- Sets the three-character language id to use for selection of a sort sequence.
This property has no effect unless the sort property is set to "language".
- Parameters:
language
- The three-character language id.
The default value is ENU.
setSortTable
public void setSortTable(String table)
- Sets the library and file name of a sort sequence table stored on the
i5/OS system.
This property has no effect unless the sort property is set to "table".
The default is an empty String ("").
- Parameters:
table
- The qualified sort table name.
setSortWeight
public void setSortWeight(String sortWeight)
- Sets how the i5/OS system treats case while sorting records. This property
has no effect unless the sort property is set to "language".
- Parameters:
sortWeight
- The sort weight.
Valid values include: "shared" (upper- and lower-case characters are sorted as the
same character) and "unique" (upper- and lower-case characters are sorted as
different characters). The default value is "shared".
setThreadUsed
public void setThreadUsed(boolean threadUsed)
- Sets whether a thread is used.
- Parameters:
threadUsed
- true if a thread is used; false otherwise.
The default value is true.
setTimeFormat
public void setTimeFormat(String timeFormat)
- Sets the time format used in time literals with SQL statements.
- Parameters:
timeFormat
- The time format.
Valid values include:
- "hms"
- "usa"
- "iso"
- "eur"
- "jis"
- "" (server job value) - default.
The default value is based on the server job.
setTimeSeparator
public void setTimeSeparator(String timeSeparator)
- Sets the time separator used in time literals within SQL statements.
This property has no effect unless the time format property is set to "hms".
- Parameters:
timeSeparator
- The time separator.
Valid values include:
- ":" (colon)
- "." (period)
- "," (comma)
- " " (space)
- "" (server job value) - default.
The default value is based on the server job.
setTrace
public void setTrace(boolean trace)
- Sets whether trace messages should be logged. Trace messages are
useful for debugging programs that call JDBC. However, there is a
performance penalty associated with logging trace messages, so this
property should only be set to true for debugging. Trace messages
are logged to System.out.
- Parameters:
trace
- true if trace message are logged; false otherwise.
The default value is false.
setTransactionIsolation
public void setTransactionIsolation(String transactionIsolation)
- Sets the i5/OS system's transaction isolation.
- Parameters:
transactionIsolation
- The transaction isolation level.
Valid values include:
- "none"
- "read uncommitted" - The default value.
- "read committed"
- "repeatable read"
- "serializable"
setTranslateBinary
public void setTranslateBinary(boolean translate)
- Sets whether binary data is translated. If this property is set
to true, then BINARY and VARBINARY fields are treated as CHAR and
VARCHAR fields.
- Parameters:
translate
- true if binary data is translated; false otherwise.
The default value is false.
setTranslateBoolean
public void setTranslateBoolean(boolean translate)
- Sets how Boolean objects are interpreted when setting the value
for a character field/parameter using the PreparedStatement.setObject(),
CallableStatement.setObject() or ResultSet.updateObject() methods. Setting the
property to "true", would store the Boolean object in the character field as either
"true" or "false". Setting the property to "false", would store the Boolean object
in the character field as either "1" or "0".
- Parameters:
translate
- if boolean data is translated; false otherwise.
The default value is true.
setUser
public void setUser(String user)
- Sets the 'user' property.
- Parameters:
user
- The user.
- Throws:
ExtendedIllegalStateException
- If the data source is already in use.
setXALooselyCoupledSupport
public void setXALooselyCoupledSupport(int lcs)
- Sets whether lock sharing is allowed for loosely coupled transaction branches.
Note, this setting is ignored when running to V5R3 i5/OS or earlier.
- Parameters:
lcs
- - the "XA loosely coupled support" setting
Valid values include:
- 0 = Locks cannot be shared
- 1 = Locks can be shared
The default value is 0.
isKeepAlive
public boolean isKeepAlive()
- Gets the socket 'keepalive' option.
- Returns:
- The value of the keepalive option.
getReceiveBufferSize
public int getReceiveBufferSize()
- Gets the socket 'receive buffer size' option. NOTE: This does not get
the actual receive buffer size, only the option which is used as a hint
by the underlying socket code.
- Returns:
- The value of the receive buffer size option.
getSendBufferSize
public int getSendBufferSize()
- Gets the socket 'send buffer size' option. NOTE: This does not get
the actual send buffer size, only the option which is used as a hint
by the underlying socket code.
- Returns:
- The value of the send buffer size option.
getSoLinger
public long getSoLinger()
- Gets the socket 'linger' option, in milliseconds.
- Returns:
- The value of the linger option.
getSoTimeout
public long getSoTimeout()
- Gets the socket 'timeout' option in milliseconds.
- Returns:
- The value of the timeout option.
isTcpNoDelay
public boolean isTcpNoDelay()
- Gets the socket 'TCP no delay' option.
- Returns:
- The value of the TCP no delay option.
setKeepAlive
public void setKeepAlive(boolean keepAlive)
- Turns on the socket 'keepAlive' property.
- Parameters:
keepAlive
- The keepalive option value.
setReceiveBufferSize
public void setReceiveBufferSize(int size)
- Sets the socket 'receive buffer size' option to the
specified value. The receive buffer size option is used as a hint
for the size to set the underlying network I/O buffers. Increasing
the receive buffer size can increase the performance of network
I/O for high-volume connection, while decreasing it can help reduce
the backlog of incoming data. This value must be greater than 0.
- Parameters:
size
- The receive buffer size option value.
setSendBufferSize
public void setSendBufferSize(int size)
- Sets the socket 'send buffer size' option to the
specified value. The send buffer size option is used by the
platform's networking code as a hint for the size to set the
underlying network I/O buffers. This value must be greater
than 0.
- Parameters:
size
- The send buffer size option value.
setSoLinger
public void setSoLinger(long milliseconds)
- Sets the socket 'linger' property to the
specified linger time in milliseconds. The maximum value for this
property is platform specific.
- Parameters:
milliseconds
- The linger option value.
setSoTimeout
public void setSoTimeout(long milliseconds)
- Enables/disables socket timeout with the
specified value in milliseconds. A timeout value must be
greater than zero, a value of zero for this property indicates
infinite timeout.
- Parameters:
milliseconds
- The timeout option value.
setTcpNoDelay
public void setTcpNoDelay(boolean noDelay)
- Sets the socket 'TCP no delay' option.
- Parameters:
noDelay
- The TCP no delay option value.
getPackageCCSID
public int getPackageCCSID()
- Gets the package CCSID property, which indicates the
CCSID in which statements are sent to the i5/OS system and
also the CCSID of the package they are stored in.
Valid values: 1200 (UCS-2) and 13488 (UTF-16). Default value: 13488
- Returns:
- The value of the package CCSID property.
getPackageCcsid
public int getPackageCcsid()
- Gets the package CCSID property, which indicates the
CCSID in which statements are sent to the i5/OS system and
also the CCSID of the package they are stored in.
Valid values: 1200 (UCS-2) and 13488 (UTF-16).
Default value: 13488
- Returns:
- The value of the package CCSID property.
Note: this method is the same as getPackageCCSID() so that it corresponds to the connection property name
setPackageCCSID
public void setPackageCCSID(int ccsid)
- Sets the package CCSID property, which indicates the
CCSID in which statements are sent to the i5/OS system and
also the CCSID of the package they are stored in.
Valid values: 1200 (UCS-2) and 13488 (UTF-16). Default value: 13488
- Parameters:
ccsid
- The package CCSID.
setPackageCcsid
public void setPackageCcsid(int ccsid)
- Sets the package CCSID property, which indicates the
CCSID in which statements are sent to the i5/OS system and
also the CCSID of the package they are stored in.
Valid values: 1200 (UCS-2) and 13488 (UTF-16).
Default value: 13488
- Parameters:
ccsid
- The package CCSID.
Note: this method is the same as setPackageCCSID() so that it corresponds to the connection property name
getMinimumDivideScale
public int getMinimumDivideScale()
- Gets the minimum divide scale property. This property ensures the scale
of the result of decimal division is never less than its specified value.
Valid values: 0-9. 0 is default.
- Returns:
- The minimum divide scale.
getMaximumPrecision
public int getMaximumPrecision()
- Gets the maximum precision property. This property indicates the
maximum decimal precision the i5/OS system should use.
Valid values: 31 or 63. 31 is default.
- Returns:
- The maximum precision.
getMaximumScale
public int getMaximumScale()
- Gets the maximum scale property. This property indicates the
maximum decimal scale the i5/OS system should use.
Valid values: 0-63. 31 is default.
- Returns:
- The maximum scale.
setMinimumDivideScale
public void setMinimumDivideScale(int scale)
- Sets the minimum divide scale property. This property ensures the scale
of the result of decimal division is never less than its specified value.
Valid values: 0-9. 0 is default.
- Parameters:
scale
- The minimum divide scale.
setMaximumPrecision
public void setMaximumPrecision(int precision)
- Sets the maximum precision property. This property indicates the
maximum decimal precision the i5/OS system should use.
Valid values: 31 or 63. 31 is default.
- Parameters:
precision
- The maximum precision.
setMaximumScale
public void setMaximumScale(int scale)
- Sets the maximum scale property. This property indicates the
maximum decimal scale the i5/OS system should use.
Valid values: 0-63. 31 is default.
- Parameters:
scale
- The maximum scale.
getTranslateHex
public String getTranslateHex()
- Gets the translate hex property, which indicates how
the parser will treat hexadecimal literals.
- Returns:
- The value of the translate hex property.
Valid values include:
- "character" (Interpret hexadecimal constants as character data)
- "binary" (Interpret hexadecimal constants as binary data)
The default value is "character".
setTranslateHex
public void setTranslateHex(String parseOption)
- Sets the translate hex property, which indicates how
the parser will treat hexadecimal literals.
- Parameters:
parseOption
- The hex constant parser option.
Valid values include:
- "character" (Interpret hexadecimal constants as character data)
- "binary" (Interpret hexadecimal constants as binary data)
The default value is "character".
setQaqqiniLibrary
public void setQaqqiniLibrary(String libraryName)
- Sets the QAQQINI library name.
- Parameters:
libraryName
- The QAQQINI library name.
setQaqqinilib
public void setQaqqinilib(String libraryName)
- Sets the QAQQINI library name.
- Parameters:
libraryName
- The QAQQINI library name.
Note: this method is the same as setQaqqiniLibrary() so that it corresponds to the connection property name
getToolboxTraceCategory
public String getToolboxTraceCategory()
- Returns the toolbox trace category.
- Returns:
- The toolbox trace category.
Valid values include:
- "none" - The default value.
- "datastream"
- "diagnostic"
- "error"
- "information"
- "warning"
- "conversion"
- "proxy"
- "pcml"
- "jdbc"
- "all"
- "thread"
getToolboxTrace
public String getToolboxTrace()
- Returns the toolbox trace category.
- Returns:
- The toolbox trace category.
Valid values include:
- "none" - The default value.
- "datastream"
- "diagnostic"
- "error"
- "information"
- "warning"
- "conversion"
- "proxy"
- "pcml"
- "jdbc"
- "all"
- "thread"
Note: this method is the same as getToolboxTraceCategory() so that it corresponds to the connection property name
setToolboxTraceCategory
public void setToolboxTraceCategory(String traceCategory)
- Sets the toolbox trace category, which indicates
what trace points and diagnostic messages should be logged.
- Parameters:
traceCategory
- The category option.
Valid values include:
- "none"
- "datastream"
- "diagnostic"
- "error"
- "information"
- "warning"
- "conversion"
- "proxy"
- "pcml"
- "jdbc"
- "all"
- "thread"
The default value is "none".
setToolboxTrace
public void setToolboxTrace(String traceCategory)
- Sets the toolbox trace category, which indicates
what trace points and diagnostic messages should be logged.
- Parameters:
traceCategory
- The category option.
Valid values include:
- "none"
- "datastream"
- "diagnostic"
- "error"
- "information"
- "warning"
- "conversion"
- "proxy"
- "pcml"
- "jdbc"
- "all"
- "thread"
The default value is "none".
Note: this method is the same as setToolboxTraceCategory() so that it corresponds to the connection property name
toString
public String toString()
- Returns the string representation of the object.
- Returns:
- The string representation.