Обсуждение: Acucobol, ODBC and Postgres

Поиск
Список
Период
Сортировка

Acucobol, ODBC and Postgres

От
Jonathan Foy
Дата:
Hello

I'm trying to configure the postgres odbc driver with our Acucobol application (5.2 and 8.1), and was hoping that someone out there might have some experience with this.

The application currently connects to our postgres databases (8.1.3 up to 8.4.2) without issue.  The problem came up when I started trying to use pgbouncer.  I had it up and running from the command line, but connections coming from the application are rejected due to a "bad packet header", which seems to be because the connect packets are coming in with V2 in the data, and pgbouncer only supports V3.  So, we downloaded the latest driver, compiled it (RHEL 5.4), and (in theory) recompiled cobol with the new library (libodbcpsql.so.2.0.0) linked in.  There was no apparent change.

The application can still parse the odbc.ini file to get the database name, server, port, user, and password, but any additional settings seem to be ignored.  I can't get any logging, I can't set the Protocol version...I'm not convinced that the proper driver is being used.

Does anyone have any ideas?  Pulling my hair out...

Re: Acucobol, ODBC and Postgres

От
Korry Douglas
Дата:
> I'm trying to configure the postgres odbc driver with our Acucobol
> application (5.2 and 8.1), and was hoping that someone out there
> might have some experience with this.
>
> The application currently connects to our postgres databases (8.1.3
> up to 8.4.2) without issue.  The problem came up when I started
> trying to use pgbouncer.  I had it up and running from the command
> line, but connections coming from the application are rejected due
> to a "bad packet header", which seems to be because the connect
> packets are coming in with V2 in the data, and pgbouncer only
> supports V3.  So, we downloaded the latest driver, compiled it (RHEL
> 5.4), and (in theory) recompiled cobol with the new library
> (libodbcpsql.so.2.0.0) linked in.  There was no apparent change.
>
> The application can still parse the odbc.ini file to get the
> database name, server, port, user, and password, but any additional
> settings seem to be ignored.  I can't get any logging, I can't set
> the Protocol version...I'm not convinced that the proper driver is
> being used.
>
> Does anyone have any ideas?  Pulling my hair out...

I would start by running strace on your application while it is trying
to connect.  When I've run into kind of problem that you describe,
I've found that the ODBC Driver Manager is reading the wrong odbc.ini
file (for example, reading from /etc/odbc.ini when I expected /usr/
local/etc/odbc.ini).

Just run:

    $ strace -o /tmp/myapp.trc <your application name goes here>

Then look through the /tmp/myapp.trc file, searching for attempts to
open odbc.ini, odbcinst.ini, and the libodbcpsql.so library.

            -- Korry




-----------------------------------------------------------------------
Korry Douglas
Senior Database Dude
EnterpriseDB Corporation
The Enterprise Postgres Company

Phone: (804)241-4301
Mobile: (620) EDB-NERD



Re: Acucobol, ODBC and Postgres

От
"Jonah H. Harris"
Дата:
On Wed, Apr 7, 2010 at 3:27 PM, Jonathan Foy <thefoy@gmail.com> wrote:
I'm trying to configure the postgres odbc driver with our Acucobol application (5.2 and 8.1), and was hoping that someone out there might have some experience with this.

