Ubundu msodbcsq installation with robot framework

Hi all,

I try to use Azure DB from robot framework in Ubundu. I get following error message: (‘01000’, “[01000] [unixODBC][Driver Manager]Can’t open lib ‘SQL Server’ : file not found (0) (SQLDriverConnect)”)

In windows setup works fine.

I using DatabaseLibrary and “DB_MODULE_NAME” is “pyodbc”. I have installed DatabaseLibrary and pyodbc librarys to Ubundu. Also I have installed msodbcsql17 to Ubundu.

Have anyone have same issue and how you solve the issue?

Thanks.

Hi Jan,

I’ve not done this, but it seems the error you are getting is from pyodbc rather than robot framework.

Not sure if anyone here has experience with this, if there is take their advise over mine.

Failing that I suspect you’ll likely find more info around getting pyodbc to connect to Azure DB in python, so I’d suggest you try to get a basic python script to connect to your Azure DB database first, then from that you’ll probably be able to figure out what you need to change in the robot script

I did find Microsoft Azure documentation about connecting python to Azure DB with Ubuntu, so maybe start with this and their example sqltest.py code:

I note they list build-essential and gcc as a prerequisites so I guess you need to compile the Azure odbc driver? so follow their instructions on how to do that, depending on your hardware that may take a while.

Hopefully that helps,

Dave.

Thank you for you answer. I try to sqltest.py code and it working with same settings, what I am using robot framework code in DatabaseLibrary call. Only that driver settings is not made in DatabaseLibrary. Now there is only that module. Could I add that driver also somehow to DatabaseLibrary call?

Hi Jari,

Did a little digging and found this:

does the file /etc/odbcinst.ini exist on your machine?

I also found this :
https://marketsquare.github.io/Robotframework-Database-Library/#Connect%20To%20Database

If I’m reading correctly your connect to database should look something like this

       Connect To Database    pyodbc    ${DBName}    ${DBUser}    ${DBPass}    ${DBHost}    ${DBPort}    dbDriver=ODBC Driver 17 for SQL Server    dbConfigFile=/etc/odbcinst.ini

Not sure if either or both of dbDriver and dbConfigFile are needed or not?

Also dbDriver might need to be dbDriver={ODBC Driver 17 for SQL Server}?

And perhaps ${DBPass} needs to be {${DBPass}}? based on the link from my previous post.

Sorry at this point I’m not sure if I’m giving you good or bad info,

Dave.

Thank you for your help. Problem is fixing when added ‘dbDriver=ODBC Driver 17 for SQL’ parameter to connect to database command and also I change robotframework-databaselibrary version to 1.4.3. Before I had robotframework-databaselibrary==1.2.4 versin of library.

1 Like

i’m facing the same issue,

how did you pass the value for the dbDriver,

when i add the driver value as dbDriver=‘msodbcsql18’. i’m getting the following error

ValueError: invalid literal for int() with base 10: “dbDriver=‘msodbcsql18’”

Check your robotframework-databaselibrary version? Is that correct?

i have updated the database library, but now its giving me the previous error with the driver referenced. (msodbcsql18).

(‘01000’, “[01000] [unixODBC][Driver Manager]Can’t open lib ‘msodbcsql18’ : file not found (0) (SQLDriverConnect)”)

i checked bashrc mssql-tools18 is referenced.

#if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
#. /etc/bash_completion
#fi
export PATH=“$PATH:/opt/mssql-tools18/bin”

i think i’m making a mistake in the way i’m referencing the driver, my connection string is as follows

connect to database pyodbc ${DBName} ${DBUser} ${DBPass} ${DBHost} ${DBPort} dbDriver=msodbcsql18

am i missing anything or do i need use msodbcsql17

Hi, For 17 version “dbDriver=ODBC Driver 17 for SQL” connetion string is like that. I not experience of version 18, but you use string like: dbDriver=‘msodbcsql18’ is that correct format? Should that be dbDriver=ODBC Driver 18 for SQL" or something like that?

Hi Jari, Thanks for your quick response

I installed msodbcsql17 in a new Ubuntu instance with the database library as 1.4.4

the new connections string is

connect to database pyodbc ${DBName} ${DBUser} ${DBPass} ${DBHost} ${DBPort} dbDriver=ODBC Driver 17 for SQL

but i’m getting the following error

(‘01000’, “[01000] [unixODBC][Driver Manager]Can’t open lib ‘ODBC Driver 17 for SQL’ : file not found (0) (SQLDriverConnect)”)

You are a life saver Jari i tried with

dbDriver=ODBC Driver 17 for SQL Server

that fixed the issue, Many thanks