Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQLDriverConnect() error #460

Open
danilabagroff opened this issue Nov 24, 2024 · 0 comments
Open

SQLDriverConnect() error #460

danilabagroff opened this issue Nov 24, 2024 · 0 comments
Labels

Comments

@danilabagroff
Copy link

danilabagroff commented Nov 24, 2024

Describe the bug

SQLDriverConnect() returns SQL_ERROR in the test console app. The only one thing in logs is different and probably the clue, but I have not found a way to change this behavior.:

  • UNICODE Using encoding ASCII 'UTF-8' and UNICODE 'UCS-2-INTERNAL
  • UNICODE Using encoding ASCII 'US-ASCII' and UNICODE 'UCS-2-INTERNAL'

btw: Unfortunately, I could not configure additional logging by ClickHouse driver with DriverLog and DriverLogFile options.

Steps to reproduce

  1. Run isql "Driver={ClickHouse};Server=localhost;Port=8123;Database=temp1;UID=user;PWD=password;" -k -v
  2. Run minimal reproducible example (code is bellow)
  3. Compare odbc logs

Expected behaviour

SQLDriverConnect() returns SQL_SUCCESS

Code example

SQLHENV environment(nullptr);
SQLHDBC connection(nullptr);

SQLAllocEnv(&environment);
SQLAllocConnect(environment, &connection);

std::string connection_string = "Driver={ClickHouse};Server=localhost;Port=8123;Database=temp1;UID=user;PWD=password;";
SQLRETURN retcode = SQLDriverConnect(connection, nullptr, (SQLCHAR*)connection_string.c_str(), SQL_NTSL, nullptr, 0, 0, SQL_DRIVER_NOPROMPT);

Error log

isql:

[ODBC][49920][1732438356.010762][__handles.c][493]
		Exit:[SQL_SUCCESS]
			Environment = 0x159817200
[ODBC][49920][1732438356.011091][SQLAllocHandle.c][469]
		Entry:
			Handle Type = 2
			Input Handle = 0x159817200
[ODBC][49920][1732438356.011192][SQLAllocHandle.c][585]
		Exit:[SQL_SUCCESS]
			Output Handle = 0x149809200
[ODBC][49920][1732438356.011255][SQLDriverConnect.c][751]
		Entry:
			Connection = 0x149809200
			Window Hdl = 0x0
			Str In = [Driver={ClickHouse};Server=localhost;Port=8123;Database=temp1;UID=user;PWD=***;][length = 78 (SQL_NTS)]
			Str Out = 0x16bb98fdf
			Str Out Max = 2048
			Str Out Ptr = 0x0
			Completion = 0
		Threading Level set from Driver Entry in ODBCINST.INI 99 from '99'

		Threading Level set from [ODBC] Section in ODBCINST.INI 0 from '0'

		UNICODE Using encoding ASCII 'UTF-8' and UNICODE 'UCS-2-INTERNAL'

[ODBC][49920][1732438356.026182][SQLDriverConnect.c][1810]
		Exit:[SQL_SUCCESS]
			Connection Out [Driver={ClickHouse};Server=localhost;Port=8123;Database=temp1;UI...]

Test Console App:

[ODBC][55100][1732442222.332191][__handles.c][493]
		Exit:[SQL_SUCCESS]
			Environment = 0x14e00b800
[ODBC][55100][1732442222.858274][SQLAllocHandle.c][469]
		Entry:
			Handle Type = 2
			Input Handle = 0x14e00b800
[ODBC][55100][1732442222.858643][SQLAllocHandle.c][585]
		Exit:[SQL_SUCCESS]
			Output Handle = 0x14d836600
[ODBC][55100][1732442225.759668][SQLDriverConnect.c][751]
		Entry:
			Connection = 0x14d836600
			Window Hdl = 0x0
			Str In = [Driver={ClickHouse};Server=localhost;Port=8123;Database=temp1;UID=user;PWD=***;][length = 78 (SQL_NTS)]
			Str Out = 0x16fdfb69f
			Str Out Max = 2048
			Str Out Ptr = 0x0
			Completion = 0
		Threading Level set from Driver Entry in ODBCINST.INI 99 from '99'

		Threading Level set from [ODBC] Section in ODBCINST.INI 0 from '0'

		UNICODE Using encoding ASCII 'US-ASCII' and UNICODE 'UCS-2-INTERNAL'

		DIAG [H] 

[ODBC][55100][1732442225.912023][SQLDriverConnect.c][1718]
		Exit:[SQL_ERROR]`

Environment

  • Driver version:
    • 1.2.1.20220905(brew)
    • 1.3.0.20241018(official release from github)
    • manually compiled current master with CMAKE_BUILD_TYPE=Debug
[ClickHouse]
Description = ClickHouse ODBC Driver
#Driver = /opt/homebrew/lib/libclickhouseodbcw.dylib
#Setup = /opt/homebrew/lib/libclickhouseodbcw.dylib
##Driver = /usr/local/lib/libclickhouseodbcw.dylib
##Setup = /usr/local/lib/libclickhouseodbcw.dylib
Driver = /Users/danilabagroff/OpenSource/clickhouse-odbc/build/driver/libclickhouseodbcw.dylib
Setup = /Users/danilabagroff/OpenSource/clickhouse-odbc/build/driver/libclickhouseodbcw.dylib
UsageCount = 1
DriverLog=yes
DriverLogFile=/opt/homebrew/var/log/clickhouse-odbc-driver.log
  • OS: macOS 14.7
  • ODBC Driver manager: 2.3.12

ClickHouse server

  • ClickHouse Server version: 24.12.1.14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant