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