pg.ddx.io  pgsql-odbc@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Chris Gamache <cgg007@yahoo.com>
To: Gary Doades <gpd@gpdnet.co.uk>
To: pgsql-odbc@postgresql.org
Subject: Re: Connection string problems
Date: Mon, 9 Feb 2004 12:07:49 -0800 (PST)
Message-ID: <20040209200749.95637.qmail@web13808.mail.yahoo.com> (raw)
In-Reply-To: <4027DEA5.5176.425EF09A@localhost>


Quick question: Why aren't you using the .NET data provider?

If you're set on using ODBC, try using the Microsoft data link properties:

1. Create a file, call it postgresql.udl (make sure its NOT postgresql.udl.txt)
2. Double click on it.
3. Set your connection options.
4. Click OK.
5. Open with Notepad. There you'll find a connection string.

HTH

--- Gary Doades <gpd@gpdnet.co.uk> wrote:
> I seem to have a problem forming a suitable connect string for the PostgreSQL
> ODBC 
> driver. I am using Windows XP and visual studio.net 2003 with C#.
> 
> If I have a connection string as:
> 
> string strConnect = "DSN=PostgreSQL30;UID=postgres;SERVER=192.168.1.102; 
> Port=5432;";
> 
> 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=192.168.1.102; 
> 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.
> 
> Thanks
> Gary.
> 
> 
> ---------------------------(end of broadcast)---------------------------
> TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org


__________________________________
Do you Yahoo!?
Yahoo! Finance: Get your refund fast by filing online.
http://taxes.yahoo.com/filing.html



view thread (5+ messages)  latest in thread

Message-ID: <20040209200749.95637.qmail@web13808.mail.yahoo.com>
Permalink:  ../20040209200749.95637.qmail@web13808.mail.yahoo.com/
Also on:    postgresql.org/message-id/20040209200749.95637.qmail@web13808.mail.yahoo.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-odbc@postgresql.org
  Cc: cgg007@yahoo.com, gpd@gpdnet.co.uk
  Subject: Re: Connection string problems
  In-Reply-To: <20040209200749.95637.qmail@web13808.mail.yahoo.com>
  References: <4027DEA5.5176.425EF09A@localhost> <20040209200749.95637.qmail@web13808.mail.yahoo.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox