racket / db

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

odbc-driver-connect get error when the connection-string contains unicode characters

WuTianyiDev opened this issue · comments

Environment:
Win10 1709
Racket v7.9[cs]

Description
I try to use odbc-driver-connect to connect to the sql server database (version 11.0.33000.0), when the connection-string contains unicode characters, an error occurs and report SQLSTATE: 28000
For example, run following code

(require db)
(define c 
 (odbc-driver-connect "DRIVER={ODBC Driver 17 for SQL Server};DATABASE=数据库名;SERVER=localhost;UID=sa;PWD=thepassword"))
(query c "select 1")

then return

odbc-driver-connect: [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]?û? 'sa' ??¼ʧ?ܡ?
SQLSTATE: 28000

I tried to use #:character-mode'utf-8 but it doesn't work. How to use unicode characters in the connection string?

I've pushed a change to use the "wide-char" version of SQLDriverConnect on Windows. Can you try that and see if it works? (It should be in a nightly build tomorrow.)

I've pushed a change to use the "wide-char" version of SQLDriverConnect on Windows. Can you try that and see if it works? (It should be in a nightly build tomorrow.)

It works, thank you!