[sr-dev] [kamailio/kamailio] DB_UNIXODBC always changes language and context (#1993)
Ben Kaufman
notifications at github.com
Tue Jun 25 21:19:05 CEST 2019
### Description
Using DB_UNIXODBC with an Azure SQL database works, however when starting Kamailio, errors are shown for :
```
26(80403) ERROR: db_unixodbc [connection.c:219]: db_unixodbc_extract_error(): unixodbc:SQLDriverConnect=01000:3:5701:[Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Changed database context to 'database-name'.
ERROR: db_unixodbc [connection.c:219]: db_unixodbc_extract_error(): unixodbc:SQLDriverConnect=01000:2:5703:[unixODBC][Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Changed language setting to us_english.
```
Regarding changing the DB context, the database to be used is defined in my ```odbc.ini``` file
```
[dsnName]
Driver=ODBC Driver 17 for SQL Server
Description=Azure MS SQL Server
Trace=No
Server=tcp:azure-sql-server-name.database.windows.net,1433
Encrypt=yes
TrustServerCertificate=no
Connection Timeout=30
Database=databaseName
```
I'm not able to `USE databaseName` when connecting to an Azure DB. The default language is already US-English, and i'm guessing it's also Azure specific that it cannot be changed?
### Troubleshooting
I'm not sure what troubleshooting can be done with this. The DB connection works, it's just these commands that fail, but since the result is already correct, it doesn't seem to functionally matter, aside from the errors being thrown.
#### Reproduction
This can be reproduced using an Azure SQL database. Create a single database and a dedicated user (with db_owner membership), and configure the ODBC connection as above.
#### Debugging Data
I'm not sure any additional debugging information is available. I'm happy to provide anything specific requested.
#### Log Messages
```
26(80403) ERROR: db_unixodbc [connection.c:219]: db_unixodbc_extract_error(): unixodbc:SQLDriverConnect=01000:3:5701:[Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Changed database context to 'database-name'.
ERROR: db_unixodbc [connection.c:219]: db_unixodbc_extract_error(): unixodbc:SQLDriverConnect=01000:2:5703:[unixODBC][Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Changed language setting to us_english.
```
### Possible Solutions
I would suspect that a parameter could be added to the DB_UNIXODBC module to make each of these behaviors (changing database and changing language) optional. Default config would retain the existing behavior, so it's just an override if desired.
### Additional Information
* **Kamailio Version** - output of `kamailio -v`
```
version: kamailio 5.1.8 (x86_64/linux)
flags: STATS: Off, USE_TCP, USE_TLS, USE_SCTP, TLS_HOOKS, USE_RAW_SOCKS, DISABLE_NAGLE, USE_MCAST, DNS_IP_HACK, SHM_MEM, SHM_MMAP, PKG_MALLOC, Q_MALLOC, F_MALLOC, TLSF_MALLOC, DBG_SR_MEMORY, USE_FUTEX, FAST_LOCK-ADAPTIVE_WAIT, USE_DNS_CACHE, USE_DNS_FAILOVER, USE_NAPTR, USE_DST_BLACKLIST, HAVE_RESOLV_RES
ADAPTIVE_WAIT_LOOPS=1024, MAX_RECV_BUFFER_SIZE 262144 MAX_URI_SIZE 1024, BUF_SIZE 65535, DEFAULT PKG_SIZE 8MB
poll method support: poll, epoll_lt, epoll_et, sigio_rt, select.
id: unknown
compiled with gcc 6.3.0
```
* **Operating System**:
```
Debian Stretch:
4.19.0-0.bpo.4-cloud-amd64 #1 SMP Debian 4.19.28-2~bpo9+1 (2019-03-27) x86_64 GNU/Linux
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/kamailio/kamailio/issues/1993
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-dev/attachments/20190625/fa78523c/attachment.html>
More information about the sr-dev
mailing list