Score:0

Connecting from Linux to an SQL database server?

mx flag

Regarding some troubles connecting from Linux to an SQL Database Server. I read a variety of topics on this community and some DBA forums, but couldn't get it working.

Some background information: Trying to make a connection between an Ubuntu 20.04 server and two SQL Databases on a Windows Server 2019 server. Both databases are on the same named instance. There is no firewall limitation from the Linux side of this story.

I am not allowed to logon to this database server itself to check configuration and firewall but I can connect to the databases via SQL Server Management Studio from another Windows 2019 Server, both Windows as SQL authentication. I also can ping this database server on server name and IP. As far as I know TCPIP protocol is enabled on the SQL database server.

So I tried to connect with 'isql' from the Ubuntu server and I got this message:

[08001][unixODBC][RStudio][SqlServer] Failed to locate Server/Instance Specified

I installed the Ubuntu packages unixodbc and unixodbc-dev and then R-Studio Pro drivers, due to the fact that in the end R-Studio will make the connection with the SQL databases.

Next I copied the sample odbcinst.ini to /etc/ and configured the odbc.ini in the same folder. In that odbc.ini file I, in my opinion have tried every combination of IP-addresses, different port numbers, no ports mentioned at all, server name and instance name (both uppercase) with \ or /, [ server name,port number ] but still got that same error message.

I can not figure out whether this fail message with code [08001] is the same as an Error 26 Error locating server/instance specified (I think yes), but to me it seems everything should meet the requirements for connecting successfully, but it fails. Do I miss something or did I something wrong?

By the way: a quick test setup with an Ubuntu 18.04 server gave me a successful SQL connection to an serverless database in Azure, so something is wrong in my configuration or something is blocking my connection to or from that SQL Server. Do you have any suggestions or ideas I can look after?

Thanks in advance for responding and thinking along and kind regards,

Aad

in flag
It sounds to me like the SQL Server instance that you're connecting to does not permit connections from outside of the Azure IP range. If you would like to connect to the SQL Server instance from a physical machine, you will need to either convince the admin to permit external access from your IP (if you have a static one) or you will need to set up a simple relay in Azure to forward the requests from your machine to the SQL Server instance.
Aad Dijksman avatar
mx flag
Thanks for your reaction. Increasingly, I'm also beginning to suspect that the SQL Server is the limiting factor..... ping is possible, telnet is not. TCP-IP is enabled on the SQL Server but it seems that the databases must be accessed on ports other than default ..... to be continued ....
I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.