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

Can't connect to azure db (v1.0.0 #289

Closed
haavardhvarnes opened this issue Jun 3, 2020 · 7 comments
Closed

Can't connect to azure db (v1.0.0 #289

haavardhvarnes opened this issue Jun 3, 2020 · 7 comments

Comments

@haavardhvarnes
Copy link

I am using libmsodbcsql.17.dylib and get no errors when adding the driver and running ODBC.adddsn(...). Same error using connection string that have been working in previous version.

julia> using ODBC
julia> cn = ODBC.Connection(mydsn)
ERROR: Base.CodePointError{UInt32}(0x00380032)
Stacktrace:
[1] code_point_err(::UInt32) at ./char.jl:86
[2] Char at ./char.jl:160 [inlined]
[3] transcode(::Type{UInt8}, ::Array{UInt32,1}) at ./c.jl:286
[4] transcode at ./c.jl:292 [inlined]
[5] str(::Array{UInt32,1}, ::Int64) at /Users/havard/.julia/packages/ODBC/uLgtd/src/API.jl:58
[6] diagnostics(::ODBC.API.Handle) at /Users/havard/.julia/packages/ODBC/uLgtd/src/API.jl:545
[7] driverconnect(::String) at /Users/havard/.julia/packages/ODBC/uLgtd/src/API.jl:114
[8] connect at /Users/havard/.julia/packages/ODBC/uLgtd/src/API.jl:345 [inlined]
[9] ODBC.Connection(::String, ::Nothing, ::Nothing) at /Users/havard/.julia/packages/ODBC/uLgtd/src/dbinterface.jl:34
[10] ODBC.Connection(::String) at /Users/havard/.julia/packages/ODBC/uLgtd/src/dbinterface.jl:33
[11] top-level scope at none:0

@quinnj
Copy link
Member

quinnj commented Jun 3, 2020

Thanks for reporting! Can you try #290 and see if that at least prints the error correctly for us? You can get that code by doing ] add ODBC#jq/err

@haavardhvarnes
Copy link
Author

haavardhvarnes commented Jun 4, 2020 via email

@haavardhvarnes
Copy link
Author

Btw, I managed to connect to the same server using a windows pc though it crashed whole Julia when disconnecting SQL server (ODBC32.dll error). I will send a separate issue on it even though it might not be ODBC.jl error.

@quinnj
Copy link
Member

quinnj commented Jun 5, 2020

Ok, I think I tracked this down. It looks like the official Microsoft SQL Server ODBC driver was built against unixODBC (not iODBC which is default on osx). So just doing:

ODBC.setunixODBC()

then running ODBC.Connection worked for me. There might be other drivers that are already compatible w/ iODBC (sounds like openlink and freetds both might have options), so you can go down that route if needed.

In terms of a "fix" here, I'm not sure what we can do. I don't think there's a way to detect whether a driver was built against iODBC vs. unixODBC. I'll add a note to the docs to maybe try something like this and probably mention SQL server on OSX specifically since that seems like a common gotcha.

@quinnj
Copy link
Member

quinnj commented Jun 5, 2020

Ok, I put up a PR that tries to point out the issue in the docs everywhere: #293

@haavardhvarnes
Copy link
Author

Thx it worked! Though I had to use adddsn() because connection string still does not work. Anyhow, I am happy to use dsn

@quinnj
Copy link
Member

quinnj commented Jun 5, 2020

Could you share what you're seeing w/ the connection string? That's how I connected. Maybe check https://www.connectionstrings.com/microsoft-odbc-driver-17-for-sql-server/ for reference?

@quinnj quinnj closed this as completed in e8c158f Jun 5, 2020
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