Skip site navigation (1) Skip section navigation (2)

Connection string problems

From: "Gary Doades" <gpd(at)gpdnet(dot)co(dot)uk>
To: pgsql-odbc(at)postgresql(dot)org
Subject: Connection string problems
Date: 2004-02-09 19:25:25
Message-ID: 4027DEA5.5176.425EF09A@localhost (view raw, whole thread or download thread mbox)
Lists: pgsql-odbc
I seem to have a problem forming a suitable connect string for the PostgreSQL ODBC 
driver. I am using Windows XP and visual 2003 with C#.

If I have a connection string as:

string strConnect = "DSN=PostgreSQL30;UID=postgres;SERVER=; 

And I have defined the database to connec to in the DSN then everything works fine. 
What I want to do however is not have to define a DSN for every database that I have or 
when new ones are created. Normally (with MS SQLServer etc.) I would specify the 
driver name and database in the connection string itself. So I use:

string strConnect = "DRIVER={PostgreSQL};UID=postgres;SERVER=; 
Port=5432; Database=webroster";

I get an exception (OdbcException) thrown in C# that has NO error information at all in it 
and the connection fails.

I get this same problem if I specify the DSN but the DSN definition itself does not specify 
a database. Am I using the right keywords in the connection string? I have tried to look 
around for definitions of the keywords that the ODBC driver accepts, but I can only find 
various examples like the one I am using.

If I specify a DSN in the connect string and the DSN specifies a database then the 
connection and all other functions work just fine. Any ODBC exceptions thrown at any 
other point in my code have all the correct error information in them.

Any suggestions appreciated.



pgsql-odbc by date

Next:From: Chris GamacheDate: 2004-02-09 20:07:49
Subject: Re: Connection string problems
Previous:From: Jan WieckDate: 2004-02-09 15:25:38
Subject: Re: I want to use postresql for this app, but...

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group