Thread: A few problems with the ODBC driver

A few problems with the ODBC driver

From
Shachar Shemesh
Date:
Hi list,

I'm still trying to find my way around the ODBC arena, so please forgive me if I
ask something irrelevant. I am trying to migrate an application that currently
works on Windows with MS-SQL and Oracle to also work with PG-SQL. I've
downloaded the 7.3.100 ODBC driver. The problems are independant, but if anyone
manages to solve my first problem, I'm not going to care about the other ones.

1. The application is successful in seeing the database, and in getting the rows
from it. When it tries to modify a row, however, we get an error that says "Only
SQL_POSITION/REFRESH is supported for PGAPI_SetPos". Searching the sources
reveals that the line is issued as a result of line 2762 of "result.c". The
preceding lines show that either the odbc driver was compiled without
DRIVER_CURSOR_IMPLEMENT, or the cursor is a read only cursor. Tracing the MFC
stack reveals that the program does try to create a ROW_VER cursor. Could it be
that the binary ODBC available from the mirrors does not support cursors? Why?

2. I tried to compile a replica of the driver I downloaded. I followed the
instructions in README.TXT. Created the project in Visual Studio 6. Added the
def file (I opted for psqlodbc_win32.def, as that's the only one that matched
the name of the DLL I was supposed to create). The result was that the project
wouldn't compile. I tried to run ./configure from cygwin before, and now it
would compile, but throw an exception when I try to run it. What do I need to do
in order to recompile a copy of the binary version given at the site?

3. When I try to install the ODBC drivers by placing the DLL and merging the
registry changes, I get an error when I try to connect to the driver. The error
is "The setup routines for the PostgreSQL ODBC driver could not be loaded due to
system error code 126." It is followed by "Could not load the setup or
translator library". Any idea what the problem may be?

             Many thanks,

                  Shachar

Re: A few problems with the ODBC driver

From
"Hiroshi Inoue"
Date:
> -----Original Message-----
> From: Shachar Shemesh
>
> Hi list,
>
> I'm still trying to find my way around the ODBC arena, so
> please forgive me if I
> ask something irrelevant. I am trying to migrate an
> application that currently
> works on Windows with MS-SQL and Oracle to also work with PG-SQL. I've
> downloaded the 7.3.100 ODBC driver. The problems are
> independant, but if anyone
> manages to solve my first problem, I'm not going to care
> about the other ones.
>
> 1. The application is successful in seeing the database, and
> in getting the rows
> from it. When it tries to modify a row, however, we get an
> error that says "Only
> SQL_POSITION/REFRESH is supported for PGAPI_SetPos".
> Searching the sources
> reveals that the line is issued as a result of line 2762 of
> "result.c". The
> preceding lines show that either the odbc driver was compiled without
> DRIVER_CURSOR_IMPLEMENT, or the cursor is a read only cursor.
> Tracing the MFC
> stack reveals that the program does try to create a ROW_VER
> cursor. Could it be
> that the binary ODBC available from the mirrors does not
> support cursors? Why?

Are you checking the "Updatable cursors" DSN option ?

> 2. I tried to compile a replica of the driver I downloaded. I
> followed the
> instructions in README.TXT. Created the project in Visual
> Studio 6. Added the
> def file (I opted for psqlodbc_win32.def, as that's the only
> one that matched
> the name of the DLL I was supposed to create). The result was
> that the project
> wouldn't compile. I tried to run ./configure from cygwin
> before, and now it
> would compile, but throw an exception when I try to run it.
> What do I need to do
> in order to recompile a copy of the binary version given at the site?

Don't use the driver compiled under cygwin.
I recommend to compile it from the command line i.e type
  nmake /f win32.mak

regards,
Hiroshi Inoue


Re: A few problems with the ODBC driver

From
Shachar Shemesh
Date:
Hiroshi Inoue wrote:

>>-----Original Message-----
>>From: Shachar Shemesh
>>
>>Hi list,
>>
>>I'm still trying to find my way around the ODBC arena, so
>>please forgive me if I
>>ask something irrelevant. I am trying to migrate an
>>application that currently
>>works on Windows with MS-SQL and Oracle to also work with PG-SQL. I've
>>downloaded the 7.3.100 ODBC driver. The problems are
>>independant, but if anyone
>>manages to solve my first problem, I'm not going to care
>>about the other ones.
>>
>>1. The application is successful in seeing the database, and
>>in getting the rows
>>from it. When it tries to modify a row, however, we get an
>>error that says "Only
>>SQL_POSITION/REFRESH is supported for PGAPI_SetPos".
>>Searching the sources
>>reveals that the line is issued as a result of line 2762 of
>>"result.c". The
>>preceding lines show that either the odbc driver was compiled without
>>DRIVER_CURSOR_IMPLEMENT, or the cursor is a read only cursor.
>>Tracing the MFC
>>stack reveals that the program does try to create a ROW_VER
>>cursor. Could it be
>>that the binary ODBC available from the mirrors does not
>>support cursors? Why?
>>
>>
>
>Are you checking the "Updatable cursors" DSN option ?
>
>
As a matter of fact - I am. We were wondering what it does. In any case,
that did not help.

