Thread: C application to PostgreSQL in Windows

C application to PostgreSQL in Windows

From
Stanley Wang
Date:
Hi,

I am a newbie to PostgreSQL. I want to write a C
application to retrieve data from PostgreSQL. I have
installed the PostgreSQL v8.1 for Windows and write a
simple test application. I also downloaded and
installed the ODBC driver. The application compiles
OK, but when I run it, it crashes. The problematic
code is to connect to the database.

PGconn     *conn;
conn = PQconnectdb("user=postgres password=stan
dbname=postgis hostaddr=127.0.0.1 port=5432");


The DSN I created is like following:

Data Source : PostgreSQL Unicode
Database : postgis
Server : 127.0.0.1
Username : postgres
Password : stan
Port : 5432

I wonder whether it is the correct way to set up
everything. Thanks in advance for your answer.

Stan

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com