About two years ago I was working on a project which used Postgres via ODBC with both ACUCOBOL and Micro Focus.  Which ODBC driver are you using?  You should try ODBCng (https://projects.commandprompt.com/public/odbcng/).

Also, you may want to try/consider using the commercial PG ODBC driver from DataDirect (http://www.datadirect.com/products/odbc/odbc-postgresql/index.ssp).

--
Jonah H. Harris
Blog: http://www.oracle-internals.com/

Re: Acucobol, ODBC and Postgres

От
"Jonah H. Harris"
Дата:
On Wed, Apr 7, 2010 at 3:36 PM, Korry Douglas <korry.douglas@enterprisedb.com> wrote:
I'm trying to configure the postgres odbc driver with our Acucobol application (5.2 and 8.1), and was hoping that someone out there might have some experience with this.

The application currently connects to our postgres databases (8.1.3 up to 8.4.2) without issue.  The problem came up when I started trying to use pgbouncer.  I had it up and running from the command line, but connections coming from the application are rejected due to a "bad packet header", which seems to be because the connect packets are coming in with V2 in the data, and pgbouncer only supports V3.  So, we downloaded the latest driver, compiled it (RHEL 5.4), and (in theory) recompiled cobol with the new library (libodbcpsql.so.2.0.0) linked in.  There was no apparent change.

The application can still parse the odbc.ini file to get the database name, server, port, user, and password, but any additional settings seem to be ignored.  I can't get any logging, I can't set the Protocol version...I'm not convinced that the proper driver is being used.

Does anyone have any ideas?  Pulling my hair out...

I would start by running strace on your application while it is trying to connect.  When I've run into kind of problem that you describe, I've found that the ODBC Driver Manager is reading the wrong odbc.ini file (for example, reading from /etc/odbc.ini when I expected /usr/local/etc/odbc.ini).

Yeah, I like to explicitly define my ODBCINI and ODBCINST environment variables to avoid that issue.

--
Jonah H. Harris
Blog: http://www.oracle-internals.com/

Re: Acucobol, ODBC and Postgres

От
Jonathan Foy
Дата:
The application is actually launched from a windows box via a thin client...I'm not sure how I would run it with strace.

However, I'm fairly sure I'm pulling in the correct one, if I change the port it fails, as it should.  Switch it back and it works. Of all the odbc entries on the system (from a root level search for both odbc.ini and .odbc.ini), only the one has this database entry in it at all.  And it WILL connect, just not do what I want it to.


On Wed, Apr 7, 2010 at 4:06 PM, Korry Douglas <korry.douglas@enterprisedb.com> wrote:
I'm trying to configure the postgres odbc driver with our Acucobol application (5.2 and 8.1), and was hoping that someone out there might have some experience with this.

The application currently connects to our postgres databases (8.1.3 up to 8.4.2) without issue.  The problem came up when I started trying to use pgbouncer.  I had it up and running from the command line, but connections coming from the application are rejected due to a "bad packet header", which seems to be because the connect packets are coming in with V2 in the data, and pgbouncer only supports V3.  So, we downloaded the latest driver, compiled it (RHEL 5.4), and (in theory) recompiled cobol with the new library (libodbcpsql.so.2.0.0) linked in.  There was no apparent change.

The application can still parse the odbc.ini file to get the database name, server, port, user, and password, but any additional settings seem to be ignored.  I can't get any logging, I can't set the Protocol version...I'm not convinced that the proper driver is being used.

Does anyone have any ideas?  Pulling my hair out...

I would start by running strace on your application while it is trying to connect.  When I've run into kind of problem that you describe, I've found that the ODBC Driver Manager is reading the wrong odbc.ini file (for example, reading from /etc/odbc.ini when I expected /usr/local/etc/odbc.ini).

Just run:

       $ strace -o /tmp/myapp.trc <your application name goes here>

Then look through the /tmp/myapp.trc file, searching for attempts to open odbc.ini, odbcinst.ini, and the libodbcpsql.so library.

                       -- Korry




-----------------------------------------------------------------------
Korry Douglas
Senior Database Dude
EnterpriseDB Corporation
The Enterprise Postgres Company

Phone: (804)241-4301
Mobile: (620) EDB-NERD



Re: Acucobol, ODBC and Postgres

От
Jonathan Foy
Дата:
I'm using (or think I am) the latest psqlODBC download from the postgresql website.  8.04.0200.  It was compiled and then linked into runcbl via the ACUSQL_ODBC_LIB variable, which then gets passed up the chain, in the Makefile (for runcbl).  Is this not the correct way to do it?

I'm under the impression that I'm bypassing unixODBC, but I am fairly new with this (cobol/odbc).  So I could be wrong.

ODBCng is no longer being developed, I'm not sure that that's the route I want to take for the future.  And convincing Higher Ups to go the commercial route would be difficult...

On Wed, Apr 7, 2010 at 4:14 PM, Jonah H. Harris <jonah.harris@gmail.com> wrote:
On Wed, Apr 7, 2010 at 3:27 PM, Jonathan Foy <thefoy@gmail.com> wrote:
I'm trying to configure the postgres odbc driver with our Acucobol application (5.2 and 8.1), and was hoping that someone out there might have some experience with this.

About two years ago I was working on a project which used Postgres via ODBC with both ACUCOBOL and Micro Focus.  Which ODBC driver are you using?  You should try ODBCng (https://projects.commandprompt.com/public/odbcng/).

Also, you may want to try/consider using the commercial PG ODBC driver from DataDirect (http://www.datadirect.com/products/odbc/odbc-postgresql/index.ssp).

--
Jonah H. Harris
Blog: http://www.oracle-internals.com/