Nonstop Database, HiRDB Version 9 UAP Development Guide

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

16.5.3 HiRDBConnection

Organization of this subsection
(1) Constructor
(2) Properties
(3) Methods

(1) Constructor

(a) HiRDBConnection

void HiRDBConnection ()
Description: Initializes a new instance of HiRDBConnection.

void HiRDBConnection (string)
Argument
string ConnectionString: Character string storing the connection settings (ConnectionString property)
Description: Specifies a connection character string and initializes a new instance of the HiRDBConnection class.

(2) Properties

(a) ConnectionString

Type: string

Default value: ""

Description: Acquires or sets the character string that is used to open a database.

Exception: HiRDBException

For this property, you must specify one string-type argument. The character string to be specified is called a connection character string. This is the same type of connection character string as those used for Connection in ADO and ADO.NET. The following table lists and describes the character strings that can be specified:

Character string Description

  • datasource
  • dsn
  • env
Settings for the registry to be used. Specify the name of the environment variable group that was created using the tool for registering HiRDB client environment variables.

  • uid
  • userid
Authorization identifier used for DB connection

  • password
  • Pwd
Password to be used for the database connection

  • PD*
Settings in the client environment definition

If nothing is specified, the default setting (HiRDB.ini) is used to establish the connection. If a client environment variable group name is available, this name is used. If the authorization identifier, password, and client environment definition are specified, their use takes precedence. This character string is not case sensitive. To distinguish upper-case letters from lower-case letters, enclose the applicable part in quotation marks. All spaces and tabs are ignored (except those enclosed in quotation marks).

If the specified character string is not one of the connection character strings listed above, an exception occurs. However, for Provider, the specified invalid character string is ignored; no exception occurs. This maintains compatibility with OleDb Data Provider in the DataProvider layer.

(b) ConnectionTimeout

Type: int

Default value:
When the supported ADO.NET version is 1.1: 15
When the supported ADO.NET version is 2.0: 0

Description: Acquires the wait time for establishing a connection before retries are cancelled and an error is generated (read only).
(c) Database

Type: string

Default value: ""

Description: Acquires the name of the current database or the database that is used when a connection is established (read only).
(d) DataSource

Type: string

Default value: ""

Description: Acquires the name of the connected database server (read only).
(e) ServerVersion

Type: string

Default value: ""

Description: Acquires the version of the connected server (read only).
This member returns the version in the normalized format that allows comparison by using String.Compare(). The format of the version is as follows:
XX.YY.ZZZZ
XX: Major version
YY: Minor version
ZZZZ: Always 0000
(f) LifeTime

Type: int

Default value: 60

Description: Acquires or sets the time remaining before actual disconnection occurs.

Exception: HiRDBException
(g) Pooling

Type: bool

Default value: true

Description: Acquires or sets whether or not pooling is to be performed. If pooling is performed, the value is true; if not, the value is false.

Exception: HiRDBException
(h) State

Type: System.Data.ConnectionState

Default value: ConnectionState.Closed

Description: Acquires the current connection status (read only).

(3) Methods

(a) BeginTransaction

BeginTransaction ()
Return
HiRDBTransaction: Object representing a new transaction
Description: Starts the database transaction.
Exception: HiRDBException

BeginTransaction (System.Data.IsolationLevel)
Argument
System.Data.IsolationLevel: One of the IsolationLevel values
Return
HiRDBTransaction: Object representing a new transaction
Description: Starts the database transaction using the specified IsolationLevel value.
Exception: HiRDBException
(b) ChangeDatabase

void ChangeDatabase (string)

Argument
string databaseName: Name of the database to be changed

Return: void

Description: Changes the current database for the open HiRDBConnection object.

Exception: HiRDBException
(c) Clone

HiRDBConnection Clone ()

Return: Returns null unconditionally.

Description: Returns null unconditionally.
(d) Close

void Close ()

Return: void

Description: Closes the connection to the database.
(e) CreateCommand

Hitachi.HiRDB.HiRDBCommand CreateCommand ()

Return
HiRDBCommand: HiRDBCommand object

Description: Creates and returns the HiRDBCommand object associated with the connection.
(f) EnlistTransaction

void EnlistTransaction (Transaction)

Argument
transaction: Existing target Transaction object

Return: void

Description: Registers in the specified transaction.

Exception: HiRDBException
(g) GetSchema

DataTable GetSchema ()
Return: DataTable object
Description: Returns schema information.

DataTable GetSchema (string)
Argument
collectionName: Name of the schema to be returned
Return: DataTable object
Description: Returns schema information.

DataTable GetSchema (string, string[])
Argument
collectionName: Name of the schema to be returned
restrictionValues: Restriction value for the requested schema
Return: DataTable object
Description: Returns schema information.
(h) Open

void Open ()

Return: void

Description: Opens the database connection with the settings specified in the ConnectionString property of the HiRDBConnection object.

Exception: HiRDBException