Nonstop Database, HiRDB Version 9 UAP Development Guide

[Contents][Index][Back][Next]

18.12 Migration from a Type2 JDBC driver

This section discusses migration to a Type4 JDBC driver of Java stored procedures that have been used with a Type2 JDBC driver.

If you use any of the platforms listed below, you can migrate Java stored procedures from a Type2 JDBC driver to a Type4 JDBC driver without having to change the programs:

If you use any other platform, you must change the settings as shown below when you migrate the internal driver from Type2 JDBC to Type4 JDBC.

Item requiring change Type2 JDBC driver Type4 JDBC driver
Driver name "JP.co.Hitachi.soft.HiRDB.JDBC.PrdbDriver" "JP.co.Hitachi.soft.HiRDB.JDBC.HiRDBDriver"
Protocol name, subprotocol name, and subname specified in the URL when connection is established with HiRDB jdbc:hitachi:PrdbDrive jdbc:hitachi:hirdb
Class name of DataSource class JdbhDataSource PrdbDataSource
Cursor operation mode# Specify by using one of the following methods:
  • COMMIT_BEHAVIOR in the URL that is specified when connection is established
  • COMMIT_BEHAVIOR property that is specified when connection is established
  • setCommit_Behavior method of the DataSource class
Specify by using one of the following methods:
  • Combination of HIRDB_CURSOR and STATEMENT_COMMIT_BEHAVIOR in the URL that is specified when connection is established
  • Combination of HIRDB_CURSOR and STATEMENT_COMMIT_BEHAVIOR properties that are specified when connection is established
  • Combination of setStatementCommitBehavior and setHiRDBCursorMode methods of the DataSource class
HiRDB's array update, array insertion, and array deletion facilities Supported if this function is set to be used by one of the following methods:
  • BLOCK_UPDATE property that is specified when connection is established
  • HiRDB_for_Java_BLOCK_UPDATE system property
  • setBlockUpdate method of the DataSource class
  • setBlockUpdate method of the JdbcDbpsvPreparedStatement class
Supported unconditionally.
However, the setBlockUpdate method of the JdbcDbpsvPreparedStatement class is not supported.
Maximum number of input or input-output ? parameters in the SQL statements to be executed Specify by using one of the following methods:
  • HiRDB_for_Java_SQL_IN_NUM property that is specified when connection is established
  • HiRDB_for_Java_SQL_IN_NUM system property
  • setSQLInNum method of the DataSource class
The default value is 64.
Specify by using one of the following methods:
  • HiRDB_for_Java_SQL_IN_NUM property that is specified when connection is established
  • setSQLInNum method of the DataSource class
The default value is 300.
Maximum number of output items for the SQL statement to be executed Specify by using one of the following methods:
  • HiRDB_for_Java_SQL_OUT_NUM property that is specified when connection is established
  • HiRDB_for_Java_SQL_OUT_NUM system property
  • setSQLOutNum method of the DataSource class
The default value is 64.
Specify by using one of the following methods:
  • HiRDB_for_Java_SQL_OUT_NUM property that is specified when connection is established
  • setSQLOutNum method of the DataSource class
The default value is 300.

#
Whether ResultSet and Statement objects become valid after commit execution depends on the cursor's operation mode.
The table below shows the correspondence of the cursor operation mode settings between Type2 JDBC and Type4 JDBC drivers.
Note that the default values are different between the Type2 JDBC and Type4 JDBC drivers.

ResultSet object status after commit execution Statement object status after commit execution Type2 JDBC driver Type4 JDBC driver
Invalid Invalid COMMIT_BEHAVIOR= "DELETE" (default value) HIRDB_CURSOR=FALSE (default value)
STATEMENT_COMMIT_BEHAVIOR=FALSE
Valid COMMIT_BEHAVIOR= "CLOSE" HIRDB_CURSOR=FALSE (default value)
STATEMENT_COMMIT_BEHAVIOR=TRUE (default value)
Valid Valid COMMIT_BEHAVIOR= "PRESERVE" HIRDB_CURSOR=TRUE
STATEMENT_COMMIT_BEHAVIOR=TRUE or STATEMENT_COMMIT_BEHAVIOR=FALSE

Client environment definitions in Java applications
With a Type2 JDBC driver, the PDHOST and PDNAMEPORT specifications in the OS's environment variables are effective if you omit information (such as URL) when connection is established.
A Type4 JDBC driver does not use OS environment variables, so when you migrate from a Type2 JDBC driver you must modify your UAPs so that PDHOST and PDNAMEPORT in the client environment definitions are used for URL when connection is established.