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

ODBC connection from SAS #38

Open
gravesti opened this issue Oct 31, 2024 · 1 comment
Open

ODBC connection from SAS #38

gravesti opened this issue Oct 31, 2024 · 1 comment

Comments

@gravesti
Copy link

I'm trying to use DuckDB via ODBC in SAS 9.4.
I get this incomprehensible message. Any ideas?
Nothing in my system is in Chinese.

ERROR: CLI prepare error: ODBC_DuckDB->PrepareStmt
Parser Error: syntax error at or near "䕓䕌呃⨠䘠佒⁍剉卉"
LINE 1: 
       䕓䕌呃⨠䘠佒⁍剉卉 ††††††††
        ^

The full odbctrace is here: https://gist.github.com/gravesti/b7fba9755712ce223b7e2284aedc0453

@kksaohun
Copy link

kksaohun commented Oct 31, 2024

Hello! I'm trying to do the same, at this very moment :)

I have a bit more success, I managed to connect DuckDB to SAS, but only when running the SAS workspace (directly on Linux) with:

/sas/SASHome/SASFoundation/9.4/sas -nodms -encoding wlatin2

And I would need it in UTF-8.

What is your session encoding? What does

proc options option=encoding; run;

says for you?


More info about the setup that works for me:

odbcinst.ini:

[ODBC]
Trace = yes
TraceFile = /tmp/odbctrace

[DuckDB Driver]
Driver = /home/username/odbc.unixodbc/duckdb_odbc-linux-amd64/libduckdb_odbc.so
UsageCount  = 1

odbc.ini:

[DuckDB]
Driver=DuckDB Driver
Database=/tmp/duck2.db

The LIBNAME in SAS:

libname kk odbc noprompt="dsn=DuckDB;Database=/tmp/duck2.db;access_mode=read_only" autocommit=yes;

Then SQL:

proc sql;
select * from kk.foo;
quit;

But it works ONLY if proc options option=encoding; run; shows ENCODING=WLATIN2, and NOT when ENCODING=UTF-8.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants