469,077 Members | 1,424 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,077 developers. It's quick & easy.

Web Server Can't Connect to Sql Server

Hi,

I have two seperate production machines that I'm trying to get to play
nicely together.
This setup has worked for years before - until recently bother
machines were reformatted, and reinstalled fresh. I know I'm missing a
simple setting here somewhere...

I have a Win 2003 IIS 6.0 box running as web server, and a Win 2003
IIS 6.0 box running as a web server with SQL 2000 Server installed.

I can write ASP scripts to access the SQL Server but they only work
from the box running the SQL Server.

If I write ASP scripts to run from the first Win 2003 Web server,
trying to connect to the second box actually running the SQL Server it
gives an error:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC SQL Server Driver][Named Pipes]SQL Server does not
exist or access denied.

If I open up the ODBC Admin on the first Web Server box, and create a
System DSN, and supply it with a SQL Login (the SQL Server is set to
mixed authentication mode and not strictly windows authentication)
the login and test say they complete successfully. However, whenever I
run the ASP script, it errors out.

Example of Connection String that works on box running SQL but not on
first box that is trying to connect to SQL:

strSQL = "SELECT TOP 10 * FROM MAIN ORDER BY [Key] DESC;"

'Create and Open Connection Object
Set objConnection = Server.CreateObject("ADODB.Connection")
objConnection.ConnectionString =
"dsn=**********;uid=*********;pwd=********;"
'System DSN is established on the non-sql machine that this
script is running from
'uid & pwd are SQL accounts.
objConnection.Open

set RsList = objConnection.Execute(strSQL)
I'm sure I've left out vital peices of info here- so please let me
know what you need to know to offer advice.

Much thanks!
-xx75vulcan

Jun 18 '07 #1
6 5196
xx75vulcan (xx********@gmail.com) writes:
If I write ASP scripts to run from the first Win 2003 Web server,
trying to connect to the second box actually running the SQL Server it
gives an error:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC SQL Server Driver][Named Pipes]SQL Server does not
exist or access denied.
Maybe this article can give some clues?
http://support.microsoft.com/default...;EN-US;q328306.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Jun 18 '07 #2
On Jun 18, 4:34 pm, Erland Sommarskog <esq...@sommarskog.sewrote:
xx75vulcan (xx75vul...@gmail.com) writes:
If I write ASP scripts to run from the first Win 2003 Web server,
trying to connect to the second box actually running the SQL Server it
gives an error:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[Microsoft][ODBC SQL Server Driver][Named Pipes]SQL Server does not
exist or access denied.

Maybe this article can give some clues?http://support.microsoft.com/default...;EN-US;q328306.

--
Erland Sommarskog, SQL Server MVP, esq...@sommarskog.se

Books Online for SQL Server 2005 athttp://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books...
Books Online for SQL Server 2000 athttp://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
I've read that particular article somewhere before, and I believe I
have the settings/common problems correct.
I'm wondering, do I need to setup a "Linked Server" between the SQL
box and the web box not running SQL?

It appears that "linked servers" provide OLE DB providers and OLE DB
data sources?

Jun 19 '07 #3
ok I just noticed an event on the server (hosting SQL) event log when
attempting to connect from a seperate box.

Error:
An anonymous session connected from FREUDIANA has attempted to open an
LSA policy handle on this machine. The attempt was rejected with
STATUS_ACCESS_DENIED to prevent leaking security sensitive information
to the anonymous caller.

Upon further investigation, lead me to this MS KB: http://support.microsoft.com/kb/839569

Stating "Instead of allowing the anonymous connections to your
instance of SQL Server, you can grant the required access to a
specific SQL Server account and pass the logon credentials for the SQL
Server account in the connection string in the ASP.NET page. Using SQL
Server authentication avoids the anonymous connection attempts to the
instance of SQL Server and is more secure."

I'm passing the SQL login credentials in my connecton string, and the
ODBC manager specifies a SQL account -- why does it tell me it's
attempting an annonymous connection?!?!?!

