Access Microsoft SQL Server on Windows Server

armchairexpert

New Member
Joined
Jul 16, 2024
Messages
3
Reaction score
2
Credits
32
Hi, I ran the following command on a new Linux Ubuntu 22.04 Server. It should connect to a SQL Server version 2012 on a Windows Server

sqlcmd -S <server-ip> -U <user> -P <password> -d <database>

I got the following errors on Linux:

Sqlcmd: Error Microsoft ODBC Driver 17 for SQL Server : TCP Prover: Error code 0x2746.
Sqlcmd: Error Microsoft ODBC Driver 17 for SQL Server : TCP Prover: Client unable to establish connection.

The SQL Server configuration is fine. TCP/IP is enabled. Firewall is off. Port 1433 is enabled.

I have attached my installation instructions on Linux. Can someone please help?

Thanks,

Rob
 

Attachments

  • Install SQL Server Tools on Ubuntu.txt
    1.4 KB · Views: 87


I had to look it up, it is a generic login error according to MS. First thing to see is does the server connect with other remote clients? If you had no errors in your installation and configuration then you need to make sure the server is running and accepting remote connections.
first thing is to ping the server to see if it is working
ping 182.18.1.171 assuming that is the IP you are supposed to be using. see if that works.

you can also take the entire error message and do a web search on it. you will find much there and most of it points to communication or server sided issue.
 
I had to look it up, it is a generic login error according to MS. First thing to see is does the server connect with other remote clients? If you had no errors in your installation and configuration then you need to make sure the server is running and accepting remote connections.
first thing is to ping the server to see if it is working
ping 182.18.1.171 assuming that is the IP you are supposed to be using. see if that works.

you can also take the entire error message and do a web search on it. you will find much there and most of it points to communication or server sided issue.
Thanks for your reply.

Yes, the server is running and accepting remote connections. Ping works.

Just tried the following.

tsql -S <server-ip> - U <user>

And then typed in the password. That worked. So, suspecting it could be an ODBC issues or something to do with the sqlcmd. Probably something is incompatible.
 
Thanks for your reply.

Yes, the server is running and accepting remote connections. Ping works.

Just tried the following.

tsql -S <server-ip> - U <user>

And then typed in the password. That worked. So, suspecting it could be an ODBC issues or something to do with the sqlcmd. Probably something is incompatible.
usually connecting to mysql or mssql is done with programs and not from command line. So I am assuming that you are writing a program? if not I would have to ask why you are connecting to any sql with command line. Seems very inefficient. ODBC is a possible but really this comes to the programming language you are wanting to use to get the end result. If you share that information it would be easier to help.
 
I am implementing a Blazor Server Application on Linux which access a Micrsoft SQL Server on a Windows Server. I was not sure why it was failing. Thought it could be the SQL connection and wanted to isolate the problem. That was the reason I wanted to see if the issue was a SQL connection problem and I was using sqlcmd. Looks like the problem is either ODBC or the sqlcmd itself. I am not sure.

When testing with the application again, I found out that the problem was related SSL.
 

Members online


Top