com.ibm.as400.access
Class AS400JDBCDataSource

com.ibm.as400.access.AS400JDBCDataSource

public class AS400JDBCDataSource
implements javax.naming.Referenceable, java.io.Serializable

The AS400JDBCDataSource class represents a factory for AS/400 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 AS/400. 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 AS/400 database. AS400JDBCDataSource dataSource = new AS400JDBCDataSource(); dataSource.setServerName("myAS400"); dataSource.setDatabaseName("myAS400 Database"); // 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

Constructor Summary
AS400JDBCDataSource()
          Constructs a default AS40JDBCDataSource object.
AS400JDBCDataSource(java.lang.String serverName)
          Constructs an AS400JDBCDataSource object to the specified serverName.
AS400JDBCDataSource(java.lang.String serverName, java.lang.String user, java.lang.String password)
          Constructs an AS400JDBCDataSource object with the specified signon information.
AS400JDBCDataSource(java.lang.String serverName, java.lang.String user, java.lang.String password, java.lang.String keyRingName, java.lang.String keyRingPassword)
          Constructs an AS400JDBCDataSource object with the specified signon information to use for SSL communications with the server.
 
Method Summary
 void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
          Adds a PropertyChangeListener.
 java.lang.String getAccess()
          Returns the level of database access for the AS/400 connection.
 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 AS/400 server in blocks of records.
 int getBlockSize()
          Returns the block size in kilobytes to retrieve from the AS/400 server and cache on the client.
 java.sql.Connection getConnection()
          Returns the database connection.
 java.sql.Connection getConnection(java.lang.String user, java.lang.String password)
          Returns the database connection using the specified user and password.
 java.lang.String getDatabaseName()
          Returns the database name property.
 java.lang.String getDataSourceName()
          Returns the data source name property.
 java.lang.String getDateFormat()
          Returns the AS/400 date format used in date literals within SQL statements.
 java.lang.String getDateSeparator()
          Returns the AS/400 date separator used in date literals within SQL statements.
 java.lang.String getDecimalSeparator()
          Returns the AS/400 decimal separator used in numeric literals within SQL statements.
 java.lang.String getDescription()
          Returns the description of the data source.
 java.lang.String getDriver()
          Returns the JDBC driver implementation.
 java.lang.String getErrors()
          Returns the amount of detail for error messages originating from the AS/400 server.
 java.lang.String getLibraries()
          Returns the AS/400 libraries to add to the server job's library list.
 int getLobThreshold()
          Returns the AS/400 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.
 java.io.PrintWriter getLogWriter()
          Returns the log writer for this data source.
 java.lang.String getNaming()
          Returns the AS/400 naming convention used when referring to tables.
 java.lang.String getPackage()
          Returns the base name of the SQL package.
 java.lang.String getPackageCriteria()
          Returns the type of SQL statement to be stored in the SQL package.
 java.lang.String getPackageError()
          Returns the action to take when SQL package errors occur.
 java.lang.String getPackageLibrary()
          Returns the library for the SQL package.
 java.lang.String getProxyServer()
          Returns the name of the proxy server.
 javax.naming.Reference getReference()
          Returns the Reference object for the data source object.
 java.lang.String getRemarks()
          Returns the source of the text for REMARKS columns in ResultSets returned by DatabaseMetaData methods.
 java.lang.String getSecondaryUrl()
          Returns the secondary URL.
 java.lang.String getServerName()
          Returns the name of the AS400 server property.
 java.lang.String getSort()
          Returns how the AS/400 server sorts records before sending them to the client.
 java.lang.String getSortLanguage()
          Returns the three-character language id to use for selection of a sort sequence.
 java.lang.String getSortTable()
          Returns the library and file name of a sort sequence table stored on the AS/400 server.
 java.lang.String getSortWeight()
          Returns how the AS/400 server treats case while sorting records.
 java.lang.String getTimeFormat()
          Returns the AS/400 time format used in time literals with SQL statements.
 java.lang.String getTimeSeparator()
          Returns the AS/400 time separator used in time literals within SQL statements.
 java.lang.String getTransactionIsolation()
          Returns the AS/400 server's transaction isolation.
 java.lang.String getUser()
          Returns the database user property.
 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 isLazyClose()
          Indicates whether to delay closing cursors until subsequent requests.
 boolean isPackageAdd()
          Indicates whether to add statements to an existing SQL package.
 boolean isPackageCache()
          Indicates whether SQL packages are cached in memory.
 boolean isPackageClear()
          Indicates whether SQL packages are cleared when they become full.
 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 AS/400 server.
 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.
 void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
          Removes the PropertyChangeListener.
 void setAccess(java.lang.String access)
          Sets the level of database access for the AS/400 connection.
 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 AS/400 server in blocks of records.
 void setBlockSize(int blockSize)
          Sets the block size in kilobytes to retrieve from the AS/400 server and cache on the client.
 void setCursorHold(boolean cursorHold)
          Sets whether the cursor is held.
 void setDatabaseName(java.lang.String databaseName)
          Sets the database name.
 void setDataCompression(boolean compression)
          Sets whether to use data compression.
 void setDataSourceName(java.lang.String dataSourceName)
          Sets the data source name.
 void setDataTruncation(boolean truncation)
          Sets whether to use data truncation.
 void setDateFormat(java.lang.String dateFormat)
          Sets the AS/400 date format used in date literals within SQL statements.
 void setDateSeparator(java.lang.String dateSeparator)
          Sets the AS/400 date separator used in date literals within SQL statements.
 void setDecimalSeparator(java.lang.String decimalSeparator)
          Sets the AS/400 decimal separator used in numeric literals within SQL statements.
 void setDescription(java.lang.String description)
          Sets the data source description.
 void setDriver(java.lang.String driver)
          Sets the JDBC driver implementation.
 void setErrors(java.lang.String errors)
          Sets the amount of detail to be returned in the message for errors occurring on the AS/400 server.
 void setExtendedDynamic(boolean extendedDynamic)
          Sets whether to use extended dynamic support.
 void setLazyClose(boolean lazyClose)
          Sets whether to delay closing cursors until subsequent requests.
 void setLibraries(java.lang.String libraries)
          Sets the AS/400 libraries to add to the server job's library list.
 void setLobThreshold(int threshold)
          Sets the AS/400 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(java.io.PrintWriter writer)
          Sets the log writer for this data source.
 void setNaming(java.lang.String naming)
          Sets the AS/400 naming convention used when referring to tables.
 void setPackage(java.lang.String packageName)
          Sets the base name of the SQL package.
 void setPackageAdd(boolean add)
          Sets whether to add statements to an existing SQL package.
 void setPackageCache(boolean cache)
          Sets whether to cache SQL packages in memory.
 void setPackageClear(boolean clear)
          Sets whether to clear SQL packages when they become full.
 void setPackageCriteria(java.lang.String packageCriteria)
          Sets the type of SQL statement to be stored in the SQL package.
 void setPackageError(java.lang.String packageError)
          Sets the action to take when SQL package errors occur.
 void setPackageLibrary(java.lang.String packageLibrary)
          Sets the library for the SQL package.
 void setPassword(java.lang.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 AS/400 server.
 void setProxyServer(java.lang.String proxyServer)
          Sets the name of the proxy server.
 void setRemarks(java.lang.String remarks)
          Sets the source of the text for REMARKS columns in ResultSets returned by DatabaseMetaData methods.
 void setSecondaryUrl(java.lang.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 setServerName(java.lang.String serverName)
          Sets the AS/400 server name.
 void setSort(java.lang.String sort)
          Sets how the AS/400 server sorts records before sending them to the client.
 void setSortLanguage(java.lang.String language)
          Sets the three-character language id to use for selection of a sort sequence.
 void setSortTable(java.lang.String table)
          Sets the library and file name of a sort sequence table stored on the AS/400 server.
 void setSortWeight(java.lang.String sortWeight)
          Sets how the AS/400 server treats case while sorting records.
 void setThreadUsed(boolean threadUsed)
          Sets whether a thread is used.
 void setTimeFormat(java.lang.String timeFormat)
          Sets the AS/400 time format used in time literals with SQL statements.
 void setTimeSeparator(java.lang.String timeSeparator)
          Sets the AS/400 time separator used in time literals within SQL statements.
 void setTrace(boolean trace)
          Sets whether trace messages should be logged.
 void setTransactionIsolation(java.lang.String transactionIsolation)
          Sets the AS/400 server's transaction isolation.
 void setTranslateBinary(boolean translate)
          Sets whether binary data is translated.
 void setUser(java.lang.String user)
          Sets the database user.
 java.lang.String toString()
          Returns the string representation of the object.
 

Constructor Detail

AS400JDBCDataSource

public AS400JDBCDataSource()
Constructs a default AS40JDBCDataSource object.

AS400JDBCDataSource

public AS400JDBCDataSource(java.lang.String serverName)
Constructs an AS400JDBCDataSource object to the specified serverName.
Parameters:
serverName - The name of the AS/400 server.

AS400JDBCDataSource

public AS400JDBCDataSource(java.lang.String serverName,
                           java.lang.String user,
                           java.lang.String password)
Constructs an AS400JDBCDataSource object with the specified signon information.
Parameters:
serverName - The name of the AS/400 server.
user - The user id.
password - The user password.

AS400JDBCDataSource

public AS400JDBCDataSource(java.lang.String serverName,
                           java.lang.String user,
                           java.lang.String password,
                           java.lang.String keyRingName,
                           java.lang.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 AS/400 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(java.beans.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 java.lang.String getAccess()
Returns the level of database access for the AS/400 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".

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 AS/400 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 AS/400 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 java.sql.Connection getConnection()
                                  throws java.sql.SQLException
Returns the database connection.
Returns:
The connection.
Throws:
java.sql.SQLException - If a database error occurs.

getConnection

public java.sql.Connection getConnection(java.lang.String user,
                                         java.lang.String password)
                                  throws java.sql.SQLException
Returns the database connection using the specified user and password.
Parameters:
user - The database user.
password - The database password.
Returns:
The connection
Throws:
java.sql.SQLException - If a database error occurs.

getDatabaseName

public java.lang.String getDatabaseName()
Returns the database name property.
Returns:
The database name.

getDataSourceName

public java.lang.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 java.lang.String getDateFormat()
Returns the AS/400 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 java.lang.String getDateSeparator()
Returns the AS/400 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 java.lang.String getDecimalSeparator()
Returns the AS/400 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 java.lang.String getDescription()
Returns the description of the data source.
Returns:
The description.

getDriver

public java.lang.String getDriver()
Returns the JDBC driver implementation. The AS/400 Toolbox for Java JDBC driver can select different JDBC driver implementations based on the environment. The default is to always use the Toolbox driver but via this property the native driver can be used when appropriate. If the environment is an AS/400 Java Virtual Machine on the same AS/400 as the database to which the program is connecting, the native AS/400 Developer Kit for Java JDBC driver can be used. This property has no effect if the "secondary URL" property is set.

Valid values include:

The default value is "toolbox".

getErrors

public java.lang.String getErrors()
Returns the amount of detail for error messages originating from the AS/400 server.
Returns:
The error message level. Valid values include: "basic" and "full". The default value is "basic".

getLibraries

public java.lang.String getLibraries()
Returns the AS/400 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 AS/400 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 AS/400.
Returns:
Always returns 0.

getLogWriter

public java.io.PrintWriter getLogWriter()
                                 throws java.sql.SQLException
Returns the log writer for this data source.
Returns:
The
Throws:
java.sql.SQLException - If a database error occurs.

getNaming

public java.lang.String getNaming()
Returns the AS/400 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 java.lang.String getPackage()
Returns the base name of the SQL package. Extended dynamic support works best when this is derived from the application name. Note that only the first seven characters are significant. 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 java.lang.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 al SQL SELECT statements to be stored in the package). The default value is "default".

getPackageError

public java.lang.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 java.lang.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 java.lang.String getProxyServer()
Returns the name of the proxy server.
Returns:
The proxy server.

getReference

public javax.naming.Reference getReference()
                                    throws javax.naming.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 javax.naming.Referenceable
Returns:
A Reference object of the data source object.
Throws:
javax.naming.NamingException - If a naming error occurs in resolving the object.

getRemarks

public java.lang.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 object description). The default value is "system".

getSecondaryUrl

public java.lang.String getSecondaryUrl()
Returns the secondary URL.
Returns:
The secondary URL.

getServerName

public java.lang.String getServerName()
Returns the name of the AS400 server property.
Returns:
The server name.

getSort

public java.lang.String getSort()
Returns how the AS/400 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 java.lang.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 java.lang.String getSortTable()
Returns the library and file name of a sort sequence table stored on the AS/400 server.
Returns:
The qualified sort table name.

getSortWeight

public java.lang.String getSortWeight()
Returns how the AS/400 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 java.lang.String getTimeFormat()
Returns the AS/400 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 java.lang.String getTimeSeparator()
Returns the AS/400 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 java.lang.String getTransactionIsolation()
Returns the AS/400 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 java.lang.String getUser()
Returns the database user property.
Returns:
The user.

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 run, it is stored in an SQL package on the server. On subsequent runs 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.

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 statements to an existing SQL package. This property has no effect unless the extended dynamic property is set to true;
Returns:
true if statement can be added to an existing SQL package; false otherwise. The default value is true.

isPackageCache

public boolean isPackageCache()
Indicates whether SQL packages are cached in memory. Caching SQL packages locally reduces the amount of communication to the server in some cases. 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()
Indicates whether SQL packages are cleared when they become full. Clearing an SQL package results in removing all SQL statements that have been stored in the SQL package. This property has no effect unless the extended dynamic property is set to true.
Returns:
true if the SQL package are cleared when full; false otherwise. The default value if false.

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 AS/400 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.

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(java.beans.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(java.lang.String access)
Sets the level of database access for the AS/400 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".

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.

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 AS/400 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 AS/400 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

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(java.lang.String databaseName)
Sets the database name.
Parameters:
databaseName - The database name.

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(java.lang.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(java.lang.String dateFormat)
Sets the AS/400 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(java.lang.String dateSeparator)
Sets the AS/400 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(java.lang.String decimalSeparator)
Sets the AS/400 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(java.lang.String description)
Sets the data source description.
Parameters:
description - The description.

setSort

public void setSort(java.lang.String sort)
Sets how the AS/400 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(java.lang.String errors)
Sets the amount of detail to be returned in the message for errors occurring on the AS/400 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 run, it is stored in an SQL package on the server. On subsequent runs 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.

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(java.lang.String libraries)
Sets the AS/400 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 AS/400 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 java.sql.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.
Parameters:
timeout - The login timeout in seconds.
Throws:
java.sql.SQLException - The timeout parameter is not supported.

setLogWriter

public void setLogWriter(java.io.PrintWriter writer)
                  throws java.sql.SQLException
Sets the log writer for this data source.
Parameters:
writer - The log writer; to disable, set to null.
Throws:
java.sql.SQLException - If a database error occurs.

setNaming

public void setNaming(java.lang.String naming)
Sets the AS/400 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(java.lang.String packageName)
Sets the base name of the SQL package. Extended dynamic support works best when this is derived from the application name. Note that only the first seven characters are significant. 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 statements to an existing SQL package. This property has no effect unless the extended dynamic property is set to true.
Parameters:
add - If statement can be added to an existing SQL package; false otherwise. The default value is true.

setPackageCache

public void setPackageCache(boolean cache)
Sets whether to cache SQL packages in memory. Caching SQL packages locally reduces the amount of communication to the server in some cases. 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)
Sets whether to clear SQL packages when they become full. Clearing an SQL package results in removing all SQL statements that have been stored in the SQL package. This property has no effect unless the extended dynamic property is set to true.
Parameters:
clear - If the SQL package are cleared when full; false otherwise. The default value if false.

setPackageCriteria

public void setPackageCriteria(java.lang.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 to be stored in the package). The default value is "default".

setPackageError

public void setPackageError(java.lang.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(java.lang.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(java.lang.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 AS/400 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(java.lang.String proxyServer)
Sets the name of the proxy server.
Parameters:
proxyServer - The proxy server.

setRemarks

public void setRemarks(java.lang.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 object description). The default value is "system".

setSecondaryUrl

public void setSecondaryUrl(java.lang.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 the AS/400. 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(java.lang.String serverName)
Sets the AS/400 server name.
Parameters:
serverName - The server name.

setDriver

public void setDriver(java.lang.String driver)
Sets the JDBC driver implementation. The default is to always use the Toolbox driver but via this property the AS/400 Toolbox for Java JDBC driver can select to use the native JDBC driver based on the environment. If the environment is an AS/400 Java Virtual Machine on the same AS/400 as the database to which the program is connecting, the native AS/400 Developer Kit for Java JDBC driver can be used. This property has no effect if the "secondary URL" property is set.
Parameters:
driver - the driver. Valid values include:
  • "toolbox" (always use the AS/400 Toolbox for Java JDBC driver)
  • "native" (use the AS/400 Developer Kit for Java JDBC driver if running on the server, otherwise use the Toolbox driver)
The default value is "toolbox".

setSortLanguage

public void setSortLanguage(java.lang.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(java.lang.String table)
Sets the library and file name of a sort sequence table stored on the AS/400 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(java.lang.String sortWeight)
Sets how the AS/400 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(java.lang.String timeFormat)
Sets the AS/400 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(java.lang.String timeSeparator)
Sets the AS/400 time separator used in time literals within SQL statements. This property has no effect unless the time format property is set to "hms".

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(java.lang.String transactionIsolation)
Sets the AS/400 server's transaction isolation.
Parameters:
String - 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(java.lang.String user)
Sets the database user.
Parameters:
user - The user.

toString

public java.lang.String toString()
Returns the string representation of the object.
Returns:
The string representation.