|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
com.ibm.as400.access.AS400JDBCDataSource
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");
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 |
public AS400JDBCDataSource()
public AS400JDBCDataSource(java.lang.String serverName)
serverName
- The name of the AS/400 server.public AS400JDBCDataSource(java.lang.String serverName, java.lang.String user, java.lang.String password)
serverName
- The name of the AS/400 server.user
- The user id.password
- The user password.public AS400JDBCDataSource(java.lang.String serverName, java.lang.String user, java.lang.String password, java.lang.String keyRingName, java.lang.String keyRingPassword)
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 |
public void addPropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- The PropertyChangeListener.removePropertyChangeListener(java.beans.PropertyChangeListener)
public java.lang.String getAccess()
public int getBidiStringType()
public int getBlockCriteria()
Valid values include:
public int getBlockSize()
Valid values include:
public java.sql.Connection getConnection() throws java.sql.SQLException
public java.sql.Connection getConnection(java.lang.String user, java.lang.String password) throws java.sql.SQLException
user
- The database user.password
- The database password.public java.lang.String getDatabaseName()
public java.lang.String getDataSourceName()
public java.lang.String getDateFormat()
Valid values include:
public java.lang.String getDateSeparator()
Valid values include:
public java.lang.String getDecimalSeparator()
Valid values include:
public java.lang.String getDescription()
public java.lang.String getDriver()
Valid values include:
public java.lang.String getErrors()
public java.lang.String getLibraries()
public int getLobThreshold()
public int getLoginTimeout()
public java.io.PrintWriter getLogWriter() throws java.sql.SQLException
public java.lang.String getNaming()
public java.lang.String getPackage()
public java.lang.String getPackageCriteria()
public java.lang.String getPackageError()
public java.lang.String getPackageLibrary()
public java.lang.String getProxyServer()
public javax.naming.Reference getReference() throws javax.naming.NamingException
public java.lang.String getRemarks()
public java.lang.String getSecondaryUrl()
public java.lang.String getServerName()
public java.lang.String getSort()
Valid values include:
public java.lang.String getSortLanguage()
public java.lang.String getSortTable()
public java.lang.String getSortWeight()
public java.lang.String getTimeFormat()
Valid values include:
public java.lang.String getTimeSeparator()
Valid values include:
public java.lang.String getTransactionIsolation()
Valid values include:
public java.lang.String getUser()
public boolean isBigDecimal()
public boolean isCursorHold()
public boolean isDataCompression()
public boolean isDataTruncation()
public boolean isExtendedDynamic()
public boolean isLazyClose()
public boolean isPackageAdd()
public boolean isPackageCache()
public boolean isPackageClear()
public boolean isPrefetch()
public boolean isPrompt()
public boolean isSecure()
public boolean isThreadUsed()
public boolean isTrace()
public boolean isTranslateBinary()
public void removePropertyChangeListener(java.beans.PropertyChangeListener listener)
listener
- The PropertyChangeListener.addPropertyChangeListener(java.beans.PropertyChangeListener)
public void setAccess(java.lang.String access)
access
- The access level.
Valid values include:
public void setBidiStringType(int bidiStringType)
public void setBigDecimal(boolean value)
value
- true if a big decimal is returned; false otherwise.
The default value is true.public void setBlockCriteria(int blockCriteria)
blockCriteria
- The block criteria.
Valid values include:
public void setBlockSize(int blockSize)
blockSize
- The block size in kilobytes.
Valid values include:
public void setCursorHold(boolean cursorHold)
cursorHold
- true if the cursor is held; false otherwise. The default value is true.public void setDatabaseName(java.lang.String databaseName)
databaseName
- The database name.public void setDataCompression(boolean compression)
compression
- true if data compression is used; false otherwise.public void setDataSourceName(java.lang.String dataSourceName)
dataSourceName
- The data source name.public void setDataTruncation(boolean truncation)
truncation
- true if data truncation is used; false otherwise.public void setDateFormat(java.lang.String dateFormat)
dateFormat
- The date format.
Valid values include:
public void setDateSeparator(java.lang.String dateSeparator)
dateSeparator
- The date separator.
Valid values include:
public void setDecimalSeparator(java.lang.String decimalSeparator)
decimalSeparator
- The decimal separator.
Valid values include:
public void setDescription(java.lang.String description)
description
- The description.public void setSort(java.lang.String sort)
sort
- The sort value.
Valid values include:
public void setErrors(java.lang.String errors)
errors
- The error message level.
Valid values include: "basic" and "full". The default value is "basic".public void setExtendedDynamic(boolean extendedDynamic)
extendedDynamic
- If extended dynamic support is used; false otherwise.
The default value is not to use extended dynamic support.public void setLazyClose(boolean lazyClose)
lazyClose
- true to delay closing cursors until subsequent requests; false otherwise.
The default value is false.public void setLibraries(java.lang.String libraries)
libraries
- The library list.public void setLobThreshold(int threshold)
threshold
- The lob threshold. Valid range is 0-16777216.
The default value is 0.public void setLoginTimeout(int timeout) throws java.sql.SQLException
timeout
- The login timeout in seconds.public void setLogWriter(java.io.PrintWriter writer) throws java.sql.SQLException
writer
- The log writer; to disable, set to null.public void setNaming(java.lang.String naming)
naming
- The naming convention. Valid values include: "sql" (e.g. schema.table)
and "system" (e.g. schema/table). The default value is "sql".public void setPackage(java.lang.String packageName)
packageName
- The base name of the SQL package.public void setPackageAdd(boolean add)
add
- If statement can be added to an existing SQL package; false otherwise.
The default value is true.public void setPackageCache(boolean cache)
cache
- If caching is used; false otherwise. The default value is false.public void setPackageClear(boolean clear)
clear
- If the SQL package are cleared when full; false otherwise.
The default value if false.public void setPackageCriteria(java.lang.String packageCriteria)
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".public void setPackageError(java.lang.String packageError)
packageError
- The action when SQL errors occur.
Valid values include: "exception", "warning", and "none". The default value is "warning".public void setPackageLibrary(java.lang.String packageLibrary)
packageLibrary
- The SQL package library. The default library is "QGPL".public void setPassword(java.lang.String password)
password
- The password.public void setPrefetch(boolean prefetch)
prefetch
- If prefetch is used; false otherwise.
The default value is to prefectch data.public void setPrompt(boolean prompt)
prompt
- true if the user is prompted for signon information; false otherwise.
The default value is false.public void setProxyServer(java.lang.String proxyServer)
proxyServer
- The proxy server.public void setRemarks(java.lang.String remarks)
remarks
- The text source.
Valid values include: "sql" (SQL object comment) and "system" (OS/400 object description).
The default value is "system".public void setSecondaryUrl(java.lang.String url)
url
- The secondary URL.public void setSecure(boolean secure)
secure
- true if Secure Socket Layer connection is used; false otherwise.
The default value is false.public void setServerName(java.lang.String serverName)
serverName
- The server name.public void setDriver(java.lang.String driver)
Valid values include:
public void setSortLanguage(java.lang.String language)
language
- The three-character language id.
The default value is based on the locale.public void setSortTable(java.lang.String table)
table
- The qualified sort table name.public void setSortWeight(java.lang.String sortWeight)
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".public void setThreadUsed(boolean threadUsed)
threadUsed
- true if a thread is used; false otherwise.
The default value is true.public void setTimeFormat(java.lang.String timeFormat)
timeFormat
- The time format.
Valid values include:
public void setTimeSeparator(java.lang.String timeSeparator)
public void setTrace(boolean trace)
trace
- true if trace message are logged; false otherwise.
The default value is false.public void setTransactionIsolation(java.lang.String transactionIsolation)
String
- transactionIsolation The transaction isolation level.
Valid values include:
public void setTranslateBinary(boolean translate)
translate
- true if binary data is translated; false otherwise.
The default value is false.public void setUser(java.lang.String user)
user
- The user.public java.lang.String toString()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |