Re: ODBC isolationi level SQL_TXN_SERIALIZABLE -> "08001 Already connected." - Mailing list pgsql-odbc

From Tsunakawa, Takayuki
Subject Re: ODBC isolationi level SQL_TXN_SERIALIZABLE -> "08001 Already connected."
Date
Msg-id 0A3221C70F24FB45833433255569204D1F5F4C46@G01JPEXMBYT05
Whole thread Raw
In response to ODBC isolationi level SQL_TXN_SERIALIZABLE -> "08001 Already connected."  (Hong06 <honghe06@gmail.com>)
Responses Re: ODBC isolationi level SQL_TXN_SERIALIZABLE -> "08001 Already connected."
List pgsql-odbc
Hello,

Looking at the code, That seems to be a psqlODBC's bug.  psqlODBC tries to execute "SET SESSION ... ISOLATION LEVEL
..."upon the call to SQLSetSetConnectAttr(), which fails because the connection is not established yet.  The driver
shouldrun the SET query after establishing the connection.  FYI, even though SQLSetConnectAttr() for other isolation
levelsreturns SQL_SUCCESS, it doesn't set the isolation level correctly. 

The workaround is to call SQLSetConnectAttr() after SQLDriverConnect().  Anyway, I'll consider fixing the bug.

Regards
Takayuki Tsunakawa


> -----Original Message-----
> From: pgsql-odbc-owner@postgresql.org
> [mailto:pgsql-odbc-owner@postgresql.org] On Behalf Of Hong06
> Sent: Friday, September 30, 2016 10:41 PM
> To: pgsql-odbc@postgresql.org
> Subject: [ODBC] ODBC isolationi level SQL_TXN_SERIALIZABLE -> "08001
> Already connected."
>
> Hello everyone,
>
> I just ran into following issue with a big surprise that it does not work
> in ODBC.
>
> What I am doing is:
> - set the isolation level to: SQL_TXN_SERIALIZABLE
> - then connect to postgres database via ODBC function SQLDriverConnect()
>
> Example code:
>
>     ret = SQLSetConnectAttr(hDbc, SQL_ATTR_TXN_ISOLATION,
> (SQLPOINTER)SQL_TXN_SERIALIZABLE, SQL_IS_INTEGER);
>
>     ret = SQLDriverConnect(hConnect,
>                                   0,
>                                  (SQLCHAR*)connString,
>                                   ustrlen((unsigned char *)connString),
>                                   NULL,
>                                   0,
>                                   NULL,
>                                   SQL_DRIVER_NOPROMPT);
>
> Then SQLDriverConnect() returns -1 with error code: "08001 Already
> connected."
>
> With other isolation level like SQL_TXN_READ_COMMITTED, it works fine.
>
> Any idea to solve this problem? Or is this a Postgres ODBC bug? I couldn't
> find anything here or on Google.



pgsql-odbc by date:

Previous
From: Hong06
Date:
Subject: ODBC isolationi level SQL_TXN_SERIALIZABLE -> "08001 Already connected."
Next
From: Hong06
Date:
Subject: Re: ODBC isolationi level SQL_TXN_SERIALIZABLE -> "08001 Already connected."