954,529 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Delphi 7 - PostgreSQL 9

Hi, I have just downloaded PostgreSQL and would like to add it into my new projects. I have never used PostgreSQL before so I don't know any of its technical details yet. I have registered the PostgreSQL provider using regsvr32 pgoledb.dll or something like that on my Winows partition, everything registered successfully according to a pop-up message, and I went into Delphi and saw that it now shows PostgreSQL under the provider list.

I tried to use it with an TADOQuery but after I wanted to test the connection, I got the following error: "Test connection failed because of an error in initializing provider. Unspecified error." Now I'm confused... Is it because PostgreSQL 9 is too new for the PostgreSQL OLE DB Provider? Or did I just to something wrong?

In the connection string, I assumed that the Data Source field is the Server or Database name, Location is the Port, Username is the same as in PostgreSQL, as well as the password... Or will it be better to connect via code?

Any help will be greatly appreciated

ChaosKnight11
Light Poster
32 posts since Jul 2010
Reputation Points: 10
Solved Threads: 1
 

I found this in readme file of the provider :
PgOleDb supports the following connection attributes:
Provider - mandatory. Must be set to "PostgreSQL", "PostgreSQL.1" or "PostgreSQL OLE DB Provider"
Data Source - server name or address
location - database name
User ID - PG user name to log in as
password - the password
timeout - how long to wait when establishing the initial connection

Ionelul
Junior Poster in Training
94 posts since Dec 2009
Reputation Points: 17
Solved Threads: 27
 

Hi thanks for the reply, now I know how it works and will start to investigate the readme file more often. But when I try to connect with Data Source as the server name or location I get the following error: 'Could not translate host name "PostgreSQL 9.0" to address: Unknown host' I tried PostgreSQL 9.0, localhost, 5432, localhost:5432 and even PostgreSQL 9.0 (localhost:5432). Where can I find the correct Server name??

Thanks!

ChaosKnight11
Light Poster
32 posts since Jul 2010
Reputation Points: 10
Solved Threads: 1
 

server name is localhost. I installed Postgre and I got the same error before I put the correct password. I used the following connection parameters:
Data source : localhost
Location : postgre
user : postgre
password : admin --> the password I wrote at installation time.

Hope this helps
Ionut

Ionelul
Junior Poster in Training
94 posts since Dec 2009
Reputation Points: 17
Solved Threads: 27
 

Thank you for your help, Ionelul! My problem is one of the past =D... It turned out to be only the localhost for data source as you suggested... SOLVED

ChaosKnight11
Light Poster
32 posts since Jul 2010
Reputation Points: 10
Solved Threads: 1
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You