com.ibm.as400.access
Class AS400JDBCDataSource

java.lang.Object
  extended bycom.ibm.as400.access.AS400JDBCDataSource
All Implemented Interfaces:
DataSource, Referenceable, Serializable
Direct Known Subclasses:
AS400JDBCConnectionPoolDataSource, AS400JDBCXADataSource

public class AS400JDBCDataSource
extends Object
implements DataSource, Referenceable, Serializable

The AS400JDBCDataSource class represents a factory for i5/OS database connections.

The following is an example that creates an AS400JDBCDataSource object and creates a connection to the database.

// Create a data source for making the connection. AS400JDBCDataSource datasource = new AS400JDBCDataSource("myAS400"); datasource.setUser("myUser"); datasource.setPassword("MYPWD"); // Create a database connection to the server. Connection connection = datasource.getConnection();

The following example registers an AS400JDBCDataSource object with JNDI and then uses the object returned from JNDI to obtain a database connection.

// Create a data source to the i5/OS database. AS400JDBCDataSource dataSource = new AS400JDBCDataSource(); dataSource.setServerName("myAS400"); // Register the datasource with the Java Naming and Directory Interface (JNDI). Hashtable env = new Hashtable(); env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.fscontext.RefFSContextFactory"); Context context = new InitialContext(env); context.bind("jdbc/customer", dataSource); // Return an AS400JDBCDataSource object from JNDI and get a connection. AS400JDBCDataSource datasource = (AS400JDBCDataSource) context.lookup("jdbc/customer"); Connection connection = datasource.getConnection("myUser", "MYPWD");

See Also:
Serialized Form

Field Summary
static int SERVER_TRACE_DEBUG_SERVER_JOB
          Start debug on the JDBC server job.
static int SERVER_TRACE_SAVE_SERVER_JOBLOG
          Save the joblog when the JDBC server job ends.
static int SERVER_TRACE_SAVE_SQL_INFORMATION
          Save SQL information.
static int SERVER_TRACE_START_DATABASE_MONITOR
          Start the database monitor on the JDBC server job.
static int SERVER_TRACE_TRACE_SERVER_JOB
          Start job trace on the JDBC server job.
 
Constructor Summary
AS400JDBCDataSource()
          Constructs a default AS400JDBCDataSource object.
AS400JDBCDataSource(AS400 as400)
          Constructs an AS400JDBCDataSource object with the specified AS400 object
AS400JDBCDataSource(String serverName)
          Constructs an AS400JDBCDataSource object to the specified serverName.
AS400JDBCDataSource(String serverName, String user, String password)
          Constructs an AS400JDBCDataSource object with the specified signon information.
