Wednesday, March 21, 2012

Hi Everyone

trying to login to ... SQL.Exception occurs

The result is SQL Server does not exist or access denied . . .

The code Im working with connection string is a forum fix from

http://p2p.wrox.com/topic.asp?TOPIC_ID37898

and the user account has been established.

<appSettings>

<add key="connection String" Value="server=(local)\MYSQLSERVERNAME; database=bids; Trusted_Connection=true"/>

</appSetting>

SQL Service Manager shows Server: SNOEMASTER

Services: MSSQLServerOLAPService

SQL Server Enterprise Manager indicates my SQL Server Group consists of

(local) (Windows NT)

and somewhere along the line I ran into something telling me to rename

(local) (windows NT) = MSSQLServer

Although when I do switch it over through the new registration wizard the connection fails. Stating MSSQLServer does not exist and come up with a error 1722 (RPC Server Unavailable) although in componet services it shows it running.

Initially I tried correctinig this because SQL SERVER repilcation does not support nicknames such as "." or (local) as server names and was given a message to

DELETE THE SQL SERVER REGISTRATION FOR THE SERVER AND REGISTER IT USING THE ACTUAL SERVER NAME MSSQLServer which component services confirmed in the properties tab "Dispaly Name" = MSSQLSERVER.

The problem seems to become two -fold because in the above connection string it maintains (local) as part of the string and instructs me to add on MYSQLSERVERNAME. ex. (local)\MYSQLSERVERNAME; database="bids"

Note: The database folder is named Bid.

Thanks for any input on this one anyone.

What you need to do is to replace MYSQLSERVERNAME with whatever your instance name is. If your SQL Server is the default instance, then user (local) or . directly rather than (local)\MSSQLSERVER or .\MSSQLSERVER

|||

Thank You!

i'm getting an access denied error but i can reset the user property from here. its better then the other errors I was recieving!

It clears up alot.! will make additional instance's of it in the future, one step at a time of course. I just installed SQL 2000 recently and want to make sure i have a solid understanding of what was happening.

http://192.168.1.65/Bid/default.aspx

icon_snowman

|||

After having reinstalled the Bid database and set the IUSR_SNOEMASTER permissions for the it from the SQL enterprise manager Bid \Properties\Security directory , i'm still recieving the double error . SQL server does not exist or access is denied..

I tried several combinations off the above resolution you mentioned but , not working yet. Will try Later.

On the second try I recieved a popup box to remember the passwaord and a confirmation that the user was added to the pool although checking the web.config file I realized I did not replace its original extension and had left it at web.txt to edit it.

Ohhhh is me

|||

System.Data.SqlClient.SqlException: Cannot open database requested in login 'bids'. Login fails. Login failed for user 'SNOEMASTER\IUSR_SNOEMASTER'. at System.Data.SqlClient.ConnectionPool.CreateConnection() at System.Data.SqlClient.ConnectionPool.UserCreateRequest() at System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction) at System.Data.SqlClient.SqlConnectionPoolManager.GetPooledConnection(SqlConnectionString options, Boolean& isInTransaction) at System.Data.SqlClient.SqlConnection.Open() at Bid.Bid.Person.AddCustomer(String familyname, String givenname, String emailaddress, String password, String add1, String add2, String city, String state, String zip, String country) in C:\development\Wrox\6195\Bid\Components\Person.vb:line 169


Latest SQL.Exception recieved using

<appSettings>
<add key="ConnectionString" value="server=(local);database=bids;Trusted_Connection=true" />
</appSettings>

Anyone have any ideas or previous same problem.?

icon_snowman

|||From your latest error, your client is able to find the SQL server. The new problem is that you login account may not have login privilege to the database "bids". In order to login successfully, the login account must have login priviledge to the initial database (i.e. bids for your case).|||

In the above example the user (IUSER_SNOEMASTER) was left out of the connection string on purpose.

