X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 85A2DD1D851 for ; Mon, 9 Feb 2004 21:24:43 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 35127-08 for ; Mon, 9 Feb 2004 17:24:33 -0400 (AST) Received: from gpdnet.co.uk (gpdnet.plus.com [212.56.100.243]) by svr1.postgresql.org (Postfix) with ESMTP id CC2E7D1DA7D for ; Mon, 9 Feb 2004 17:24:29 -0400 (AST) Received: from Spooler by gpdnet.co.uk (Mercury/32 v4.01a) ID MO001115; 9 Feb 2004 21:24:34 -0000 Received: from spooler by gpdnet.co.uk (Mercury/32 v4.01a); 9 Feb 2004 21:24:22 -0000 Received: from gary (192.168.1.2) by gpdnet.co.uk (Mercury/32 v4.01a) with ESMTP ID MG001114; 9 Feb 2004 21:24:11 -0000 From: "Gary Doades" To: pgsql-odbc@postgresql.org, cgg007@yahoo.com Date: Mon, 09 Feb 2004 21:24:10 -0000 MIME-Version: 1.0 Subject: Re: Connection string problems Message-ID: <4027FA7A.28183.42CBA948@localhost> In-reply-to: <20040209200749.95637.qmail@web13808.mail.yahoo.com> References: <4027DEA5.5176.425EF09A@localhost> X-mailer: Pegasus Mail for Windows (v4.12a) Content-type: Multipart/Alternative; boundary="Alt-Boundary-23569.1120643400" X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200402/28 X-Sequence-Number: 3781 --Alt-Boundary-23569.1120643400 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body Quick (ish) answer. I am currently investigating migrating from SQLServer to PostgresSQL. I could edit my source code (around 150,000 lines in 40 assemblies) to refer to PgSqlConnection, PgSqlCommand etc.etc. but I may also want to have the option of other backends. If I use ODBC I have minimal changes to make to the source modules to get this done. I ported over a 500 MB database from SQLServer to PostgreSQL yesterday (80 tables, well normalised) All my performance testing between SQLServer with Native drivers and ODBC gives marginal (5-10%) performance differences. In some cases ODBC is faster! Similar results with PostgreSQL. I used your suggestion on the connection string and I get back: DRIVER={PostgreSQL};DATABASE=webroster;SERVER=192.168.1.102;PORT=5432;U ID=postgres;ReadOnly=0;Protocol=6.4;FakeOidIndex=0;ShowOidColumn=0;RowVersio ning=0;ShowSystemTables=0;ConnSettings=;Fetch=100;Socket=4096;UnknownSizes= 0;MaxVarcharSize=254;MaxLongVarcharSize=8190;Debug=0;CommLog=0;Optimizer=0 ;Ksqo=0;UseDeclareFetch=0;TextAsLongVarchar=1;UnknownsAsLongVarchar=0;Bools AsChar=1;Parse=0;CancelAsFreeStmt=0;ExtraSysTablePrefixes=dd_;;LFConversion=1; UpdatableCursors=1;DisallowPremature=0;TrueIsMinus1=0;BI=0;ByteaAsLongVarBinar y=0;UseServerSidePrepare=0 Which acually works! Do you think I need all the extra stuff? I guess I might just start removing things until it breaks again to see what is the minimum I can get away with. On 9 Feb 2004 at 12:07, Chris Gamache wrote: > > 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 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 --Alt-Boundary-23569.1120643400 Content-type: text/html; charset=US-ASCII Content-transfer-encoding: 7BIT Content-description: Mail message body
Quick (ish) answer. I am currently investigating migrating from SQLServer to PostgresSQL. I could edit my source code (around 150,000 lines in 40 assemblies) to refer to PgSqlConnection, PgSqlCommand etc.etc. but I may also want to have the option of other backends. If I use ODBC I have minimal changes to make to the source modules to get this done.

I ported over a 500 MB database from SQLServer to PostgreSQL yesterday (80 tables, well normalised)

All my performance testing between SQLServer with Native drivers and ODBC gives marginal (5-10%) performance differences. In some cases ODBC is faster! Similar results with PostgreSQL.

I used your suggestion on the connection string and I get back:

DRIVER={PostgreSQL};DATABASE=webroster;SERVER=192.168.1.102;PORT=5432;UID=postgres;ReadOnly=0;Protocol=6.4;FakeOidIndex=0;ShowOidColumn=0;RowVersioning=0;ShowSystemTables=0;ConnSettings=;Fetch=100;Socket=4096;UnknownSizes=0;MaxVarcharSize=254;MaxLongVarcharSize=8190;Debug=0;CommLog=0;Optimizer=0;Ksqo=0;UseDeclareFetch=0;TextAsLongVarchar=1;UnknownsAsLongVarchar=0;BoolsAsChar=1;Parse=0;CancelAsFreeStmt=0;ExtraSysTablePrefixes=dd_;;LFConversion=1;UpdatableCursors=1;DisallowPremature=0;TrueIsMinus1=0;BI=0;ByteaAsLongVarBinary=0;UseServerSidePrepare=0

Which acually works! Do you think I need all the extra stuff? I guess I might just start removing things until it breaks again to see what is the minimum I can get away with.

On 9 Feb 2004 at 12:07, Chris Gamache wrote:

>
> 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

--Alt-Boundary-23569.1120643400--