Enhancements to IBM Toolbox for Java JDBC support for IBM i 6.1
Many additions were made to JDBC support in IBM® i 6.1.
Support for JDBC 4.0
- /QIBM/ProdData/HTTP/Public/jt400/lib/java6/jt400.jar
- /QIBM/ProdData/OS400/jt400/lib/java6/jt400Native.jar
Query storage limit
You can use the query storage limit property to limit the storage used by a query. This property compares the storage limit you specify to the estimated storage usage of the query. If the estimated storage usage exceeds the specified storage limit, the query is not allowed to run.
Beginning in V6R1, the IBM Toolbox for Java JDBC driver will add the following methods to the AS400JDBCDataSource class:
public void setQueryStorageLimit(int limit);
public int getQueryStorageLimit()
Systems that run a release of IBM i prior to V6R1 will ignore the getQueryStorageLimit property.
Decimal float (DECFLOAT) data type
The decimal float (DECFLOAT) inherits favorable properties from both float and decimal data types. Data values of DECFLOAT are stored such that trailing zeros are significant: for example, 2.0 and 2.00 are different binary representations. In SQL comparisons, however, the values are treated as equal.
The IBM Toolbox for Java JDBC driver has added the following methods to the AS400JDBCDataSource class:
public void setDecfloatRoundingMode(int String mode)
public intString getDecfloatRoundingMode()
- half even (default value)
- Round to nearest digit. If equidistant between two digits, round to the nearest even digit. The numeric value of this constant is 0.
- half up
- Round to nearest digit. If equidistant between two digits, round up. The numeric value of this constant is 1.
- down
- Round to nearest lower digit. The numeric value of this constant is 2.
- ceiling
- Round towards positive infinity. The numeric value of this constant is 3.
- floor
- Round towards negative infinity. The numeric value of this constant is 4.
- half down
- Round to the nearest digit. If equidistant between two digits, round down. The numeric value of this constant is 5.
- up
- Round to nearest higher digit. The numeric value of this constant is 6.
Passing the client type and application name to the server
Web applications need a way to pass end-user-client information to the database server so that more detailed information may be logged. The IBM Toolbox for Java JDBC driver allows an application to override this information by calling the following java.sql.Connection.setClientInfo() methods:
Name | Maximum length | Default value | Description |
---|---|---|---|
ApplicationName | 255 | "" | The name of the application currently utilizing the connection. |
ClientAccounting | 255 | "" | Accounting information. |
ClientHostname | 255 | "" | The hostname of the computer the application using the connection is running on. |
ClientProgramID | 255 | "" | The client program identification. |
ClientUser | 255 | "" | The name of the user that the application using the connection is performing work for. This may not be the same as the user name that was used in establishing the connection. |
Maximum length of cursor names extended
Beginning in V6R1, the maximum length of cursors will be 128 characters. The previous maximum length was 8 characters. An application can set the name of a cursor by calling the java.sql.Statement.setCursorName() method.
Generated key support
- AS400JDBCStatement.getGeneratedKeys()
- AS400JDBCStatement.execute(String sql, int autoGeneratedKeys)
- AS400JDBCStatement.execute (String sql, int[] columnIndexes)
- AS400JDBCStatement.execute (String sql, String[] columnNames)
- AS400JDBCStatement.executeUpdate(String sql, int[] autoGeneratedKeys)
- AS400JDBCStatement.executeUpdate (String sql, int[] columnIndexes)
- AS400JDBCStatement.executeUpdate (String sql, String[] columnNames)
- AS400JDBCConnection.prepareStatement(String sql, int autoGeneratedKeys)
- AS400JDBCConnection.prepareStatement(String sql, int[] columnIndexes)
- AS400JDBCConnection.prepareStatement(String sql, String[] columnNames)
Improved default value support
Beginning in V6R1, The IBM Toolbox for Java JDBC driver will return a column's default value as a string through the DatabaseMetaData.getColumns() method. If the default value is null, a string with the value 'NULL' will be returned.
Increased maximum in GROUP BY clause
The new value for DatabaseMetaData getMaxColumnsInGroupBy( ) is 8000.
Batch update support
The improved batch update support in V6R1 will provide better information to you when you are running a multiple-row batched insert statement. There will be a field in the diagnostics area and SQLCA that will contain the count of successful statements so that you can better determine the location of any errors.
The IBM Toolbox for Java JDBC driver will use this information when creating a java.sql.BatchUpdateException. AS400JDBCStatement and AS400JDBCPreparedStatement will also use this information to return the correct information back from the executeBatch() method.