0

Currently we are manually running the scripts in SQL Server. We are trying to automate this execution by using Nexus repository. We are able to successfully create workflows using Nolio agent but while executing the workflows sqlcmd is throwing error as below :

Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : Login timeout expired. Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : TCP Provider: Error code 0x2AF9. Sqlcmd: Error: Microsoft ODBC Driver 17 for SQL Server : A network-related or instance-specific error has occurred while establishing a connection to SQL Server. Server is not found or not accessible. Check if instance name is correct and if SQL Server is configured to allow remote connections. For more information see SQL Server Books Online..

We are able to successfully run this process via putty but getting error only when we run using nexus repository by triggering Nolio agent. Any idea what am I doing wrong here?

Dale K
  • 25,246
  • 15
  • 42
  • 71
JKC
  • 2,498
  • 6
  • 30
  • 56
  • 1
    Are you using named instances? e.g.: `sqlcmd -S ServerNameOrIpAddress\\InstanceName` (double backslashes on most Linux shells)? `Error code 0x2AF9` suggests that may be the case. The SQL Browser service on the target server must be accessible on udp/1434 (as opposed to tcp/1434) so that the `InstanceName` can be resolved to the TCP port number that instance is actually listening on. The client can then connect on that TCP port number to execute SQL Query. Likewise that TCP port number must also be accessible on the target server. – AlwaysLearning Jun 15 '22 at 10:06
  • Thanks @AlwaysLearning yes I am using named instances. The command that I use goes like this “sqlcmd -S server_name\instance_name -E” – JKC Jun 16 '22 at 04:52
  • In most Linux shells make sure you double the backslashes (escape them). e.g.: `echo server_name\instance_name` would print `server_nameinstance_name` to the console, `echo server_name\\instance_name` prints `server_name\instance_name`. The implication is that using `sqlcmd -S server_name\instance_name -E` in the shell is trying to connect to a server named `server_nameinstance_name`. – AlwaysLearning Jun 16 '22 at 05:41
  • Also, the `-E` switch is for trusted connections, meaning Windows/Active Directory authentication. Unless your machine is a member of the same Active Directory as the SQL server you're targeting it's unlikely to authenticate. – AlwaysLearning Jun 16 '22 at 05:43

0 Answers0