Jun 19 '07 #4
On Jun 19, 8:40 am, xx75vulcan <xx75vul...@gmail.comwrote:
ok I just noticed an event on the server (hosting SQL) event log when
attempting to connect from a seperate box.

Error:
An anonymous session connected from FREUDIANA has attempted to open an
LSA policy handle on this machine. The attempt was rejected with
STATUS_ACCESS_DENIED to prevent leaking security sensitive information
to the anonymous caller.

Upon further investigation, lead me to this MS KB:http://support.microsoft.com/kb/839569

Stating "Instead of allowing the anonymous connections to your
instance of SQL Server, you can grant the required access to a
specific SQL Server account and pass the logon credentials for the SQL
Server account in the connection string in the ASP.NET page. Using SQL
Server authentication avoids the anonymous connection attempts to the
instance of SQL Server and is more secure."

I'm passing the SQL login credentials in my connecton string, and the
ODBC manager specifies a SQL account -- why does it tell me it's
attempting an annonymous connection?!?!?!

Also noticed the SQL server box is running ODBC SQL Driver
2000.85.1022.00 and the web box (that no asp page can connect through)
is running ODBC SQL Driver 2000.86.1830.00. do they need to be the
same driver version on both boxes?

Jun 19 '07 #5
On Jun 19, 10:27 am, xx75vulcan <xx75vul...@gmail.comwrote:
On Jun 19, 8:40 am, xx75vulcan <xx75vul...@gmail.comwrote:
ok I just noticed an event on the server (hosting SQL) event log when
attempting to connect from a seperate box.
Error:
An anonymous session connected from FREUDIANA has attempted to open an
LSA policy handle on this machine. The attempt was rejected with
STATUS_ACCESS_DENIED to prevent leaking security sensitive information
to the anonymous caller.
Upon further investigation, lead me to this MS KB:http://support.microsoft.com/kb/839569
Stating "Instead of allowing the anonymous connections to your
instance of SQL Server, you can grant the required access to a
specific SQL Server account and pass the logon credentials for the SQL
Server account in the connection string in the ASP.NET page. Using SQL
Server authentication avoids the anonymous connection attempts to the
instance of SQL Server and is more secure."
I'm passing the SQL login credentials in my connecton string, and the
ODBC manager specifies a SQL account -- why does it tell me it's
attempting an annonymous connection?!?!?!

Also noticed the SQL server box is running ODBC SQL Driver
2000.85.1022.00 and the web box (that no asp page can connect through)
is running ODBC SQL Driver 2000.86.1830.00. do they need to be the
same driver version on both boxes?
ANSWER:
I figured it out, but wanted to post for anyone else experiencing this
issue.
While this was a very very odd solution for me, it might just work for
you.

On the second box - that hosts SQL Server, IIS was running, and the
default.htm page - - for whatever reason, included a redirect to the
homepage on the primary server.

I can only assume the connection string (pointing to the sql box) was
being redirected to the primary server - where there was no sql
server.

chris

Jun 19 '07 #6
xx75vulcan (xx********@gmail.com) writes:
I've read that particular article somewhere before, and I believe I
have the settings/common problems correct.
I'm wondering, do I need to setup a "Linked Server" between the SQL
box and the web box not running SQL?
I see that you have sorted out your issue (and as I understand, the
answer was in the domain of web servers, where I know next to nothing),
but I still wanted to answer this.

No, linked servers is nothing about that. When you set up a linked server
in SQL Server, is when you want to access some other data source from
SQL Server. That data source could be another SQL Server, it could be
Oracle, it could be Excel. It could be anything that could be reached
with an OLE DB provider (and indirectly an ODBC driver). But linked servers
is nothing about access into SQL Server.
--
Erland Sommarskog, SQL Server MVP, es****@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx
Jun 19 '07 #7

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

13 posts views Thread by Fortepianissimo | last post: by
7 posts views Thread by CT | last post: by
8 posts views Thread by M K | last post: by
reply views Thread by Clodoaldo Pinto | last post: by
25 posts views Thread by _DD | last post: by
reply views Thread by zhoujie | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.