AS400JDBCDataSource(String serverName, String user, String password, String keyRingName, String keyRingPassword)
          Constructs an AS400JDBCDataSource object with the specified signon information to use for SSL communications with the server.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Adds a PropertyChangeListener.
 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 server in blocks of records.
 int getBlockSize()
          Returns the block size in kilobytes to retrieve from the server and cache on the client.
 Connection getConnection()
          Returns the database connection.
 Connection getConnection(String user, String password)
          Returns the database connection using the specified user and password.
 String getCursorSensitivity()
          Returns the value of the cursor sensitivity property.
 String getDatabaseName()
          Returns the database name property.
 String getDataSourceName()
          Returns the data source name property.
 String getDateFormat()
          Returns the server date format used in date literals within SQL statements.
 String getDateSeparator()
          Returns the server date separator used in date literals within SQL statements.
 String getDecimalSeparator()
          Returns the server 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 server.
 boolean getKeepAlive()
          Gets the socket keepalive option.
 String getLibraries()
          Returns the server libraries to add to the server job's library list.
 int getLobThreshold()
          Returns the server 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 getMinimumDivideScale()
          Gets the minimum divide scale property.
 String getNaming()
          Returns the server 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 server 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 getQaqqiniLibrary()
          Returns the QAQQINI library name.
 int getQueryOptimizeGoal()
          Returns the goal the server should use with optimization of queries.
 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.
 int getSendBufferSize()
          Gets the socket send buffer size option.
 String getServerName()
          Returns the name of the AS400 server property.
 int getServerTraceCategories()
          Returns the level of tracing started on the JDBC server job.
 int getSoLinger()
          Gets the socket linger option in seconds.
 String getSort()
          Returns how the server 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 server.
 String getSortWeight()
          Returns how the server treats case while sorting records.
 int getSoTimeout()
          Gets the socket timeout option in milliseconds.
 boolean getTcpNoDelay()
          Gets the socket TCP no delay option.
 String getTimeFormat()
          Returns the server time format used in time literals with SQL statements.
 String getTimeSeparator()
          Returns the server time separator used in time literals within SQL statements.
 String getToolboxTraceCategory()
          Returns the toolbox trace category.
 String getTransactionIsolation()
          Returns the server's transaction isolation.
 String getTranslateHex()
          Gets the translate hex property, which indicates how the parser will treat hexadecimal literals.
 String getUser()
          Returns the database user property.
 int getXALooselyCoupledSupport()
          Indicates whether lock sharing is allowed for loosely coupled transaction branches.
 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 server.
 boolean isFullOpen()
          Indicates whether the server fully opens a file when performing a query.
 boolean isHoldInputLocators()
          Indicates whether input locators are of type hold.
 boolean isHoldStatements()
          Indicates whether statements remain open until a transaction boundary when autocommit is off and they are associated with Lob locators.
 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 server.
 boolean isRollbackCursorHold()
          Indicates whether the cursor is held after a rollback.
 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 server.
 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 isTrueAutoCommit()
          Indicates whether true auto commit support is used.
 boolean isVariableFieldCompression()
          Indicates whether variable-length fields are compressed.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Removes the PropertyChangeListener.
 void setAccess(String access)
          Sets the level of database access for the connection.
 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 server in blocks of records.
 void setBlockSize(int blockSize)
          Sets the block size in kilobytes to retrieve from the server 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 database name.
 void setDataCompression(boolean compression)
          Sets whether to use data compression.
 void setDataSourceName(String dataSourceName)
          Sets the data source name.
 void setDataTruncation(boolean truncation)
          Sets whether to use data truncation.
 void setDateFormat(String dateFormat)
          Sets the server date format used in date literals within SQL statements.
 void setDateSeparator(String dateSeparator)
          Sets the server date separator used in date literals within SQL statements.
 void setDecimalSeparator(String decimalSeparator)
          Sets the server 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 server.
 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 server.
 void setFullOpen(boolean fullOpen)
          Sets whether to fully open a file when performing a query.
 void setHoldInputLocators(boolean value)
          Sets whether input locators are allocated as hold locators.
 void setHoldStatements(boolean value)
          Sets whether statements should remain open until a transaction boundary when autocommit is off and they are associated with Lob locators.
 void setKeepAlive(boolean keepAlive)
          This property allows the turning on of socket keep alive.
 void setLazyClose(boolean lazyClose)
          Sets whether to delay closing cursors until subsequent requests.
 void setLibraries(String libraries)
          Sets the server libraries to add to the server job's library list.
 void setLobThreshold(int threshold)
          Sets the server 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 setMinimumDivideScale(int scale)
          Sets the minimum divide scale property.
 void setNaming(String naming)
          Sets the server 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 server 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 database password.
 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 server.
 void setProxyServer(String proxyServer)
          Sets the name of the proxy server.
 void setQaqqiniLibrary(String libraryName)
          Sets the QAQQINI library name.
 void setQueryOptimizeGoal(int goal)
          Sets the goal the server should use with optimization of queries.
 void setReceiveBufferSize(int size)
          This property sets the receive buffer size socket 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 cursorHold)
          Sets whether the cursor is held after a rollback.
 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 setSecure(boolean secure)
          Sets whether a Secure Socket Layer (SSL) connection is used to communicate with the server.
 void setSendBufferSize(int size)
          This property sets the send buffer size socket option to the specified value.
 void setServerName(String serverName)
          Sets the iSeries server name.
 void setServerTraceCategories(int traceCategories)
          Enables tracing of the JDBC server job.
 void setSoLinger(int seconds)
          This property allows the turning on of socket linger with the specified linger time in seconds.
 void setSort(String sort)
          Sets how the server 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 server.
 void setSortWeight(String sortWeight)
          Sets how the server treats case while sorting records.
 void setSoTimeout(int milliseconds)
          This property enables/disables socket timeout with the specified value in milliseconds.
 void setTcpNoDelay(boolean noDelay)
          This property allows the turning on of the TCP no delay socket option.
 void setThreadUsed(boolean threadUsed)
          Sets whether a thread is used.
 void setTimeFormat(String timeFormat)
          Sets the server time format used in time literals with SQL statements.
 void setTimeSeparator(String timeSeparator)
          Sets the server time separator used in time literals within SQL statements.
 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 server's transaction isolation.
 void setTranslateBinary(boolean translate)
          Sets whether binary data is translated.
 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 setUser(String user)
          Sets the database user.
 void setVariableFieldCompression(boolean compress)
          Specifies whether variable-length fields should be compressed.
 void setXALooselyCoupledSupport(int lcs)
          Sets whether lock sharing is allowed for loosely coupled transaction branches.
 String toString()
          Returns the string representation of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

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
Constructor Detail

