2

Is there some easy cmd commands I can use to check if I can connect to my SQL Database Server? (windows computers).

Tom
  • 9,725
  • 3
  • 31
  • 48
Lealo
  • 331
  • 1
  • 3
  • 11
  • 3
    Powershell, wsscript, ping server to see if it's reachable, use odbc administrator add a connection and see if it connects... all methods which could check to see if server is reachable. – xQbert Jun 01 '17 at 14:19
  • Well I would like to avoid installing any software that I can - Beacuse I won´t use these computers with the database later - so I would have to uninstall everything once I have checked it is working – Lealo Jun 01 '17 at 14:25
  • 2
    all of the above are installed by default on windows computers (assuming supported versions) Powershell example: https://stackoverflow.com/questions/25682703/connect-to-sql-server-database-from-powershell wscript https://stackoverflow.com/questions/1366516/connect-to-mysql-5-0-database-using-pure-vbscript ODBC driver for sql server should be there by default as well... – xQbert Jun 01 '17 at 14:26

3 Answers3

3

Open your Notepad and save your file as .udl This is a Microsoft Data Link file extension. Double clik and enter your connection string. Click "Test Connection"

0

If a client has not sqlcmd, you could make a telnet to SQL port, for example, 1433

0

Posted this here originally: https://dba.stackexchange.com/questions/23704/easy-way-to-check-connectivity-to-sql-server-from-client/306016#306016

There are so many ways to check connectivity - I got tired of googling every time I needed to check SQL connectivity from Windows, macOS, linux; to help with that, I created a docker image to test SQL connectivity. It's very (very) basic and I will probably improve this overtime, but hopefully it saves people time. Ok, so to test SQL connectivity simply run this command:

docker run -it ssaadi/test-sql-conn

It will ask you for host name, instance, port etc and then will try to connect and run select @@servername or display error if it fails.

The script is created in python and uses pymssql for sql connection -- the very very basic source code can be found here: https://github.com/sameersaadi/test-sql-conn

sameer
  • 163
  • 2
  • 6