Re: iodbctestw with Homebrew psqlodbc not using W(ide) API calls, fails to connect - Mailing list pgsql-odbc

From Keith Wedinger
Subject Re: iodbctestw with Homebrew psqlodbc not using W(ide) API calls, fails to connect
Date
Msg-id DM6PR13MB23644221278CADB550AF4DCD9E712@DM6PR13MB2364.namprd13.prod.outlook.com
Whole thread Raw
In response to iodbctestw with Homebrew psqlodbc not using W(ide) API calls, fails to connect  (Keith Wedinger <keith.wedinger@improving.com>)
List pgsql-odbc

Thanks Jon. I came to this conclusion as well after building and running the tests on macOS. Specifically, I noticed that the tests by default run against the Unicode driver and all of the tests are passing. When I get some time, I want to dig into what’s going on inside iodbctestw.

 

Keith Wedinger | Principal Consultant | M. 614.551.0373
Improving – It’s what we do.™

 

 

From: Jon Raiford <raiford@labware.com>
Date: Thursday, October 3, 2024 at 1:22
PM
To: Keith Wedinger <keith.wedinger@improving.com>
Subject: Re: iodbctestw with Homebrew psqlodbc not using W(ide) API calls, fails to connect

This looks to be an iodbctestw issue and not a pgsqlodbc issue. It’s best to follow up with the iodbctest people and provide your trace file (or whatever else they need).

 

Jon

 

From: Keith Wedinger <keith.wedinger@improving.com>
Date: Wednesday, October 2, 2024 at 4:59
AM
To: pgsql-odbc@postgresql.org <pgsql-odbc@postgresql.org>
Subject: iodbctestw with Homebrew psqlodbc not using W(ide) API calls, fails to connect

After installing psqlodbc from Homebrew, I did the following to configure the DSNs:

 

~/.odbc.ini:

[homebrew-a-localhost]

Description = homebrew-a-localhost

Driver = /opt/homebrew/lib/psqlodbca.so

Servername = localhost

Port = 5432

Database = kwedinger

Username = kwedinger

Password = <omitted in this email>

Debug = 1

 

[homebrew-w-localhost]

Description = homebrew-w-localhost

Driver = /opt/homebrew/lib/psqlodbcw.so

Servername = localhost

Port = 5432

Database = kwedinger

Username = kwedinger

Password = <omitted in this email>

Debug = 1

 

When I run iodbctest DSN=homebrew-a-localhost to connect to my local PostgreSQL instance using the ANSI driver, all is well. I am presented with the SQL> prompt and I can run queries.

 

When I run iodbctestw DSN=homebrew-w-localhost to connect to the same local PostgreSQL instance using the Unicode driver, I see this:

iODBC Demonstration program

This program shows an interactive SQL processor

Driver Manager: 03.52.1623.0502

1: SQLDriverConnect = ??????????????????????????????????????????????� (101) SQLSTATE=??1

1: ODBC_Connect = ??????????????????????????????????????????????� (101) SQLSTATE=??1

 

When I look at the trace log, I see that the W(ide) APIs are not being used. The trace log is below.

Shouldn’t iodbctestw with a Unicode driver use the W(ide) APIs? Perhaps I am missing something inside .odbc.ini?

 

** iODBC Trace file

** Trace started on Tue Oct 01 10:57:44 2024

** Driver Manager: 03.52.1623.0502

 

 

[000000.000923]

iodbctestw      1E8507240 ENTER SQLAllocHandle

                                SQLSMALLINT       1 (SQL_HANDLE_ENV)

                                SQLHANDLE         0x0 (SQL_NULL_HANDLE)

                                SQLHANDLE       * 0x100e8c110

 

[000000.000946]

iodbctestw      1E8507240 EXIT  SQLAllocHandle with return code 0 (SQL_SUCCESS)

                                SQLSMALLINT       1 (SQL_HANDLE_ENV)

                                SQLHANDLE         0x0 (SQL_NULL_HANDLE)

                                SQLHANDLE       * 0x100e8c110 (0x600003894870)

 

[000000.000968]

iodbctestw      1E8507240 ENTER SQLSetEnvAttr

                                SQLHENV           0x600003894870

                                SQLINTEGER        200 (SQL_ATTR_ODBC_VERSION)

                                SQLPOINTER        0x3

                                SQLINTEGER      * -5 (SQL_IS_UINTEGER)

 

[000000.000992]

iodbctestw      1E8507240 EXIT  SQLSetEnvAttr with return code 0 (SQL_SUCCESS)

                                SQLHENV           0x600003894870

                                SQLINTEGER        200 (SQL_ATTR_ODBC_VERSION)

                                SQLPOINTER        0x3

                                SQLINTEGER      * -5 (SQL_IS_UINTEGER)

 

[000000.001019]

iodbctestw      1E8507240 ENTER SQLAllocHandle

                                SQLSMALLINT       2 (SQL_HANDLE_DBC)

                                SQLHANDLE         0x600003894870

                                SQLHANDLE       * 0x100e8c118

 

[000000.001052]

iodbctestw      1E8507240 EXIT  SQLAllocHandle with return code 0 (SQL_SUCCESS)

                                SQLSMALLINT       2 (SQL_HANDLE_DBC)

                                SQLHANDLE         0x600003894870

                                SQLHANDLE       * 0x100e8c118 (0x132604080)

 