AS400JDBCDataSource

public AS400JDBCDataSource()
Constructs a default AS400JDBCDataSource object.


AS400JDBCDataSource

public AS400JDBCDataSource(String serverName)
Constructs an AS400JDBCDataSource object to the specified serverName.

Parameters:
serverName - The name of the server.

AS400JDBCDataSource

public AS400JDBCDataSource(String serverName,
                           String user,
                           String password)
Constructs an AS400JDBCDataSource object with the specified signon information.

Parameters:
serverName - The name of the server.
user - The user id.
password - The user password.

AS400JDBCDataSource

public AS400JDBCDataSource(AS400 as400)
Constructs an AS400JDBCDataSource object with the specified AS400 object

Parameters:
as400 - The AS400 object

AS400JDBCDataSource

public AS400JDBCDataSource(String serverName,
                           String user,
                           String password,
                           String keyRingName,
                           String keyRingPassword)
Constructs an AS400JDBCDataSource object with the specified signon information to use for SSL communications with the server.

Parameters:
serverName - The name of the server.
user - The user id.
password - The user password.
keyRingName - The key ring class name to be used for SSL communications with the server.
keyRingPassword - The password for the key ring class to be used for SSL communications with the server.
Method Detail

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Adds a PropertyChangeListener. The specified PropertyChangeListener's propertyChange method is called each time the value of any bound property is changed.

Parameters:
listener - The PropertyChangeListener.
See Also:
removePropertyChangeListener(java.beans.PropertyChangeListener)

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 server in blocks of records. Specifying a non-zero value for this property will reduce the frequency of communication to the server, 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 server 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 server, 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 the database connection.

Specified by:
getConnection in interface DataSource
Returns:
The connection.
Throws:
SQLException - If a database error occurs.

getConnection

public Connection getConnection(String user,
                                String password)
                         throws SQLException
Returns the database connection using the specified user and password.

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.

getCursorSensitivity

public String getCursorSensitivity()
Returns the value of the cursor sensitivity 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 OS/400 V5R1 and earlier.

getDatabaseName

public String getDatabaseName()
Returns the database name property. For more information see the documentation for the setDatabaseName() method in this class.

Returns:
The database name.

getDataSourceName

public String getDataSourceName()
Returns the data source name 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 server 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 server 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.

getDecimalSeparator

public String getDecimalSeparator()
Returns the server 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.

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 OS/400 or i5/OS Java Virtual Machine.

Valid values include:

The default value is "toolbox".


getErrors

public String getErrors()
Returns the amount of detail for error messages originating from the server.

Returns:
The error message level. Valid values include: "basic" and "full". The default value is "basic".

getLibraries

public String getLibraries()
Returns the server 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 server 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 server. Larger LOB thresholds will reduce the frequency of communication to the server, but will download more LOB data, even if it is not used. Smaller LOB thresholds may increase frequency of communication to the server, but will only download LOB data as it is needed.

Returns:
The lob threshold. Valid range is 0-16777216. The default value is 0.

getLoginTimeout