> 2. I tried to compile a replica of the driver I downloaded. I
>followed the
>instructions in README.TXT. Created the project in Visual
>Studio 6. Added the
>def file (I opted for psqlodbc_win32.def, as that's the only
>one that matched
>the name of the DLL I was supposed to create). The result was
>that the project
>wouldn't compile. I tried to run ./configure from cygwin
>before, and now it
>would compile, but throw an exception when I try to run it.
>What do I need to do
>in order to recompile a copy of the binary version given at the site?
>
>
>
>Don't use the driver compiled under cygwin.
>I recommend to compile it from the command line i.e type
>  nmake /f win32.mak
>
>
Ok. I fail with "don't know how to make psqlodbc.rc". It is, indeed, not
in the sources. Where do I get it?

>
>regards,
>Hiroshi Inoue
>
>

--
Shachar Shemesh
Open Source integration consultant
Home page & resume - http://www.shemesh.biz/



Re: A few problems with the ODBC driver

From
Hiroshi Inoue
Date:
Shachar Shemesh wrote:
>
> Hiroshi Inoue wrote:
>
> >>-----Original Message-----
> >>From: Shachar Shemesh
> >>
> >>1. The application is successful in seeing the database, and
> >>in getting the rows
> >>from it. When it tries to modify a row, however, we get an
> >>error that says "Only
> >>SQL_POSITION/REFRESH is supported for PGAPI_SetPos".
> >>Searching the sources
> >>reveals that the line is issued as a result of line 2762 of
> >>"result.c". The
> >>preceding lines show that either the odbc driver was compiled without
> >>DRIVER_CURSOR_IMPLEMENT, or the cursor is a read only cursor.
> >>Tracing the MFC
> >>stack reveals that the program does try to create a ROW_VER
> >>cursor. Could it be
> >>that the binary ODBC available from the mirrors does not
> >>support cursors? Why?
> >
> >Are you checking the "Updatable cursors" DSN option ?
> >
> As a matter of fact - I am. We were wondering what it does. In any case,
> that did not help.

What kind of cursor are you opening ?
Anyway, could you send me the Mylog debug output ?

> > 2. I tried to compile a replica of the driver I downloaded. I
> >followed the
> >instructions in README.TXT. Created the project in Visual
> >Studio 6. Added the
> >def file (I opted for psqlodbc_win32.def, as that's the only
> >one that matched
> >the name of the DLL I was supposed to create). The result was
> >that the project
> >wouldn't compile. I tried to run ./configure from cygwin
> >before, and now it
> >would compile, but throw an exception when I try to run it.
> >What do I need to do
> >in order to recompile a copy of the binary version given at the site?
> >
> >Don't use the driver compiled under cygwin.
> >I recommend to compile it from the command line i.e type
> >  nmake /f win32.mak
> >
> Ok. I fail with "don't know how to make psqlodbc.rc". It is, indeed, not
> in the sources. Where do I get it?

Please go to
http://gborg.postgresql.org/project/psqlodbc/projdisplay.php.
You can view Web CVS there or access CVS from the command line
according to an info on the page.

regards,
Hiroshi Inoue
    http://www.geocities.jp/inocchichichi/psqlodbc/

Re: A few problems with the ODBC driver

From
Hiroshi Inoue
Date:
Shachar Shemesh wrote:
>
> Quoting Hiroshi Inoue <Inoue@tpf.co.jp>:
>
> > Shachar Shemesh wrote:
> >
> > What kind of cursor are you opening ?
> It's deep inside the MFC code, so I'm not sure. I /THINK/ It's a rowver cursor.
> > Anyway, could you send me the Mylog debug output ?
> Attached.

Maybe I found a cause.
Please try the snapshot dll at
    http://www.geocities.jp/inocchichichi/psqlodbc/ .

regards,
Hiroshi Inoue
    http://www.geocities.jp/inocchichichi/psqlodbc/

Re: A few problems with the ODBC driver

From
Shachar Shemesh
Date:
Quoting Hiroshi Inoue <Inoue@tpf.co.jp>:

> Maybe I found a cause.
> Please try the snapshot dll at
>     http://www.geocities.jp/inocchichichi/psqlodbc/ .
I downloaded "psqlodbc.zip" from the site. The exact same symptoms.

IS this different than CVS tip? That's what I'm compiling locally (and that's
the versions the logs I sent were taken with).

           Shachar

Re: A few problems with the ODBC driver

From
Shachar Shemesh
Date:
Quoting Hiroshi Inoue <Inoue@tpf.co.jp>:

> Maybe I found a cause.
> Please try the snapshot dll at
>     http://www.geocities.jp/inocchichichi/psqlodbc/ .
>
I found the cause of the problem.

The SQLExecute command constructs a query in order to find the table. It forgot
to double quote the table name. As all the table names in my database are
uppercase, this caused the query to fail (PGSQL converts all unquoted ids to
lowercase), and the recordset was marked readonly.

Attached is a patch that fixes this problem. Forgive me if this is the wrong
place to post it. Let me know where I should post it.

                 Shachar

Attachment