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

Loading OpenSSL causing error for ODBC driver #8

Closed
staples6 opened this issue Nov 9, 2022 · 3 comments
Closed

Loading OpenSSL causing error for ODBC driver #8

staples6 opened this issue Nov 9, 2022 · 3 comments

Comments

@staples6
Copy link

staples6 commented Nov 9, 2022

Loading OpenSSL is creating an issue for the MS SQL Server ODBC driver. Any help or guidance would be appreciated. Example below is ran with UBI8 minimal container image. ODBC works fine without OpenSSL loaded, but errors when it is loaded. Using msodbcsql17-17.9.1.1, but had same issue with various other versions of the SQL Server ODBC driver.

(@v1.8) pkg> st
Status `/usr/local/julia/depot/environments/v1.8/Project.toml`
  [be6f12e9] ODBC v1.1.2
  [4d8831e6] OpenSSL v1.3.1

julia> using ODBC

julia> conn = ODBC.Connection("driver=ODBC Driver 17 for SQL Server;pwd=$password;uid=$user;server=$server;database=$database");

julia> ODBC.disconnect!(conn)

julia> exit()
[root@0f4b46074e95 /]# julia
               _
   _       _ _(_)_     |  Documentation: https://docs.julialang.org
  (_)     | (_) (_)    |
   _ _   _| |_  __ _   |  Type "?" for help, "]?" for Pkg help.
  | | | | | | |/ _` |  |
  | | |_| | | | (_| |  |  Version 1.8.2 (2022-09-29)
 _/ |\__'_|_|_|\__'_|  |  Official https://julialang.org/ release
|__/                   |

julia> using ODBC, OpenSSL


julia> conn = ODBC.Connection("driver=ODBC Driver 17 for SQL Server;pwd=$password;uid=$user;server=$server;database=$database");
ERROR: 01000: [unixODBC][Driver Manager]Can't open lib '/opt/microsoft/msodbcsql17/lib64/libmsodbcsql-17.9.so.1.1' : file not found
Stacktrace:
 [1] error(s::String)
   @ Base ./error.jl:35
 [2] driverconnect(connstr::String)
   @ ODBC.API /usr/local/julia/depot/packages/ODBC/9VZTC/src/API.jl:111
 [3] connect
   @ /usr/local/julia/depot/packages/ODBC/9VZTC/src/API.jl:349 [inlined]
 [4] ODBC.Connection(dsn::String; user::Nothing, password::Nothing, extraauth::Nothing)
   @ ODBC /usr/local/julia/depot/packages/ODBC/9VZTC/src/dbinterface.jl:57
 [5] ODBC.Connection(dsn::String)
   @ ODBC /usr/local/julia/depot/packages/ODBC/9VZTC/src/dbinterface.jl:54
 [6] top-level scope
   @ REPL[3]:1

julia> versioninfo()
Julia Version 1.8.2
Commit 36034abf260 (2022-09-29 15:21 UTC)
Platform Info:
  OS: Linux (x86_64-linux-gnu)
  CPU: 2 × 12th Gen Intel(R) Core(TM) i7-12800H
  WORD_SIZE: 64
  LIBM: libopenlibm
  LLVM: libLLVM-13.0.1 (ORCJIT, goldmont)
  Threads: 1 on 2 virtual cores
@quinnj
Copy link
Member

quinnj commented Nov 28, 2022

Sorry for the slow response here; after doing a bit of research, I think what's going on is:

  • mssql odbc driver actually requires openssl 3.X
  • OpenSSL.jl loads a 1.1.X version of the library
  • When OpenSSL.jl loads 1.1.X, it prevents the auto-loading of a system openssl lib of 3.X version, which then causes teh odbc driver to have problems.

There currently isn't a binary-built 3.X version of openssl, so this is a bit tricky. I'm guessing if you did:

using ODBC
conn = ODBC.Connection(...)
using OpenSSL
conn = ODBC.Connection(...)

then both connections would work? So then the question would be if we can force the system openssl to be loaded, something like:

using ODBC, Libdl
Libdl.dlopen("libssl")
using OpenSSL
ODBC.Connection(...)

@staples6
Copy link
Author

Thanks so much for the suggestion! Forcing libssl to be loaded beforehand by using dlopen did the trick. Really appreciate you taking the time to look into it

@AbrJA
Copy link

AbrJA commented Dec 10, 2024

Does anyone know how to apply this trick but in an App with PackageCompiler.jl?

I have been trying to solve it because the integration between Oxygen.jl and ODBC.jl fails because Oxigen.jl depends on HTTP.jl and HTTP.jl depends on OpenSSL.jl

Any help or hint is welcome!

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

3 participants