public int getLoginTimeout()
Returns the timeout value in seconds. Note: This value is not used or supported. The timeout value is determined by the server.

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.

getNaming

public String getNaming()
Returns the server 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 server. 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.

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" (OS/400 or i5/OS object description). The default value is "system".

getSecondaryUrl

public String getSecondaryUrl()
Returns the secondary URL.

Returns:
The secondary URL.

getServerName

public String getServerName()
Returns the name of the AS400 server property.

Returns:
The server 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 server and ends when the connection is disconnected. Tracing must be started before connecting to the server since the client enables server tracing only at connect time. Trace data is collected in spooled files on the server. Multiple levels of server tracing can be turned on in combination by adding the constants and passing that sum on the set method. For example,
  dataSource.setServerTraceCategories(AS400JDBCDataSource.SERVER_TRACE_START_DATABASE_MONITOR + AS400JDBCDataSource.SERVER_TRACE_SAVE_SERVER_JOBLOG);
  

Returns:
The server 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 server resources. Additional processor resource is used to collect the data, and additional storage is used to save the data. Turn on server tracing only to debug a problem as directed by IBM service.


getSort

public String getSort()
Returns how the server sorts records before sending them to the client.

Returns:
The sort value.

Valid values include:

  • "hex" (base the sort on hexadecimal values)
  • "job" (base the sort on the setting for the server job)
  • "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 "job".

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 based on the locale.

getSortTable

public String getSortTable()
Returns the library and file name of a sort sequence table stored on the server.

Returns:
The qualified sort table name.

getSortWeight

public String getSortWeight()
Returns how the server 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 server 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 server 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 server's transaction isolation.

Returns:
The transaction isolation level.

Valid values include:

  • "none"
  • "read uncommitted" - The default value.
  • "read committed"
  • "repeatable read"
  • "serializable"

getUser

public String getUser()
Returns the database user property.

Returns:
The user.

getQaqqiniLibrary

public String getQaqqiniLibrary()
Returns the QAQQINI library name.

Returns:
The QAQQINI library name.

getQueryOptimizeGoal

public int getQueryOptimizeGoal()
Returns the goal the server should use with optimization of queries.

Returns:
the goal the server should use with optimization of queries.

Valid values include:

  • 0 = Optimize query for first block of data (*FIRSTIO) when extended dynamic packages are used; Optimize query for entire result set (*ALLIO) 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.

getXALooselyCoupledSupport

public int getXALooselyCoupledSupport()
Indicates whether lock sharing is allowed for loosely coupled transaction branches.

Returns:
the lock sharing setting.

Valid values include:

  • 0 = Locks cannot be shared
  • 1 = Locks can be shared
The default value is 0.

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 true.

isVariableFieldCompression

public boolean isVariableFieldCompression()
Indicates whether variable-length fields are compressed.

Returns:
true if variable-length fields are compressed; false otherwise. The default value is true.

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 server. The first time a particular SQL statement is prepared, it is stored in an SQL package on the server. If the package does not exist, it will be automatically created. On subsequent prepares of the same SQL statement, the server 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 server. 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 server to make a judgment. Setting this property to true forces the driver to get the correct data from the server.

Returns:
true if extended metadata will be requested; false otherwise. The default value is false.

isFullOpen

public boolean isFullOpen()
Indicates whether the server fully opens a file when performing a query. By default the server 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 server.

Returns:
true if files are fully opened; false otherwise. The default value is false.

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.

isHoldInputLocators

public boolean isHoldInputLocators()
Indicates whether input locators are of type hold.

Returns:
true if input locators are of type hold; false otherwise. The default value is true.

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 server 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 server. 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()
Indicates whether the cursor is held after a rollback.

Returns:
true if the cursor is held; false otherwise. The default value is false.

isHoldStatements

public boolean isHoldStatements()
Indicates whether statements remain open until a transaction boundary when autocommit is off and they are associated with Lob locators.

Returns:
true if statements are only closed at transaction boundaries; false otherwise. The default value is false.

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 server. 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 server. SSL connections are only available when connecting to servers 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.

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Removes the PropertyChangeListener. If the PropertyChangeListener is not in the list, nothing is done.

