Age-old "SQL Server does not exist" error

R

Roy

Judging from the sheer number of posts on this topic, I'm sensing this
is a fairly common problem. Only problem is, I've tried just about
every recommendation in all the posts I've found thus far and none have
worked.

I have XP on my workstation and two servers that run server 2003.
I have sql server dev edition on all 3, but only VS.NET on my
workstation.
I have .NET framework 1.1 on all 3 machines.

I can connect/interact just fine with the SQL Server instances on both
servers using EM, Query Analyzer, and VS.NET "server explorer."
However, pages I make on my workstation that connect to SQL Server on
either of the two servers fail to work. If I take the EXACT same pages
and run them on either server, they work fine.

The error I get is "Exception Details:
System.Data.SqlClient.SqlException: SQL Server does not exist or access
denied." I strongly suspect that this is a security issue, but I don't
know how to resolve it. I've given (as per other posts) the usernames
ASPNET and NETWORK SECURITY broad rights on all sql server instances,
yet still I can't run a webpage on my workstation that connects. It's
infuriating. Help!


Behold my latest connection string (since I know some of you will want
to see it anyways... ;-)
Dim MyConnection As New
SqlConnection("server=testserver;uid=test;pwd=pass;database=adp")

I've tried using IP's in place of the server name and all. I truly
think this is some obscure security issue...
 
L

Lucas Tam

SqlConnection("server=testserver;uid=test;pwd=pass;database=adp")

I've tried using IP's in place of the server name and all. I truly
think this is some obscure security issue...

Try appending the SQL server port number to the address (1433)

so:

SqlConnection("server=testserver,1433;uid=test;pwd=pass;database=adp")

For some reason I had to do that at work... or else I couldn't connect...
 
R

Roy

heh
Took the words outta my mouth Lucas...

I tried hardcoding the port as you suggested. Still no go. :-/
 
V

vMike

Roy said:
Judging from the sheer number of posts on this topic, I'm sensing this
is a fairly common problem. Only problem is, I've tried just about
every recommendation in all the posts I've found thus far and none have
worked.

I have XP on my workstation and two servers that run server 2003.
I have sql server dev edition on all 3, but only VS.NET on my
workstation.
I have .NET framework 1.1 on all 3 machines.

I can connect/interact just fine with the SQL Server instances on both
servers using EM, Query Analyzer, and VS.NET "server explorer."
However, pages I make on my workstation that connect to SQL Server on
either of the two servers fail to work. If I take the EXACT same pages
and run them on either server, they work fine.

The error I get is "Exception Details:
System.Data.SqlClient.SqlException: SQL Server does not exist or access
denied." I strongly suspect that this is a security issue, but I don't
know how to resolve it. I've given (as per other posts) the usernames
ASPNET and NETWORK SECURITY broad rights on all sql server instances,
yet still I can't run a webpage on my workstation that connects. It's
infuriating. Help!


Behold my latest connection string (since I know some of you will want
to see it anyways... ;-)
Dim MyConnection As New
SqlConnection("server=testserver;uid=test;pwd=pass;database=adp")

I've tried using IP's in place of the server name and all. I truly
think this is some obscure security issue...

I had a similar problem. I know very little about sql but this sequence of
steps helped me get my connection working maybe it will give you some ideas.
You problably don't need to to this at dos. You probably can do it within
sql server.

#at dos prompt osql -E -S COMPUTERNAME
exec sp_grantlogin 'COMPUTER_NAME\ASPNET'
go
#Database_Name is name of sql database without file extension
use Database_Name
exec sp_grantdbaccess COMPUTER_NAME\ASPNET
go
use Database_Name
exec sp_addrolemember 'db_owner', COMPUTER_NAME\ASPNET
go
exec sp_addrolemember 'db_datareader', COMPUTER_NAME\ASPNET
exec sp_addrolemember 'db_datawriter', COMPUTER_NAME\ASPNET
go
#Also you may need to give broader rights to some store procedures
grant execute on 'STORED_PROCEDURE_NAME' to public


Mike
 
G

Guest

I can connect/interact just fine with the SQL Server instances on both
servers >using EM, Query Analyzer, and VS.NET "server explorer."

If “Server explorer†works, why don’t you connect to your SQL server at 2003
and drag the db table in server explorer into your page. The VS.NET will
generate connection class automatically. Try to use this class to connect db
in code, and to see if it really works.

Shaw
 
L

Lucas Tam

Thanks for the response Mike.
I just tried your series of things and still nothing.
:(

How about try connecting via a System DSN as a test?

Create a DSN for SQL server on the system... then use the System DSN in
your connection string.
 
R

Roy

I don't think I can use a system DSN in my connection string... I
looked it up in the documentation and got this:

Note The .NET Framework Data Provider for SQL Server uses its own
protocol to communicate with SQL Server. Therefore, it does not support
the use of an ODBC data source name (DSN) when connecting to SQL Server
because it does not add an ODBC layer.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top