[000000.001073]

iodbctestw      1E8507240 ENTER SQLSetConnectOption

                                SQLHDBC           0x132604080

                                SQLUSMALLINT      1051 (unknown connection attribute)

                                SQLLEN            4310203497

 

[000000.001094]

iodbctestw      1E8507240 EXIT  SQLSetConnectOption with return code 0 (SQL_SUCCESS)

                                SQLHDBC           0x132604080

                                SQLUSMALLINT      1051 (unknown connection attribute)

                                SQLLEN            4310203497

 

[000000.001115]

iodbctestw      1E8507240 ENTER SQLGetInfo

                                SQLHDBC           0x132604080

                                SQLUSMALLINT      171 (SQL_DM_VER)

                                SQLPOINTER        0x16ef7a4d1

                                SQLSMALLINT       255

                                SQLSMALLINT     * 0x16ef7a2d8

 

[000000.001145]

iodbctestw      1E8507240 EXIT  SQLGetInfo with return code 0 (SQL_SUCCESS)

                                SQLHDBC           0x132604080

                                SQLUSMALLINT      171 (SQL_DM_VER)

                                SQLPOINTER        0x16ef7a4d1

                                                                  | 03.52.1623.0502                          |

                                SQLSMALLINT       255

                                SQLSMALLINT     * 0x16ef7a2d8 (15)

 

[000000.001183]

iodbctestw      1E8507240 ENTER SQLDriverConnect

                                SQLHDBC           0x132604080

                                SQLPOINTER        0x0

                                SQLCHAR         * 0x16ef7a6f0

                                                                  | DSN=homebrew-w-localhost                 |

                                SQLSMALLINT       -3 (SQL_NTS)

                                SQLCHAR         * 0x100e8c12c

                                SQLSMALLINT       4096

                                SQLSMALLINT     * 0x16ef7a2da

                                SQLUSMALLINT      1 (SQL_DRIVER_COMPLETE)

 

[000000.015278]

iodbctestw      1E8507240 EXIT  SQLDriverConnect with return code -1 (SQL_ERROR)

                                SQLHDBC           0x132604080

                                SQLPOINTER        0x0

                                SQLCHAR         * 0x16ef7a6f0

                                SQLSMALLINT       -3 (SQL_NTS)

                                SQLCHAR         * 0x100e8c12c

                                SQLSMALLINT       4096

                                SQLSMALLINT     * 0x16ef7a2da

                                SQLUSMALLINT      1 (SQL_DRIVER_COMPLETE)

 

[000000.015310]

iodbctestw      1E8507240 ENTER SQLGetDiagRec

                                SQLSMALLINT       2 (SQL_HANDLE_DBC)

                                SQLHDBC           0x132604080

                                SQLSMALLINT       1

                                SQLCHAR         * 0x16ef7a041

                                SQLINTEGER      * 0x16ef7a03c

                                SQLCHAR         * 0x16ef7a050

                                SQLSMALLINT       512

                                SQLSMALLINT     * 0x0

 

[000000.015380]

iodbctestw      1E8507240 EXIT  SQLGetDiagRec with return code 0 (SQL_SUCCESS)

                                SQLSMALLINT       2 (SQL_HANDLE_DBC)

                                SQLHDBC           0x132604080

                                SQLSMALLINT       1

                                SQLCHAR         * 0x16ef7a041

                                                                  | ??1                                      |

                                SQLINTEGER      * 0x16ef7a03c (101)

                                SQLCHAR         * 0x16ef7a050

                                                                  | ???????????????????????????????????????? |

                                                                  | ??????�                                  |

                                SQLSMALLINT       512

                                SQLSMALLINT     * 0x0

 

[000000.015406]

iodbctestw      1E8507240 ENTER SQLGetDiagRec

                                SQLSMALLINT       2 (SQL_HANDLE_DBC)

                                SQLHDBC           0x132604080

                                SQLSMALLINT       2

                                SQLCHAR         * 0x16ef7a041

                                SQLINTEGER      * 0x16ef7a03c

                                SQLCHAR         * 0x16ef7a050

                                SQLSMALLINT       512

                                SQLSMALLINT     * 0x0

 

[000000.015481]

iodbctestw      1E8507240 EXIT  SQLGetDiagRec with return code 100 (SQL_NO_DATA_FOUND)

                                SQLSMALLINT       2 (SQL_HANDLE_DBC)

                                SQLHDBC           0x132604080

                                SQLSMALLINT       2

                                SQLCHAR         * 0x16ef7a041

                                SQLINTEGER      * 0x16ef7a03c

                                SQLCHAR         * 0x16ef7a050

                                SQLSMALLINT       512

                                SQLSMALLINT     * 0x0

 

 

Keith Wedinger | Principal Consultant | M. 614.551.0373
Improving – It’s what we do.™

 

pgsql-odbc by date:

Previous
From: Keith Wedinger
Date:
Subject: iodbctestw with Homebrew psqlodbc not using W(ide) API calls, fails to connect
Next
From: Abhishek Kumar
Date:
Subject: Linux binaries for psqlodbc. REL-17_00_0002