View Single Post
  #17  
Old 02-19-2005, 09:05 PM
loquin's Avatar
loquin loquin is offline
Google Hound

Retired Moderator
* Guru *
 
Join Date: Nov 2001
Location: Arizona, USA
Posts: 12,232
Default

Now that the good folks at PostgreSQL have released their first native Win32 version of PostgreSQL (v8.0), more and more folks will be looking to interface to it from VB. The following is an example of a DSN-Less connection string. Obviously, you'll need to adjust the server name, Database name, User ID, and Password to fit your specific application.
Edit by loquin: The folks at PostgreSQL.Org are now up to release 8.3

Code:
Const strPG As String = "Driver={PostgreSQL}; Server=localhost; PORT=5432; Database=test; UID=UserName; PWD=YourPassword"
or
Code:
Const strPG As String = "Driver={PostgreSQL Unicode}; Server=localhost; PORT=5432; Database=test; UID=UserName; PWD=YourPassword"
or
Code:
Const strPG As String = "Driver={PostgreSQL ANSI}; Server=localhost; PORT=5432; Database=test; UID=UserName; PWD=YourPassword"
Code:
Const strPG As String = "Provider=PostgreSQL OLE DB Provider;Password=YourPassword;User ID=UserName;Data Source=localhost;Location=DefaultDatabaseName"
The second and third examples uses the latest version of the PostgreSQL ODBC drivers, which are UNICODE or ANSI specific, respectively. Normally, you would use the UNICODE driver.

The fourth option is the to use the OleDB provider.

If the server is not local, replace localhost with the IP address of the host, or the server name.

If your username or machine is defined as a trusted connection in the pg_hba.conf configuration file, you may dispense with the password portion of the connection string.

Note: One quirk of PostgreSQL is case handling of object names (table/schema/database/field); By default, it uses lower case; if upper case is used at all in a name, the object name(s) must be quoted.

In addition, I've located a good online e-book. Although it's specific to v7.x, most of the information provided is applicable to v8. Of course, if you've installed the Windows version, some of the linux utilities may not apply. In any case, be sure to download the version 8 documentation (PDF.) The official documentation is some 1500 pages in length, however, so be sure to use the Table of Contents and index!

Frank Wiles has published a very well-written tutorial titled http://revsys.com/writings/postgresql-performance.html. Recommended.
__________________
Lou
"I have my standards. They may be low, but I have them!" ~ Bette Middler
"It's a book about a Spanish guy called Manual. You should read it." ~ Dilbert
"To understand recursion, you must first understand recursion." ~ unknown

Last edited by loquin; 01-28-2007 at 01:41 AM.