Opening a database connection v8.0.2.1
An EDBConnection
object is responsible for handling the communication between an instance of EDB Postgres Advanced Server and a .NET application. Before you can access data stored in an EDB Postgres Advanced Server database, you must create and open an EDBConnection
object.
Creating an EDBConnection object
You can open a connection using one of the following approaches. In either case, you must import the namespace EnterpriseDB.EDBClient
.
Connection with a data source
Create an instance of the
EDBDataSource
object using a connection string as a parameter to the create method of theEDBDataSource
class.To open a connection, call the
OpenConnection
method of theEDBDataSource
object.
This example shows how to open a connection using a data source: