ODBC.DSN(dsn, user, password) error: DSN not defined

hi, I have been using ODBC.DSN(dsn, user, password) to connect to oracle database using ODBC.jl (v0.8.1) and Julia 1.2.0 with no issue.

But when I upgraded to Julia 1.5.2 and ODBC (1.0.4), I got an error saying that DSN is not defined. The error did not disappear even I downgraded ODBC to v0.8.1. Can anybody advise me how I should resolve this issue?


api changed it seems

i figured that it could be case. so I looked through the documentation and here was what I tried. please tell me what I missed.

julia> ODBC.drivers()
Dict{String,String} with 2 entries:
“Oracle in OraClient11g_home1” => “APILevel=1\0CPTimeout=60\0ConnectFunctions=YYY\0DriverODBCVer=03.51\0FileUsage=0\0SQLLevel=1\0”
“SQL Server” => “APILevel=2\0ConnectFunctions=YYY\0CPTimeout=60\0DriverODBCVer=03.50\0FileUsage=0\0SQLLevel=1\0UsageCount=1\0”

julia> ODBC.dsns()
Dict{String,String} with 2 entries:
“test” => “Oracle in OraClient11g_home1”
“SES1” => “Oracle in OraClient11g_home1”

julia> ODBC.Connection(“test”, “user”,“password”)
ERROR: 28000: [Oracle][ODBC][Ora]ORA-01017: invalid username/password; logon denied

First all, I checked the source code and it seems that it is the right syntax. but I am also confident that my user/password are right. so what am I missing?

I’m having the same problem and I has been using Julia to connect to an Oracle database for months, but today it didn’t work. Something changed in ODBC because reverting to ODBC@1.0.0 allowed me to connect to the database again.

Please try

1 Like

What shikil says is correct, I use

using ODBC
ltname = "your_dsn"
psuser = "your_user"
pspwd = "your_password"
dsnr = ODBC.Connection(ltname, psuser, pspwd)

to create the connection handle dsnr which I use for any further ODBC actions.

I am using this to access an MS SQLserver database,

Thanks Shikil! your connection string works! Really appreciate the help!

thanks js135005. unfortunately, I tried that as well as shown in my example, but did not work. the problem was that instead of plainly telling me that connection string is wrong, ODBC issued a misleading error “invalid username/password” :frowning:

Here is my take on connecting to Oracle DB using Julia ODBC:

Hope this helps.

Most likely, this will work for you:

db = ODBC.Connection("DSN=<your DSN name>;Uid=<username>;Pwd=<password>")

Oh Shikil has already answered…

Ignore my duplicate.