Connecting to a vPostgres Database With pgAdmin:

 

The pgAdmin client tool is not necessary for connecting to vPostgres databases. The Data Director UI includes everything you need to manage your vPostgres databases graphically. The instructions for using pgAdmin are included for completeness.

If you do not have pgAdmin installed, download the pgAdmin appropriate for your platform from the Postgres site and install it. See the Postgres site for information.

To use the Postgres pgAdmin tool to connect to vPostgres databases, pgAdmin must use the Data Director libpq.

The Windows pgAdmin tool works only with Windows 32-bit systems. If you run Windows 64-bit, install the 32-bit versions of the vPostgres client tools. The installer places the 32-bit tools in the C:\Program Files (x86) tree.

Before you begin, obtain the following information.

■        The vPostgres connection string. See Connecting to vPostgres Databases.

■        The Data Director DB Name Service IP address. You can get the IP address from the Data Director       vApp in vSphere Client. Contact your administrator if you need help.

>>      Login to vSphere Client as an administrator.

>>      Locate your Data Director vApp in the Hosts and Clusters list, and expand the vApp.

>>      Click DB Name Server to select it, and click the Summary tab.

>>      The IP address is listed in the General pane.

 

Ask your system administrator for help if you do not have access to the Data Director Web UI or to the vSphere Client.

1        Ensure that pgAdmin uses the vPostgres libpq on Windows.

>>      Copy the C:\Program Files\pgAdmin III\<version> directory to C:\Program         Files\pgAdmin III\<version>-vPostgres, where <version> is the pgAdmin version number:

>>      Copy all the files in your C:\Program Files\VMware\vPostgres\1.0\bin directory to C:\Program Files\pgAdmin III\<version>-vPostgres.

2        Start pgAdmin from the C:\Program Files\pgAdmin III\<version>-vPostgres directory.

3        Select File > Add Server.

4        Enter values for the following properties.

>>      Name. Enter a meaningful name for the server, such as Data Director.

>>      Host. Enter the {UUID}.[DB Name Service IP or FQDN] part of the vPostgres connection string.

>>      Leave the default values for Port, Service, and Maintenance DB.

>>      Username. Enter the database user name. This is usually the database owner user ID.

>>      Password. Enter the database user name’s password. You can optionally store the password, but note that pgAdmin stores the password in plain text format.

>>      (Optional) Enter a color to denote this server in the object browser and in diagrams.

>>      (Optional) Enter a server group in which to place this server, or accept the default.

5        Click the Advanced tab, and type the DB Name Service IP address in the Host text box.

6        Click OK.

 

PgAdmin connects to the vPostgres database:

 

Connect to a vPostgres Database with JDBC

The JDBC connection string has the following format.

jdbc:postgresql://{UUID}.<host name>/<RDB name>?user=<user name>

The curly brackets, {}, are part of the connection string and denote the UUID.

For example, suppose that your vPostgres database, myDB, is deployed on the host w1-devtest-22.dev.mycorp.com. If theUUID is d35f7ab1-d70e-4d98-c121-122f68e4ab60 and the user name is dbowner, the JDBC connection string is as follows.

jdbc:postgresql://{d35f7ab1-d70e-4d98-c121-122f68e4ab60}.w1-devtest-22.dev.mycorp.com/mydb?user=dbowner

 

Connect to a vPostgres Database With psql:

 

The psql connection string has the following format.

psql -h {UUID}.<DB Name Service IP> -p 5432 -d <DB name> -U <db user name>

You connect to a database using psql. The database has the UUID 1234-5678-9012-3456, the DB Name Service port is 5432, the IP address for the DB Name Server is 10.0.0.1, the database name is myDB, and the database user name is dbuser. The psql command is as follows.

$ psql -h {1234-5678-9012-3456}.10.0.0.1 -p 5432 -d myDB -U dbuser

Psql connects to myDB and prompts for the password, and logs you in. You can enter psql commands as usual.