pg.ddx.io  pgsql-interfaces@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Steve Wranovsky <stevew@merge.com>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: 7.1 beta 4 ODBC Connection Problem
Date: Wed, 07 Feb 2001 19:38:51 -0500
Message-ID: <9818.981592731@sss.pgh.pa.us> (raw)
In-Reply-To: <4.3.2.7.2.20010207165510.00c36380@mail.merge.com>
References: <4.3.2.7.2.20010207165510.00c36380@mail.merge.com>

Steve Wranovsky <stevew@merge.com> writes:
> I get a seg fault when I try and connect to the database via
> SQLConnect.  Below is a stack trace from the core file.  The crash
> occurs in sprintf.

This is probably the same problem that Nick Gorham pointed out this
morning...

			regards, tom lane

------- Forwarded Message

Date:    Wed, 07 Feb 2001 13:04:34 +0000
From:    Nick Gorham <nick@easysoft.com>
To:      pgsql-hackers@postgresql.org
Subject: [HACKERS] unixODBC (again)

Hi,

Having seen that the driver I distribute doesn't work against 7.1 Beta
4, and not wanting to continue the split between the two versions,
I have tried to get the driver in the beta working with unixODBC, but
I have come against a couple of problems, one a show stopper.

First let me say that I want to stop the split between the version, If
I can just point people to your distribution, thats fine by me, but it
needs to work :-). I am not trying to get you to standardise on
unixODBC, just to provide the option.

Initially I had to link my system odbc.ini to a user odbc, because the
driver looks in the home account. This would be SO much better if there
was a build option to link with libodbcini.so, not saying it should be
the default, just that the option would be great.

After this, it still didn't find the entries, I fould the problem was
the code couldn't handle spaces in the ini file, so

[dsn]
Servername=fred

works, but

[dsn]
Servername         = fred

doesn't. Not a major point, but again the ini lib would fix this.

Then having sorted this out, I get a core dump, that I have traced to
CC_lookup_pg_version, the code did

    CC_lookup_pg_version(ConnectionClass *self)
    {
    HSTMT hstmt;
    StatementClass *stmt;
    RETCODE result;
    char *szVersion = "0.0";
    static char *func = "CC_lookup_pg_version";

Then later did a

    sprintf( szVersion... );

This seems to be trying to write into, what the compiler is marking as
read only storage. A quick change to

    CC_lookup_pg_version(ConnectionClass *self)
    {
    HSTMT hstmt;
    StatementClass *stmt;
    RETCODE result;
    char szVersion[ 3 ];                    ---- should be 4 --- tgl
    static char *func = "CC_lookup_pg_version";

        strcpy( szVersion, "0.0" );

Fixes the problem, and it connects. I will continue testing, with some
apps and see how it gets on

--
Nick Gorham
Easysoft Ltd

------- End of Forwarded Message



view thread (2+ messages)

Message-ID: <9818.981592731@sss.pgh.pa.us>
Permalink:  ../9818.981592731@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/9818.981592731@sss.pgh.pa.us

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-interfaces@postgresql.org
  Cc: tgl@sss.pgh.pa.us, stevew@merge.com
  Subject: Re: 7.1 beta 4 ODBC Connection Problem
  In-Reply-To: <9818.981592731@sss.pgh.pa.us>

* 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