Friday, March 9, 2012

Error>>"SQL Server does not exist or access denied"

I have re-installed Visual Studio and SQL Server and now i am getting this error for all applications i try to run
Error:

"

SQL Server does not exist or access denied.

Description:An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details:System.Data.SqlClient.SqlException: SQL Server does not exist or access denied.
Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:
[SqlException: SQL Server does not exist or access denied.] System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) +474 System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) +372 System.Data.SqlClient.SqlConnection.Open() +384 System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState) +44 System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +304 System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +77 System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, String srcTable) +36 ResNet2.top_animals.BindGrid() +64 ResNet2.top_animals.Page_Load(Object sender, EventArgs e) +525 System.Web.UI.Control.OnLoad(EventArgs e) +67 System.Web.UI.Control.LoadRecursive() +35 System.Web.UI.Page.ProcessRequestMain() +731

"
any suggestions?We will need to see your connection string to be able to help you.
|||

tmorton wrote:

We will need to see your connection string to be able to help you.


Connection String:

Session("ResNet_Connection_String") = "workstation id=PC_ID;packet size=4096;user id=USER_ID;data source=SAC063;persist" & _

" security info=True;initial catalog=Jo;password=PASSWORD"

The connection string was working fine before installations. I got a feeling that the application is not able to connect to sql server at all and there is some wee configurations which got to be done.

|||

Other than just trying to connect to the SQL server i was even trying to connect to the local SQL Sserver (MSDE 2000) which gives a slightly different error:

Error:
***************************************************************************************************************************************************************************************************************

Server Error in '/TestApp' Application.

Login failed for user '4NSQ11J\ASPNET'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Data.SqlClient.SqlException: Login failed for user '4NSQ11J\ASPNET'.
Source Error:

Line 179: Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.LoadLine 180: 'Put user code to initialize the page hereLine 181: Me.SqlDataAdapter1.Fill(Me.DataSet1)Line 182: Me.DataGrid1.DataSource = Me.DataSet1Line 183: Me.DataGrid1.DataBind()

Source File:c:\inetpub\wwwroot\TestApp\DbTest_App.aspx.vb Line:181
Stack Trace:
[SqlException: Login failed for user '4NSQ11J\ASPNET'.] System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) +472 System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) +372 System.Data.SqlClient.SqlConnection.Open() +384 System.Data.Common.DbDataAdapter.QuietOpen(IDbConnection connection, ConnectionState& originalState) +44 System.Data.Common.DbDataAdapter.FillFromCommand(Object data, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +304 System.Data.Common.DbDataAdapter.Fill(DataSet dataSet, Int32 startRecord, Int32 maxRecords, String srcTable, IDbCommand command, CommandBehavior behavior) +77 System.Data.Common.DbDataAdapter.Fill(DataSet dataSet) +38 TestApp.WebForm1.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\TestApp\DbTest_App.aspx.vb:181 System.Web.UI.Control.OnLoad(EventArgs e) +67 System.Web.UI.Control.LoadRecursive() +35 System.Web.UI.Page.ProcessRequestMain() +731


Version Information: Microsoft .NET Framework Version:1.1.4322.573; ASP.NET Version:1.1.4322.573

***************************************************************************************************************************************************************************************************************
Where 'NSQ11J' is my local server as well as computer name.

|||Does the user who is trying to run the query have sufficient access rights on the database/table?
Tryst
|||

Tryst wrote:

Does the user who is trying to run the query have sufficient access rights on the database/table?
Tryst


Yes DB Owner rights!|||Do you have your <machinename>/ASPNET as the user in the USER accounts ? and make sure this user account has permissions on the tables/stored procs.|||

ndinakar wrote:

Do you have your <machinename>/ASPNET as the user in the USER accounts ? and make sure this user account has permissions on the tables/stored procs.


As i mentioned earlier the account i am using has got DBO rights.|||Solution Found:

Ther Alias port had to be set to a specific one to listen to TCP/IP protocols.

Steps to check the Alias settings:

1) go to 'Client Network Utility' in Microsoft SQL Server utlities

2)check if there are any protocols disabled which you going to use in the application

3)click on the tab 'Alias' to add/edit/remove currently Alias servers in the list

Thanks for you guys help anyway!

Cheers
Umer|||Hi UmerTahir,
you solved the problem by doing this, but what exactly was the problem you had with the Server Network Utility?
Tryst
|||

Tryst wrote:

Hi UmerTahir,
you solved the problem by doing this, but what exactly was the problem you had with the Server Network Utility?
Tryst


The problem was with the application and its connection to the SQL server. To access the sql server through TCP/IP protocols some empty port is required which is usualy left to be detected automatically. In my case i had to access through specific port which my company has set for some security issues so that solved the problem.
Umer

No comments:

Post a Comment