Moka5
Moka5


Testing remote SQL Server connectivity using SQLCMD   « Go Back

Troubleshooting SQL Server connectivity using SQLCMD, a Microsoft tool, is suggested to perform the test to remove doubt surrounding MokaFive's SQL Server support. Use a Microsoft client to connect to a Microsoft server.

SQLCMD also is installed with SQL Server but the connectivity test using SQLCMD should be executed from the host machine of the management server, so obtaining SQLCMD may be necessary if we need to test connectivity.

You may download if for free from Microsoft:
For SQL Server 2008 R2 get the appropriate "Microsoft® SQL Server® 2008 R2 Command Line Utilities" from here: http://www.microsoft.com/en-us/download/details.aspx?id=16978

Performing a remote SQL Server connectivity test using SQLCMD

Open a CMD prompt and run SQLCMD from the command line. Enter the appropriate hostname, port, database, and credentials appropriate to your deployment; these settings should be the values used by the management server so that we may validate them.

The command line parameters should be of the form:
C:\>sqlcmd -S tcp:<SQLSERVERHOSTNAME>,<SQLSERVERPORT> -d <DATABASENAME> -U <SQLSERVERUSERNAME> -P <SQLSERVERPASSWORD> -Q "SELECT GETDATE()"

The Microsoft JDBC driver Moka5 uses for connectivity does not support named pipes. Moka5 requires that the SQL Server instance is open on a static port and is allowing TCP connections.

See the SQLCMD help for more information about these command line parameters.

Example of a successful command:

C:\>SQLCMD -S tcp:mysqlserver.moka5qa.com,1433 -d M5ESDB -U moka5 -P mokafive -Q "SELECT GETDATE()"
-----------------------
2011-10-07 18:15:13.490
(1 rows affected)

The example above tests both networking to the SQL Server instance, authorization of the credentials, and authentication to the database.