Native Client error connecting with SQLCMD

  • Hello, all. I've run into an odd problem where I'm running scripts using the sqlcmd utility. As long as the scripts are "original", meaning that they are run directly from a DOS batch file using sqlcmd they run without a problem. However I have an embedded invocation of sqlcmd using xp_cmdshell and when the script hits that I get the following:

    HResult 0xFFFFFFFF, Level 16, State 1

    SQL Network Interfaces: Error Locating Server/Instance Specified [xFFFFFFFF].

    Sqlcmd: Error: Microsoft SQL Native Client : An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections..

    Sqlcmd: Error: Microsoft SQL Native Client : Login timeout expired.

    The other scripts and other parts of this script use xp_cmdshell without a problem, so xp_cmdshell is enabled. This same set of scripts works without a hitch on SQL Server instances on other machines. The SQL Browser service on the offending machines (there are two) is running and active, as is the SQL Server instance. I can run everything from the command line using sqlcmd. TCP/IP and named pipes are both enabled on the problem machines and I have been over and over the configuration settings. The machines are, indeed, configured to allow remote connections using TCP/IP. The login credentials I provide in the script are valid and can be used to run the script from the command line.

    I'm having a conceptual problem with the idea that I can run sqlcmd from the command line without a problem but, at least on this machine, when I attempt to run it from inside a script using xp_cmdshell it bombs. Again, this process works reliably on other machines.

    I'm beginning to suspect that there is something hinky with the OS. The OS on the two problem machines came from the same image but the SQL Server was installed from DVD on both by someone who knows what he is doing and I have verified the configuration and it looks OK. I'll probably have to eat crow over that statement. :w00t:

    Anyone have any ideas on this one?

    Thanks.

    Don

    Edit: I just thought of something. These machines are choking on this because a script that is running from sqlcmd is attempting to execute other scripts using sqlcmd. It's almost as if these machines can't run more than one sqlcmd session at a time.

  • :blush: OK, I'll freely admit that I'm an idiot. It turns out that the SQL Network Interfaces line told the entire story. The command literally couldn't find the server because the server/instance name passed to it was incorrect. The details are sordid and all I can say is that the error predates me, but I still missed it. D'oh!

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply