Error 0x80131904, I need some help with connection string.

  • Hello everyone.
    My friend has a server at home, doing some work with accounting with an SQL custom client software. It was working just fine like 1.5 - 2 years but recently power went out for an hour and his client software is unable to detect this server since. Server's service is started and working just fine, OS is Windows 7 Ultimate x64. I'm able to load databases in SQL server studio but can't seem to figure out what is going on here, my guess is: connection string needs to be modified but I have no idea how, and also, before anyone points out, I did fair amount of googling but this forum is best I could find.
    Maybe any one of you can help?

    This is the message client software displays after attempted login:
     
    " Unable to open database. Connection string: 'data source=192.168.100.16;user id=sa;password=Holding01;initial catalog=DMS2;Persist Security Info=true;'; Error: 'System.Data.SqlClient.SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: Named Pipes Provider, error: 40 - Could not open a connection to SQL Server)
     at System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection)
     at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning()
     at System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity)
     at System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, SqlConnection owningObject)
     at System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout)
     at System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance)
     at System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance)
     at System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection)
     at System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options)
     at System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject)
     at System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject)
     at System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject)
     at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)
     at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)
     at System.Data.SqlClient.SqlConnection.Open()
     at DevExpress.Xpo.DB.MSSqlConnectionProvider.CreateDataBase(SqlConnection conn)' "

  • Just wanted to add, I've checked SQL server manager and I think everything's properly configured, at least TCP/IP-s correct, it's 192.168.100.16.
    Port is also clears, it's aenabled in Windows Firewall.

  • *port also clears,
    sorry for the typo

  • Without any connection to SQL Server it is tough to debug.  About the only thing you have access to is to view the errorlog in notepad.  It will list your networks and ports that are good.

    C:\Program Files\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\Log\ERRORLOG

    Try disabling the firewall.  Try interactively connecting by using "ODBC Database Connection Manager".  Try using integrated security.  Try connecting with "." as the default server name so it tries named pipes instead of TCP/IP.  Try other applications that used to connect to other databases in the server.  Change the initial catalog to master.

  • you sure the IP is correct?  I've seen servers change IP's after reboot.  

    Can you connect to that via SSMS?

    First try connecting via SSMS from the machine hosting the SQL instance.  If that succeeds, try a secondary machine on the same network.
    If they both succeed, then I'd say the software is not connecting the way you expect.

    You also say that TCP/IP is configured correctly, but the software is using named pipes (as per the error - provider: Named Pipes Provider).  Can you verify named pipes is configured correctly OR can you change the software to use TCP/IP instead of named pipes?

    Looking at that, my best guess is still the IP address not being correct.  I'm assuming you have a DNS server, why not use the machine name instead of IP and that way your DNS controller and DHCP server don't need special reservations for that one machine?

    Last thought - is this a named instance?  If so, try providing the name and/or port instead of relying on the default.

    The above is all just my opinion on what you should do. 
    As with all advice you find on a random internet forum - you shouldn't blindly follow it.  Always test on a test server to see if there is negative side effects before making changes to live!
    I recommend you NEVER run "random code" you found online on any system you care about UNLESS you understand and can verify the code OR you don't care if the code trashes your system.

Viewing 5 posts - 1 through 4 (of 4 total)

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