Re: Fwd: Carto ODBC_FDW issue "ERROR: Connecting to driver" from PG to DB2

From: Steven Hirsch <snhirsch(at)gmail(dot)com>
To: karthik kumar <karthikkumar(dot)db2dba(at)gmail(dot)com>
Cc: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>, pgsql-general(at)postgresql(dot)org
Subject: Re: Fwd: Carto ODBC_FDW issue "ERROR: Connecting to driver" from PG to DB2
Date: 2018-04-11 18:33:01
Message-ID: alpine.DEB.2.20.1804111430240.4018@z87
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, 11 Apr 2018, karthik kumar wrote:

> Hello Adrian
>
> I built fdw with debug option and ran it with debug option.  Here is the output
>
> postgres=# select * from odbc_testt;
> DEBUG:  StartTransactionCommand
> DEBUG:  StartTransaction
> DEBUG:  name: unnamed; blockState:       DEFAULT; state: INPROGR, xid/subid/cid: 0/1/0, nestlvl: 1, children:
> DEBUG:  odbcGetForeignRelSize
> DEBUG:  odbcGetTableOptions
> DEBUG:  odbcGetOptions
> DEBUG:  extract_odbcFdwOptions
> DEBUG:  CONN STR: database=SAMPLE;DRIVER=SAMPLE;UID=db2inst1;PWD=db2inst1
> DEBUG:  Error result (-1): Connecting to driver
> ERROR:  Connecting to driver
>
> Looking at the code this is the place where the error is coming from:
>
> /* Allocate a connection handle */
>     SQLAllocHandle(SQL_HANDLE_DBC, *env, dbc);
>     /* Connect to the DSN */
>     ret = SQLDriverConnect(*dbc, NULL, (SQLCHAR *) conn_str.data, SQL_NTS,
>                            OutConnStr, 1024, &OutConnStrLen, SQL_DRIVER_COMPLETE);
>     check_return(ret, "Connecting to driver", dbc, SQL_HANDLE_DBC);
> }
>
> Trouble is, I can't get any unixodbc manual to indicate the meaning of -1.

Doesn't the DB2 driver have a debug/trace option you can turn on with an
environment variable? That may tell you more.

I'd also suggest you try connecting to the database from the same host
using the db2clp. That gets the FDW out of the picture and may give
better diagnostics.

--

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Adrian Klaver 2018-04-11 18:33:46 Re: Archiving Data to Another DB?
Previous Message karthik kumar 2018-04-11 18:22:00 Re: Fwd: Carto ODBC_FDW issue "ERROR: Connecting to driver" from PG to DB2