Web Development

General discussion


sql server connection problem

By fatsmm ·
i am using asp/vbscript to access an sql database
residing on another server. i get the following error :
Microsoft OLE DB Provider for SQL Server error '80004005'

[DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied.

/checkid_index.asp, line 25
given below is the code for checkid_index.asp
dim conn,rs,strsql
Set conn=Server.CreateObject("ADODB.Connection")

' Conn.connectionstring ="PROVIDER=SQLOLEDB;DATA SOURCE=;UID=jamea;PWD=jamea;DATABASE=reg_mumineen"
' Conn.connectionstring="driver={SQL Server};server=;uid=jamea;pwd=jamea;database=reg_mumineen"

'Network Library and port 1433
' conn.connectionstring = "Provider=sqloledb;Data Source=,1433;Network Library=DBMSSOCN;Initial Catalog=reg_mumineen;User ID=jamea;Password=jamea"

'Trusted connection:
conn.ConnectionString="Provider=SQLOLEDB; Data Source=;Initial Catalog=reg_mumineen; User ID=jamea; Password=jamea; Integrated Security=SSPI;"


error is on last line which is line 25
i have tried all ways possible but nothing works on my website although on localhost IIS 5, it works perfectly whichever string i use. connection is succefull and i can retrive data through stored procedures thereafter.

i have also used
conn.open varstring
where varstring is the connection string above.

only on website this does not work.
please pls help.

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

by ahar In reply to sql server connection pro ...

I'm almost sure this is a secutity-problem.
check your security-settings of the sql-server

Collapse -

by Haris In reply to sql server connection pro ...


The 80004005 error message indicates that your data cannot be accessed. When your ASP attempts to access database located on remote machine, the problem stem from the fact that ASP is operating in the context of the IUSR_MACHINE account. On servers that are not primary or backup domain controllers, the IUSR_MACHINE account is a local account. Since this local account is not recognized on the remote machine, access is denied to the database.

The 2 possible workarounds for this problem are:

1. Change the Anonymous Logon account on the IIS server from IUSR_MACHINE to a domain account that is recognized by both machines and has sufficient permissions to the resource. In addition, be sure that this account has the log on locally user right on the IIS machine. Recall that the Anonymous Logon account is configured through Internet Service Manager.

2. Add a local account to the remote machine that exactly matches the username and password of the IUSR_MACHINE account on the IIS machine, and give this account access to the database.

Also note that:
If IIS and SQL servers are in different domains, either a trust must be setup between the two domains or the IUSR_WEB account has to be added to the SQL domain.

A special license one-user license (per SQL Server) is necessary to allow unlimited Internet access.

If challenge authentication is enabled in IIS, it prevents logging onto remote SQL server. You will need to use basic authentication, or install SQL server on same server as IIS.

Collapse -

by KaptKos In reply to sql server connection pro ...

Try it this way:

Create your connection information:

Private Me.myConnection.ConnectionString = "data source=SQL;password="PASSWORD";initial catalog="CATALOGNAME";persist security info=False;user id="ID";packet size=4096"




Public Sub SetConnection(ByVal ConnStr As String)
Me.myConnection.ConnectionString = ConnStr
End Sub




Public Function RunQuery(ByVal InQuery As String) As Integer
Dim tempInteger As Integer = 0
myCommand.CommandText = InQuery
If myCommand.Connection.State = ConnectionState.Closed Then
myCommand.CommandTimeout =10000
End If

tempInteger = myCommand.ExecuteNonQuery()
If myCommand.Connection.State = ConnectionState.Open Then
End If
Catch E As Exception
If myCommand.Connection.State = ConnectionState.Open Then
End If
HandleError("DBCOM.RunQuery", InQuery, E.Message)
End Try
Return tempInteger
End Function

Collapse -

by radobson In reply to sql server connection pro ...

If you are using Integrated Security do not provide the UserName/Password.

Collapse -

by RRobles7999 In reply to sql server connection pro ...

You might want to take look aty this aticle on Microsoft Web site Article ID : 306518
It might help you out...

Collapse -

by san_on In reply to sql server connection pro ...

Check your LAN Settings .
Check for the proxy settings
it will not work on proxy

Related Discussions

Related Forums