SQL Server does not exist or access denied.

S

sammyloo

Hi all,

I'm experiencing a problem using ASP.NET web services to access a
different server with SQL Server 2000 database.


And I get the error of the following

Exception Details: System.Data.SqlClient.SqlException: SQL Server does
not exist or access denied.

[SqlException: SQL Server does not exist or access denied.]
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean&
isInTransaction)

System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString
options, Boolean& isInTransaction)
System.Data.SqlClient.SqlConnection.Open()
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection,
ConnectionState& originalState)
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior)
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior)
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String
srcTable)
WebApplication1.WebForm1.butSearch_Click(Object sender, EventArgs e)
in C:\Inetpub\wwwroot\WebApplication1\search.aspx.vb:64
System.Web.UI.WebControls.Button.OnClick(EventArgs e)

System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String
eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()

here are the details:

It works fine
=============
- connected by SQL Server enterprise manager
- A simple windows form application that has the same code works just
fine
- same source code if web server and database server are in same
machine


Server 1: (database)
====================
server name: database_server
Database: SQL Server 2000
table: ABC
user_id: abc_user
password: abc_password


Server 2: (web server)
======================
web server: Window XP + IIS
IIS Setting: Directory Security -> Anonymous access and authentication
control -> turn off "Anonymous access"
IIS Setting: Directory Security -> Anonymous access and authentication
control -> checked "Integrated Windows authentication"
web.config setting: <authentication mode="Windows" />


connection string used in System.Data.SqlClient:
================================================
- connectionStr = "User ID=abc_user;Password=abc_password;Initial
Catalog=ABC;Data Source=database_server;Network Library =dbmssocn"
- not using any impersonation coz i just want to use 'abc_user' to make
the connection to sql server, can I?
- this connectionStr work fine if connecting by vb.net application


I'd found many many posts with similar problem, but still out of luck.

i believe the problem is due to the connection but i had already
specified the user id and password in my connectionStr, so what still
wrong?

Your help is greatly appreciated.

Regards,

Sammy Loo
 
S

sloan

I think you have the definitions wrong.

- connectionStr = "User ID=abc_user;Password=abc_password;Initial
Catalog=ABC;Data Source=database_server;Network Library =dbmssocn"
- not using any impersonation coz i just want to use 'abc_user' to make
the connection to sql server, can I?
- this connectionStr work fine if connecting by vb.net application

Server 1: (database)
====================
server name: database_server
Database: SQL Server 2000
table: ABC
user_id: abc_user
password: abc_password


Data Source is the server (you got that correct)
Initial Catalog is the databaseName (like "pubs" or "Northwind")
(you have "ABC" as the table in one place, and ABC as the
databaseName(initial catalog) in another.


If you have a connection string ... impersonation shouldn't have much to do
with that, unless your using trusted.
but since youre coding in your username and password, you're using "sql
authentication".

lastly, the server has to be setup for using "sql authentication", which can
be "turned off" .. (actually, it happens in the sql server install that its
not enabled I think)

check.

www.connectionstrings.com for more samples. be VERY careful with the spaces
in phrases like "intial catalog" and such.


Hi all,

I'm experiencing a problem using ASP.NET web services to access a
different server with SQL Server 2000 database.


And I get the error of the following

Exception Details: System.Data.SqlClient.SqlException: SQL Server does
not exist or access denied.

[SqlException: SQL Server does not exist or access denied.]
System.Data.SqlClient.ConnectionPool.GetConnection(Boolean&
isInTransaction)

System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnec
tionString
options, Boolean& isInTransaction)
System.Data.SqlClient.SqlConnection.Open()
System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection,
ConnectionState& originalState)
System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior)
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32
startRecord, Int32 maxRecords, String srcTable, IDbCommand command,
CommandBehavior behavior)
System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String
srcTable)
WebApplication1.WebForm1.butSearch_Click(Object sender, EventArgs e)
in C:\Inetpub\wwwroot\WebApplication1\search.aspx.vb:64
System.Web.UI.WebControls.Button.OnClick(EventArgs e)

System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePo
stBackEvent(String
eventArgument)
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler
sourceControl, String eventArgument)
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData)
System.Web.UI.Page.ProcessRequestMain()

here are the details:

It works fine
=============
- connected by SQL Server enterprise manager
- A simple windows form application that has the same code works just
fine
- same source code if web server and database server are in same
machine


Server 1: (database)
====================
server name: database_server
Database: SQL Server 2000
table: ABC
user_id: abc_user
password: abc_password


Server 2: (web server)
======================
web server: Window XP + IIS
IIS Setting: Directory Security -> Anonymous access and authentication
control -> turn off "Anonymous access"
IIS Setting: Directory Security -> Anonymous access and authentication
control -> checked "Integrated Windows authentication"
web.config setting: <authentication mode="Windows" />


connection string used in System.Data.SqlClient:
================================================
- connectionStr = "User ID=abc_user;Password=abc_password;Initial
Catalog=ABC;Data Source=database_server;Network Library =dbmssocn"
- not using any impersonation coz i just want to use 'abc_user' to make
the connection to sql server, can I?
- this connectionStr work fine if connecting by vb.net application


I'd found many many posts with similar problem, but still out of luck.

i believe the problem is due to the connection but i had already
specified the user id and password in my connectionStr, so what still
wrong?

Your help is greatly appreciated.

Regards,

Sammy Loo
 
S

sammyloo

Thanks for you reply.

As you pointed out correctly, 'ABC' is the databaseName, NOT table
Data Source is the server (you got that correct)
Initial Catalog is the databaseName (like "pubs" or "Northwind")
(you have "ABC" as the table in one place, and ABC as the
databaseName(initial catalog) in another.

I'd tested this connection by VB.NET and just working fine. So, i
conclude the connectionStr is correct.
lastly, the server has to be setup for using "sql authentication", which can
be "turned off" .. (actually, it happens in the sql server install that its
not enabled I think)

however, how can i ensure web server is doing "sql authentication"
correctly? should be configured on web.config or machine.config?

Sammy Loo
 
S

sammyloo

Finally, i got it work by changing the connection string

'Incorrect and flow out 'SQL Server does not exist or access
denied.' error
conn_str = "User ID=abc_user;Password=abc_password;Initial
Catalog=ABC;Data Source=database_server;Network Library=dbmssocn;"

'correct and work fine
conn_str = "Server=database_server; Database=ABC; User
Id=abc_user; password=abc_password;"


sloan 寫é“:
 

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,582
Members
45,058
Latest member
QQXCharlot

Latest Threads

Top