Scalable Database Server, HiRDB Version 8 UAP Development Guide

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

15.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: 15

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) LifeTime

Type: int

Default value: 60

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

Exception: HiRDBException
(e) 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
(f) 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

object Clone ()

Return
object: New object which is a copy of this instance

Description: Creates a new object which is a copy of the current instance.
(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) Dispose

void Dispose ()

Return: void

Description: Releases all resources used by HiRDBConnection. Because Disconnect is called from within this method, when the HiRDBConnection object disappears, the database is automatically disconnected.
(g) Open

void Open ()

Return: void

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

Exception: HiRDBException