# Ubundu msodbcsq installation with robot framework

**URL:** https://forum.robotframework.org/t/ubundu-msodbcsq-installation-with-robot-framework/6636
**Category:** DatabaseLibrary
**Created:** [10 January 2024 12:33 UTC](https://forum.robotframework.org/t/ubundu-msodbcsq-installation-with-robot-framework/6636 "2024-01-10T12:33:15Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![JariTynkkynen](https://avatars.discourse-cdn.com/v4/letter/j/8baadc/32.png) [@JariTynkkynen](https://forum.robotframework.org/u/JariTynkkynen)
#### Post date: [10 January 2024 12:33 UTC](https://forum.robotframework.org/t/ubundu-msodbcsq-installation-with-robot-framework/6636/1 "2024-01-10T12:33:15Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![damies13](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/damies13/32/623_2.png) [@damies13](https://forum.robotframework.org/u/damies13)
#### Post date: [10 January 2024 13:13 UTC](https://forum.robotframework.org/t/ubundu-msodbcsq-installation-with-robot-framework/6636/2 "2024-01-10T13:13:27Z")

</div>

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:

> **[Use Python to query a database - Azure SQL Database & Azure SQL Managed...](https://learn.microsoft.com/en-us/azure/azure-sql/database/connect-query-python?view=azuresql)**
>
> This article shows you how to use Python to create a program that connects to a database in Azure SQL Database and query it using Transact-SQL statements.

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.

---

<div class="post-metadata">

### Author: ![JariTynkkynen](https://avatars.discourse-cdn.com/v4/letter/j/8baadc/32.png) [@JariTynkkynen](https://forum.robotframework.org/u/JariTynkkynen)
#### Post date: [10 January 2024 14:37 UTC](https://forum.robotframework.org/t/ubundu-msodbcsq-installation-with-robot-framework/6636/3 "2024-01-10T14:37:43Z")

</div>

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?

---

<div class="post-metadata">

### Author: ![damies13](https://dub1.discourse-cdn.com/flex005/user_avatar/forum.robotframework.org/damies13/32/623_2.png) [@damies13](https://forum.robotframework.org/u/damies13)
#### Post date: [10 January 2024 15:29 UTC](https://forum.robotframework.org/t/ubundu-msodbcsq-installation-with-robot-framework/6636/4 "2024-01-10T15:29:21Z")

</div>

Hi Jari,

Did a little digging and found this:

> **[Connecting to SQL Server from Linux](https://github.com/mkleehammer/pyodbc/wiki/Connecting-to-SQL-Server-from-Linux)**
>
> Python ODBC bridge. Contribute to mkleehammer/pyodbc development by creating an account on GitHub.

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

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

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

```python
       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.

---

<div class="post-metadata">

### Author: ![JariTynkkynen](https://avatars.discourse-cdn.com/v4/letter/j/8baadc/32.png) [@JariTynkkynen](https://forum.robotframework.org/u/JariTynkkynen)
#### Post date: [10 January 2024 17:50 UTC](https://forum.robotframework.org/t/ubundu-msodbcsq-installation-with-robot-framework/6636/5 "2024-01-10T17:50:32Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![centralcrayon](https://avatars.discourse-cdn.com/v4/letter/c/ee7513/32.png) [@centralcrayon](https://forum.robotframework.org/u/centralcrayon)
#### Post date: [8 March 2024 10:32 UTC](https://forum.robotframework.org/t/ubundu-msodbcsq-installation-with-robot-framework/6636/7 "2024-03-08T10:32:14Z")

</div>

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’”

---

<div class="post-metadata">

### Author: ![JariTynkkynen](https://avatars.discourse-cdn.com/v4/letter/j/8baadc/32.png) [@JariTynkkynen](https://forum.robotframework.org/u/JariTynkkynen)
#### Post date: [8 March 2024 11:29 UTC](https://forum.robotframework.org/t/ubundu-msodbcsq-installation-with-robot-framework/6636/8 "2024-03-08T11:29:30Z")

</div>

Check your robotframework-databaselibrary version? Is that correct?

---

<div class="post-metadata">

### Author: ![centralcrayon](https://avatars.discourse-cdn.com/v4/letter/c/ee7513/32.png) [@centralcrayon](https://forum.robotframework.org/u/centralcrayon)
#### Post date: [8 March 2024 12:10 UTC](https://forum.robotframework.org/t/ubundu-msodbcsq-installation-with-robot-framework/6636/9 "2024-03-08T12:10:34Z")

</div>

> [@JariTynkkynen](#):
>
> robotframework-databaselibrary

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

---

<div class="post-metadata">

### Author: ![JariTynkkynen](https://avatars.discourse-cdn.com/v4/letter/j/8baadc/32.png) [@JariTynkkynen](https://forum.robotframework.org/u/JariTynkkynen)
#### Post date: [8 March 2024 12:19 UTC](https://forum.robotframework.org/t/ubundu-msodbcsq-installation-with-robot-framework/6636/10 "2024-03-08T12:19:16Z")

</div>

> [@JariTynkkynen](#):
>
> dbDriver=ODBC Driver 17 for SQL

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?

---

<div class="post-metadata">

### Author: ![centralcrayon](https://avatars.discourse-cdn.com/v4/letter/c/ee7513/32.png) [@centralcrayon](https://forum.robotframework.org/u/centralcrayon)
#### Post date: [8 March 2024 12:51 UTC](https://forum.robotframework.org/t/ubundu-msodbcsq-installation-with-robot-framework/6636/11 "2024-03-08T12:51:58Z")

</div>

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)”)

---

<div class="post-metadata">

### Author: ![centralcrayon](https://avatars.discourse-cdn.com/v4/letter/c/ee7513/32.png) [@centralcrayon](https://forum.robotframework.org/u/centralcrayon)
#### Post date: [8 March 2024 12:58 UTC](https://forum.robotframework.org/t/ubundu-msodbcsq-installation-with-robot-framework/6636/12 "2024-03-08T12:58:01Z")

</div>

You are a life saver Jari i tried with

dbDriver=ODBC Driver 17 for SQL Server

that fixed the issue, Many thanks
