PsqlConnection Object
Show this topic in Library frames
The PsqlConnection object supports the public properties described in Table 4-5. Some properties return the values specified for the corresponding connection string option. Unlike the connection string options, the PsqlConnection property names do not include a space.
See Connection String Options for the Pervasive.SQL Provider for more information.
Table 4-5 Public Properties of the PsqlConnection Object
|
Property
|
Description
|
|
ConnectionString
|
Gets or sets the string used to open a database.
|
|
ConnectionTimeout
|
Gets the time to wait while trying to establish a connection before the data provider terminates the attempt and generates an error.
|
|
DataSource
|
Gets the name of the current database or the database to be used when a connection is open.
|
|
Host
|
Returns the value specified for the Host connection string option. Read-only.
|
|
Port
|
Returns the value specified for the Port connection string option. Read-only.
|
|
ServerDSN
|
Returns the value specified for the ServerDSN connection string option. Read-only.
|
|
Server Name
|
Returns the value specified for the Server Name connection string option. Read-only.
|
|
ServerVersion
|
Returns a string containing the version of the Pervasive.SQL server to which this object is currently connected. If the PsqlConnection object is not currently connected, the data provider generates an InvalidOperation exception.
|
|
State
|
Gets the current state of the connection.
|
Table 4-6 describes the public methods of PsqlConnection.
Table 4-6 Public Methods of the PsqlConnection Object
|
Method
|
Description
|
|
BeginTransaction
|
Begins a database transaction.
|
|
ChangeDatabase
|
Changes the current database for an open Connection object.
|
|
Close
|
Closes the connection to the database.
|
|
CreateCommand
|
Creates and returns a PsqlCommand object associated with the PsqlConnection.
|
|
Dispose
|
Releases the resources used by the data provider's Connection object.
|
|
Open
|
Opens a database connection with the settings specified by the ConnectionString property of the PsqlConnection object.
|
You can use the InfoMessage event of the PsqlConnection object to retrieve warnings and informational messages from the database. If the database returns an error, an exception is thrown. Clients that want to process warnings and informational messages sent by the database server should create an PsqlInfoMessageEventHandler delegate to register for this event.
The InfoMessage event receives an argument of type PsqlInfoMessageEventArgs containing data relevant to this event.