Domanda

I have 2 computers that try to access a remote SQL server through a piece of code written in Classic ASP

Both of the computers are in the same LAN (therefor - same external IP address)

On computer A (which has Windows 7 installed) - the connection works fine, while on Computer B (with Windows 8) - I get the following error:

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied.

Both trying to run the script from a local IIS in the default website with the default Application Pool

I've tried enabling 32bit application to run on 64bit OS - didn't work

The code I'm trying to run is as simple as:

<%@ language="vbscript" codepage="65001" %>
<%  
session.CodePage = 65001

dim ServerName , sqlUser, sqlPasw, sqlDBName, Conn

ServerName  = "SERVER IP"
sqlUser     = "USER"
sqlPasw     = "PASSWPRD"
sqlDBName   = "DBNAME"


Set Conn = Server.CreateObject("ADODB.Connection")

Conn.Open "Driver={SQL Server};Server=" & Cstr(ServerName) & " ;Uid=" & Cstr(sqlUser) & ";Pwd=" & Cstr(sqlPasw) & ";Database=" & Cstr(sqlDBName)
Conn.Close

Set Conn = Nothing  

%>
È stato utile?

Soluzione

Finally I found the problem and it was ridiculous

The problem was the extra space here (before the Uid part of the connection string):

Conn.Open "Driver={SQL Server};Server=" & Cstr(ServerName) & " ;Uid=" & Cstr(sqlUser) & ";Pwd=" & Cstr(sqlPasw) & ";Database=" & Cstr(sqlDBName)

I have no idea why is this working on Windows 7 and not on Windows 8 - but that what happened

(According to Microsoft's documentation - trailing and opening whitespaces should be ignored - so the right behavior is the one that works)

If someone knows why is that - it would be nice to know

Thanks

Altri suggerimenti

Check firewall configuration on Windows 8. I had to disable it(firewall) on Win8 because no configuration changes help SQL to get through.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top