Nonstop Database, HiRDB Version 9 UAP Development Guide

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

18.4.1 Driver interface

Organization of this subsection
(1) Overview
(2) Methods
(3) Package and class names
(4) Escape clause

(1) Overview

The Driver interface provides the following principal functions:

(2) Methods

The table below lists the methods of the Driver interface. The interface does not support methods that are not listed in the table. If an unsupported method is specified, the interface throws an SQLException.

Table 18-7 Driver interface methods

Subsection Method Function
(a) acceptsURL(String url) Checks whether the driver can connect to the specified URL.
(b) connect(String url, Properties info) Attempts database connection to the specified URL.
(c) getMajorVersion() Acquires the driver's major version.
(d) getMinorVersion() Acquires the driver's minor version.
(e) getPropertyInfo(String url, Properties info) Acquires information about the driver's valid properties.
(f) jdbcCompliant() Reports whether the driver is JDBC CompliantTM.
(a) acceptsURL(String url)

Function
This method checks whether the driver can connect to the specified URL.

Format
 
public boolean acceptsURL(String url) throws SQLException
 

Arguments
String url
URL of the database

Return value
The method returns true if the driver recognizes the specified URL; if not, the method returns false.

Exceptions
None.
(b) connect(String url, Properties info)

Function
This method attempts database connection to the specified URL.

Format
 
public Connection connect(String url, Properties info) throws SQLException
 

Arguments
String url
Specifies the URL of the connected database. For details, see 18.2.2(1) URL syntax.
Properties info
Specifies a list of property name and value pairs as the connection arguments. For details, see 18.2.2(2) User properties.

Return value
Connection object indicating connection to the URL

Functional detail
Connects to the database indicated by the URL.
This method uses the value returned by DriverManager.getLoginTimeout as the maximum wait time for communication.
If getLoginTimeout returns 0, the value specified in the PDCONNECTTIME client environment definition is used as the maximum wait time.
You can use DriverManager.setLoginTimeout to specify the wait time.

Exceptions
The JDBC driver throws an SQLException in the following cases:
  • A database access error occurs.
  • The specified connection information is invalid.
  • The return value of DriverManager.getLoginTimeout is not within the range from 0 to 300.
(c) getMajorVersion()

Function
This method acquires the driver's major version.

Format
 
public synchronized int getMajorVersion()
 

Arguments
None.

Return value
This method returns this driver's major version number.

Exceptions
None.
(d) getMinorVersion()

Function
This method acquires the driver's minor version.

Format
 
public synchronized int getMinorVersion()
 

Arguments
None.

Return value
This method returns this driver's minor version number.

Exceptions
None.
(e) getPropertyInfo(String url, Properties info)

Function
This method acquires information about this driver's valid properties.

Format
 
public synchronized DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException
 

Arguments
String url
Specifies the URL of the connected database.
Properties info
Specifies a list of property name and value pairs as the connection arguments.

Return value
This method returns the array of the DriverPropertyInfo object for specifying valid properties (if properties are not needed, this array might be empty).
The following table lists the settings for the fields of DriverPropertyInfo.

Table 18-8 Settings for fields of DriverPropertyInfo

Property name DriverPropertyInfo field
name value description required choices
user Same as the property name null "UserID" false null
password ditto "" "Password" false null
UAPNAME ditto "" "UAPNAME" false null
JDBC_IF ditto "OFF" "JDBC Interface Trace" false {"ON","OFF"}
TRC_NO ditto "500" "Trace Entry Number" false null
ENCODELANG ditto null "Encode Lang" false null
HIRDB_CURSOR ditto "FALSE" "HiRDB Cursor across commit" false null
LONGVARBINARY_ACCESS ditto "REAL" "Longvarbinary locator access" false null
HiRDB_for_Java_SQL_IN_NUM ditto "300" "SQL In Number" false null
HiRDB_for_Java_SQL_OUT_NUM ditto "300" "SQL Out Number" false null
HiRDB_for_Java_SQLWARNING_LEVEL ditto "SQLWARN" "SQL Warning Level" false null
HiRDB_for_Java_ENV_VARIABLES ditto null "HiRDB Environment Variables" false null
HiRDB_for_Java_STATEMENT_COMMIT_BEHAVIOR ditto "TRUE" "HiRDB Statement across commit" false {"TRUE","FALSE"}
HiRDB_for_Java_LONGVARBINARY_ACCESS_SIZE ditto 0 "Longvarbinary locator access size" false null
HiRDB_for_Java_MAXBINARYSIZE ditto null "Longvarbinary maximum binary size" false null
HiRDB_for_Java_LONGVARBINARY_TRUNCERROR ditto "TRUE" "Longvarbinary truncate error" false {"TRUE","FALSE"}
HiRDB_for_Java_DBID ditto null "Port number of HiRDB server or Environment variable group of HiRDB" false null
HiRDB_for_Java_DBHOST ditto null "Host name with HiRDB" false null
HiRDB_for_Java_HiRDB_INI ditto null "HiRDB.ini file " false null
HiRDB_for_Java_BATCHEXCEPTION_BEHAVIOR ditto "TRUE" "BatchUpdateException UpdateCounts that conforms to JDBC standard" false {"TRUE","FALSE"}
SQLWARNING_IGNORE ditto "FALSE" "Warning generated by the Connection object is not maintained with the Connection object" false {"TRUE","FALSE"}
XDSHOST ditto null "Host name of XDS" false null
XDSPORT ditto null "Port number of XDS" false null
XDSSRVTYPE ditto "WS" "Server type of XDS" false {"PC","WS"}
HiRDB_for_Java_STATEMENT_CLOSE_BEHAVIOR ditto "FALSE" "HiRDB Statement close behavior" false {"TRUE","FALSE"}

Functional detail
This method analyzes the information specified in the url and info argument and returns information needed for connecting to the database.
If acceptsURL(String url) is false, this method returns null.

Exceptions
None.
(f) jdbcCompliant()

Function
This method reports whether this driver is JDBC CompliantTM.

Format
 
public synchronized boolean jdbcCompliant()
 

Arguments
None.

Return value
If the driver is JDBC-compliant, this method returns true; if not, the method returns false.

Exceptions
None.

(3) Package and class names

The names of the package and class for installing this interface are as follows:

Package name: JP.co.Hitachi.soft.HiRDB.JDBC

Class name: HiRDBDriver

(4) Escape clause

The part enclosed in curly brackets ({ }) in SQL statements is called the escape clause. An escape clause consists of a keyword and parameters. The keyword is not case sensitive.

The following table lists the escape clauses.

Table 18-9 List of escape clauses

Type of escape clause Keyword
Date, time, timestamp d, t, ts
LIKE escape character escape
Outer join oj
Procedure call call
Scalar function fn
Assignment set

For details about the scalar functions that can be specified in an escape clause, see Appendix I. Scalar Functions That Can Be Specified in the Escape Clause.

Analysis of escape syntax
You can use the setEscapeProcessing method of the Statement class to specify whether analysis of the escape syntax is to be enabled. When this specification is omitted, analysis of escape syntax is enabled. Analysis of escape syntax means that the JDBC driver checks each SQL statement for an escape clause. If an SQL statement contains an escape clause, the JDBC driver converts the SQL statement so that the statement can be executed by HiRDB.