Parameters:
listener - The PropertyChangeListener.
See Also:
addPropertyChangeListener(java.beans.PropertyChangeListener)

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".

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 true.

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 throw 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 server in blocks of records. Specifying a non-zero value for this property will reduce the frequency of communication to the server, 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 server 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 server, 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:

The default is "asensitive". This property is ignored when connecting to systems running OS/400 V5R1 and earlier.


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 database name. This property is ignored when connecting to systems running OS/400 V5R1 and earlier. If a database name is specified it must exist in the relational database directory on the server. Use CL command WRKRDBDIRE to view the directory. The following criteria are used to determine which database is accessed:
  1. If a database name is specified, that database is used. Attempts to connect will fail if the database does not exist.
  2. If special value *SYSBAS is specified, the system default database is used.
  3. If a database name is not specified, the database specified in the job description for the user profile is used.
  4. 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.

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 data source name. This property can be used for connection pooling implementations.

Parameters:
dataSourceName - The data source name.

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 server 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 server 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.

setDecimalSeparator

public void setDecimalSeparator(String decimalSeparator)
Sets the server 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.

setDescription

public void setDescription(String description)
Sets the data source description.

Parameters:
description - The description.

setSort

public void setSort(String sort)
Sets how the server sorts records before sending them to the client.

Parameters:
sort - The sort value.

Valid values include:

  • "hex" (base the sort on hexadecimal values)
  • "job" (base the sort on the setting for the server job)
  • "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 "job".

setErrors

public void setErrors(String errors)
Sets the amount of detail to be returned in the message for errors occurring on the server.

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 server. The first time a particular SQL statement is prepared, it is stored in an SQL package on the server. If the package does not exist, it will be automatically created. On subsequent prepares of the same SQL statement, the server 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 server. 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 server to make a judgment. Setting this property to true forces the driver to get the correct data from the server.

Parameters:
extendedMetaData - True to request extended metadata from the server, false otherwise. The default value is false.

setFullOpen

public void setFullOpen(boolean fullOpen)
Sets whether to fully open a file when performing a query. By default the server 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 value)
Sets whether input locators are allocated as hold locators.

Parameters:
value - true if locators should be allocated as hold locators; false otherwise. The default value is true.

setHoldStatements

public void setHoldStatements(boolean value)
Sets whether statements should remain open until a transaction boundary when autocommit is off and they are associated with Lob locators.

Parameters:
value - true if statements should remain open; false otherwise. 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 server 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 server 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 server. Larger LOB thresholds will reduce the frequency of communication to the server, but will download more LOB data, even if it is not used. Smaller LOB thresholds may increase frequency of communication to the server, but will only download LOB data as it is needed.

Parameters:
threshold - The lob threshold. Valid range is 0-16777216. The default value is 0.

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.

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.

Specified by:
setLogWriter in interface DataSource
Parameters:
writer - The log writer; to disable, set to null.
Throws:
SQLException - If a database error occurs.

setNaming

public void setNaming(String naming)
Sets the server 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 server. 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 - 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 server for prepares and describes. This property has no effect unless the extended dynamic property is set to true.

Parameters:
cache - 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 database password.

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 server. 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.

setProxyServer

public void setProxyServer(String proxyServer)
Sets the name of the proxy server.

Parameters:
proxyServer - The proxy server.

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" (OS/400 or i5/OS object description). The default value is "system".

setRollbackCursorHold

public void setRollbackCursorHold(boolean cursorHold)
Sets whether the cursor is held after a rollback.

Parameters:
cursorHold - true if the cursor is held; false otherwise. 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 an iSeries server. Use a backslash as an escape character before backslashes and semicolons in the URL.

Parameters:
url - The secondary URL.

setSecure

public void setSecure(boolean secure)
Sets whether a Secure Socket Layer (SSL) connection is used to communicate with the server. SSL connections are only available when connecting to servers at V4R4 or later.

Parameters:
secure - true if Secure Socket Layer connection is used; false otherwise. The default value is false.

setServerName

public void setServerName(String serverName)
Sets the iSeries server name.

Parameters:
serverName - The server name.

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 server, and ends when the connection is disconnected. Tracing must be started before connecting to the server since the client enables server tracing only at connect time.