If I include the user in the connection string ( value="server=(local)\(IUSR_SNOEMASTER);databes=bids; . . . )then the error SQL Server does not exsist or access is denied to the user.

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

SQL Server Enterprise Manager:

Console Root|Microsoft SQL Servers|SQL Server Group|(local)(Windows NT)|Databases||bid|Users

In the right pane windows "Login Name" SNOEMASTER\ISUR_SNOEMASTER

"Database Access" status is Permit

If I use value="server=(local)\(SNOEMASTER\IUSR_SNOEMASTER); database=bids the following error occurs

Server Error in '/bid' Application.


Configuration Error

Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Access is denied: 'Bid'.
Source Error:

Line 256: <add assembly="System.EnterpriseServices, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>

Line 257: <add assembly="System.Web.Mobile, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>

Line 258: <add assembly="*"/>

Line 259: </assemblies>

Line 260:


Source File: c:\windows\microsoft.net\framework\v1.1.4322\Config\machine.config Line: 258
Assembly Load Trace: The following information can be helpful to determine why the assembly 'Bid' could not be loaded.

=== Pre-bind state information ===

LOG: DisplayName = Bid

(Partial)

LOG: Appbase = file:///C:/Bid

LOG: Initial PrivatePath = bin

Calling assembly : (Unknown).

===

LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).

LOG: Post-policy reference: Bid

LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/bid/4a7e3fd3/b5ae6ea7/Bid.DLL.

LOG: Attempting download of new URL file:///C:/WINDOWS/Microsoft.NET/Framework/v1.1.4322/Temporary ASP.NET Files/bid/4a7e3fd3/b5ae6ea7/Bid/Bid.DLL.

LOG: Attempting download of new URL file:///C:/Bid/bin/Bid.DLL.

LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).

LOG: Post-policy reference: Bid, Version=1.0.885.31008, Culture=neutral, PublicKeyToken=null



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

Using the code below:

<appSettings>
<add key="ConnectionString" value="server=(local);database=bids;Trusted_Connection=true" />
</appSettings>

<appSettings>
<add key="ConnectionString" value="server=.\;database=bids;Trusted_Connection=true" />
</appSettings>

The following error is created:

System.Data.SqlClient.SqlException: Cannot open database requested in login 'bids'. Login fails. Login failed for user 'SNOEMASTER\IUSR_SNOEMASTER'. at System.Data.SqlClient.ConnectionPool.CreateConnection() at System.Data.SqlClient.ConnectionPool.UserCreateRequest() at System.Data.SqlClient.ConnectionPool.GetConnection(Boolean& isInTransaction



|||

server=(local)\(IUSR_SNOEMASTER);
Here (IUSR_SNOEMASTER) should be the instance name, NOT USER ACCOUNT. If your SQL Server is a default instance, then just use "(local)" or "." The client user account is determined by under which Windows account your client application is running if Windows authentication is used. From your last exemple, it looks like you have a default instance and your client app is running under 'SNOEMASTER\IUSR_SNOEMASTER'. So, you need to make sure this account has login priviledge to database "bids", as I said before.

|||

OK Have Login Working:

<appSettings>
<add key="ConnectionString" value="server=(local);database=Bid;Trusted_Connection=true" />
</appSettings>

The problem was that the database=bids was not allowing it to access the Bid folder.

Initially building the data base as prescribed in the http://p2p.wrox.com/toTOPIC_ID=37898 pic.asp?the query uses a plural version of the database "bids" so I continued with this in the connection string. Doesnt work. I read about two lines in the SQL Server Books Online stating that the database names are case sensitive and made the adjustment from bids=Bid and a slight adjustment in the permissions by :

Console Root|Microsoft SQL Servers|(local)(Windows NT)|Databases|bid

In the right-hand pane right clicked properties, highlight SNOEMASTER\IUSR_SNOEMASTER

Clicked Permissions and set settings as instructed http://p2p.wrox.com/toTOPIC_ID=37898 pic.asp?

Clicked Ok then clicked Properties on the bottom. Check that Public is selected.(For what ever reason mine was not. Possibly an over sight having reinstalled the database and permissions.)

Once again set the settings as instructed http://p2p.wrox.com/toTOPIC_ID=37898 pic.asp?and clicked apply and OK and everything seems to be running as it is supposed to.

Thank You Xinwei Hong your response helped me sort it out. Knowing better I should have immediately changed bids=Bid If you recall I made a note of this in my first post at the bottom of the name difference.


No comments:

Post a Comment