title: [DBNETLIB][ConnectionOpen (PreLoginHandshake()).]General network error - connecting to SQL database in VB script
body: <p>I have a VB script which connects to a local SQL database to retrieve a value. The exact same script runs on about 100 servers, but a few of the servers produce this error:</p>
  
  <p>[DBNETLIB][ConnectionOpen (PreLoginHandshake()).]General network error. Check your network documentation</p>
  
  <p>Here is the code that runs:</p>
  
  <pre><code>Function GetPrimaryServerID
  On Error Resume Next
  Set objConnection = CreateObject("ADODB.Connection")
  Set objRecordSet = CreateObject("ADODB.Recordset")
  objConnection.Open "Provider=SQLOLEDB;Data Source=127.0.0.1;Initial Catalog=xxx;User ID=xxx;Password=xxx"
  sqlquery = "SELECT ServerID FROM tblSettings"
  objRecordSet.Open sqlquery,objConnection
  objRecordSet.MoveFirst
  GetPrimaryServerID = objRecordSet("ServerID")
  objRecordSet.Close
  objConnection.Close 
  End Function
  </code></pre>
  
  <p>The error occurs on the 5th line when trying to open the connection string. I'm confused as to why this script is working on nearly all servers and failing on only a handful. The database that they connect to is identical on every server in terms of structure, its only the data that changes. </p>