Trace data is collected in spooled files on the server. Multiple levels of server tracing can be turned on in combination by adding the constants and passing that sum on the set method. For example,

  dataSource.setServerTraceCategories(AS400JDBCDataSource.SERVER_TRACE_START_DATABASE_MONITOR + AS400JDBCDataSource.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 server resources. Additional processor resource is used to collect the data, and additional storage is used to save the data. Turn on server tracing only to debug a problem as directed by IBM service.


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 OS/400 or i5/OS Java Virtual Machine. param driver The driver value.

Valid values include:

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 server. 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 based on the locale.

setSortTable

public void setSortTable(String table)
Sets the library and file name of a sort sequence table stored on the server. 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 server 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 server 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 server 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 server'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.

setUser

public void setUser(String user)
Sets the database user.

Parameters:
user - The user.

setVariableFieldCompression

public void setVariableFieldCompression(boolean compress)
Specifies whether variable-length fields should be compressed.

Parameters:
compress - true if variable-length fields should be compressed; false otherwise. The default value is true.

getKeepAlive

public boolean getKeepAlive()
Gets the socket keepalive option.

Returns:
The value of the socket 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 socket 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 socket send buffer size option.

getSoLinger

public int getSoLinger()
Gets the socket linger option in seconds.

Returns:
The value of the socket linger option.

getSoTimeout

public int getSoTimeout()
Gets the socket timeout option in milliseconds.

Returns:
The value of the socket timeout option.

getTcpNoDelay

public boolean getTcpNoDelay()
Gets the socket TCP no delay option.

Returns:
The value of the socket TCP no delay option.

setKeepAlive

public void setKeepAlive(boolean keepAlive)
This property allows the turning on of socket keep alive.

Parameters:
keepAlive - The keepalive option value.

setReceiveBufferSize

public void setReceiveBufferSize(int size)
This property sets the receive buffer size socket 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 socket receive buffer size option value.

setSendBufferSize

public void setSendBufferSize(int size)
This property sets the send buffer size socket 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 socket send buffer size option value.

setSoLinger

public void setSoLinger(int seconds)
This property allows the turning on of socket linger with the specified linger time in seconds. The maxium value for this property is platform specific.

Parameters:
seconds - The socket linger option value.

setSoTimeout

public void setSoTimeout(int milliseconds)
This property 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 socket timeout option value.

setTcpNoDelay

public void setTcpNoDelay(boolean noDelay)
This property allows the turning on of the TCP no delay socket option.

Parameters:
noDelay - The socket 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 server and also the CCSID of the package they are stored in.

Returns:
The value of the package CCSID property.

setPackageCCSID

public void setPackageCCSID(int ccsid)
Sets the package CCSID property, which indicates the CCSID in which statements are sent to the server and also the CCSID of the package they are stored in.

Parameters:
ccsid - The package CCSID.

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.

Returns:
The minimum divide scale.

getMaximumPrecision

public int getMaximumPrecision()
Gets the maximum precision property. This property indicates the maximum decimal precision the server should use.

Returns:
The maximum precision.

getMaximumScale

public int getMaximumScale()
Gets the maximum scale property. This property indicates the maximum decimal scale the server should use.

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.

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 server should use.

Parameters:
precision - The maximum precision.

setMaximumScale

public void setMaximumScale(int scale)
Sets the maximum scale property. This property indicates the maximum decimal scale the server should use.

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.

setQueryOptimizeGoal

public void setQueryOptimizeGoal(int goal)
Sets the goal the server should use with optimization of queries. This setting corresponds with the server's QAQQINI option called OPTIMIZATION_GOAL. Note, this setting is ignored when running to V5R3 i5/OS or earlier

Parameters:
goal - - the optimization goal

Valid values include:

  • 0 = Optimize query for first block of data (*FIRSTIO) when extended dynamic packages are used; Optimize query for entire result set (*ALLIO) 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.

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 "loosely coupled support" setting

Valid values include:

  • 0 = Locks cannot be shared
  • 1 = Locks can be shared
The default value is 0.

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"

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".

toString

public String toString()
Returns the string representation of the object.

Returns:
The string representation.