X-Original-To: pgsql-odbc-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0EEC552D89 for ; Mon, 1 Aug 2005 14:37:35 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67904-02 for ; Mon, 1 Aug 2005 17:37:23 +0000 (GMT) Received: from fep32-app.kolumbus.fi (fep32-0.kolumbus.fi [193.229.0.63]) by svr1.postgresql.org (Postfix) with ESMTP id 5E59952D8C for ; Mon, 1 Aug 2005 14:37:21 -0300 (ADT) Received: from [192.168.1.101] (really [84.231.186.215]) by fep32-app.kolumbus.fi with ESMTP id <20050801173718.BSVJ12976.fep32-app.kolumbus.fi@[192.168.1.101]>; Mon, 1 Aug 2005 20:37:18 +0300 Message-ID: <42EE5DCC.7070801@kolumbus.fi> Date: Mon, 01 Aug 2005 20:37:16 +0300 From: Marko Ristola User-Agent: Debian Thunderbird 1.0.2 (X11/20050331) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Marko Ristola Cc: Joel Fradkin , 'James Dornan' , pgsql-odbc@postgresql.org Subject: Re: IIS Postgres ASP ADO - Problem References: <000b01c5969c$b86330a0$797ba8c0@jfradkin> <42EE5876.7020109@kolumbus.fi> In-Reply-To: <42EE5876.7020109@kolumbus.fi> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.123 tagged_above=0 required=5 tests=AWL, FORGED_RCVD_HELO X-Spam-Level: X-Archive-Number: 200508/6 X-Sequence-Number: 5645 This was a false alarm: it seems, that the problem that I try to search, is not this one. This one seems to work correctly. I still try to understand, why free() fails under conninfo_parse(). free() call, that fails, is called from conninfo_parse() directly, and not within PQconninfoFree() as this one would have been. Marko Ristola Marko Ristola wrote: >I found a crashing problem during CONNECT into a database. > >Here is the problem description: > >Used Environment: >libpq-API under PostgreSQL 8.0.3 >CVS HEAD of psqlodbc > >libpq does have a problem with freeing memory, that has not been alloced >with malloc()! > >Here is the problem (I don't know, wether the PostgreSQL CVS HEAD has a >fix for this): > >postgresql-8.0.3/src/interfaces/libpq/fe-connect.c, function >conninfo_parse(): > > /* Make a working copy of PQconninfoOptions */ > options = malloc(sizeof(PQconninfoOptions)); >... > memcpy(options, PQconninfoOptions, sizeof(PQconninfoOptions)); > >Unfortunately PQconninfoOptions[] contains only char*val style pointers >instead of >char val[32] type character containers. >Because of this, the assumption, that memcpy() is enough to copy the >structure, is not >true anymore. You should NOT copy a static structure this way! > >Working code would be something like this: > >options = malloc(sizeof(PQconninfoOptions)); >memcpy(options, PQconninfoOptions, sizeof(PQconninfoOptions)); >for (i=0; PQconninfoOptions[i].val != NULL; i++) { > options[i].val = strdup(PQconninfoOptions[i].val); > ... same for all other values >} >NULL termination. > > > >Because of this, isql fails with me at the beginning, maybe because >dmalloc library, that I use for testing, discovered the problem. > >Marko Ristola > > >Joel Fradkin wrote: > > > >>James, >> >>The odbc is not working well for me (I can connect but get intermittent >>issues of the IIS server locking up in regards to connectivity). >>My understanding is the snapshot version is the best odbc out at this time. >> >>Also can you connect via pgadmin (IE have the hba and config files set to >>allow external connections)? >> >>My conection is not using dsn, but I did get dsn to work in testing. >>My dsnless string is >> >>Session("StringConn") = >>"DRIVER={PostgreSQL};DATABASE=wazagua;SERVER=192.168.123.121;PORT=5432;UID=p >>ostgres;PWD=;ReadOnly=0;Protocol=6.4;FakeOidIndex=0;ShowOidColumn=0;RowVersi >>oning=0;ShowSystemTables=0;ConnSettings=;Fetch=100;Socket=4096;UnknownSizes= >>0;MaxVarcharSize=254;MaxLongVarcharSize=8190;Debug=0;CommLog=0;Optimizer=1;K >>sqo=1;UseDeclareFetch=0;TextAsLongVarchar=1;UnknownsAsLongVarchar=0;BoolsAsC >>har=1;Parse=0;CancelAsFreeStmt=0;ExtraSysTablePrefixes=dd_;LFConversion=1;Up >>datableCursors=1;DisallowPremature=0;TrueIsMinus1=0;BI=0;ByteaAsLongVarBinar >>y=0;UseServerSidePrepare=0" >> >>My test using dsn used >>Session("StringConn") ="DSN=postgresql;" & _ >> "UID=postgres;" & _ >> "PWD=;" & _ >> "Database=wazuni;" >> >>asp code to use connection is : >> dim Arec, Acmd, SQL ,AConn >> set Arec = server.CreateObject("ADODB.Recordset") >> Set AConn = Server.CreateObject("ADODB.CONNECTION") >> set Acmd = server.CreateObject("ADODB.Command") >> AConn.ConnectionTimeOut=30 >> AConn.commandtimeout=30 >> AConn.Open Session("StringConn") >> >>For .net I use the npgsql .net objects. >> >>Hope this helps you. >> >>Joel Fradkin >> >> >> >> >>-----Original Message----- >>From: James Dornan [mailto:james@catch22.com] >>Sent: Sunday, July 31, 2005 4:44 PM >>To: jfradkin@wazagua.com >>Subject: IIS Postgres ASP ADO - Problem >> >> >> I noticed more than a few post from you about trying to get Postgres >>working with ODBC. >>I'm hoping that maybe you would share some of that information. I am >>running IIS under >>windos 2003 server, and the latest(8.0.3) Postgres server on the same >>machine. I cannot >>connect no matter what I do. I have tried everything. >> >> The funny part is that I'm not new to ODBC, or windows. I've worked >>with windows all >>the time, but just can't figure this one out. I've tried using a >>connection string, a DSN, >>reinstalling, IIS, Postgres, ODBC drivers, MDAC, Jet, and so on. I still >>have the same problem. >>The odbc drive and it's dependant DDLs are in the path. The permisions >>are wide open >>(for testing this specific problem). >> >> Is there any insight you could shed on the dark world of windows and >>ODBC, where feed- >>back is rare. >> >> Thanks for any help you can provide. >> >>-- James >> >> >>---------------------------(end of broadcast)--------------------------- >>TIP 2: Don't 'kill -9' the postmaster >> >> >> >> > > >---------------------------(end of broadcast)--------------------------- >TIP 2: Don't 'kill -9' the postmaster > >