I cannot figure out the correct way of arranging the configuration files needed to connect to an external database from a Docker container. The whole thing is running on Windows, and the Docker is Debian, and I'm using FreeTDS as per this tutorial to make a connection. I've also been following suggestions in this SO question.
With the very helpful Flask debugger, I'm able to tell that I'm connecting to the server with the following connection string:
'DSN=server_name; DATABASE=db_name; UID=usr; PWD=pw'
These are the contents of my configuration files:
# odbcinst.ini in /etc/ and /
[FreeTDS]
Description = FreeTDS driver
Driver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
# odbc.ini in /etc/ and /root/.odbc.ini
[data_source]
Driver = FreeTDS
Servername = server_name
Port = 1433
Database = db_name
# freetds.conf in /etc/freetds/
[global]
tds version = 7.4
[server_name]
host = server_ip
port = 1433
[IM002] [unixODBC][Driver Manager]Data source name not found, and no default driver specified (0) (SQLDriverConnect)
However, I can connect to the database with the command line using tsql -H server_ip -p 1433 -U usr -P pw
. isql -v data_source username pwd
works too. osql
gives the following error:
path/libtdsodbc.so is not an executable file
osql: error: no driver found for data_source
I can't figure out the problem.. Doesn't help I'm pretty inexperienced with Linux as well. Any help is greatly appreciated!