I'm using Windows Integrated Security in combination with the NETWORK
SERVICE account. Connection to the asp.Net app is behaving normally. I use
the following connection string within the web.config file :
Provider=SQLNCLI10;Server=.\SQLEXPRESS;Database=myDBName;
Trusted_Connection=yes;
But when i try to connect my classic asp web app, i systematically get the
following error :
Cannot open database "myDBName" requested by the login. The login failed.
I tried the following different connection strings without any success :
Provider=SQLNCLI10;Server=WPC1480\SQLEXPRESS;Database=myDBName;Integrated
Security=SSPI;
PROVIDER=MSDASQL;DRIVER={SQL
SERVER};SERVER=WPC1480\SQLEXPRESS;DATABASE=myDBName;Integrated Security=SSPI;
Provider=SQLOLEDB;Data Source=C:\Program Files\Microsoft SQL
Server\MSSQL10.SQLEXPRESS\MSSQL\DATA\;Initial
Catalog=myDBName;Network=DBMSSOCN;Integrated Security=SSPI;
provider=SQLOLEDB;Data Source=WPC1480\SQLEXPRESS;Initial
Catalog=myDBName;Integrated Security=SSPI;
Provider=SQLOLEDB.1;Integrated Security=SSPI;Initial Catalog=myDBName;Data
Source=WPC1480\SQLEXPRESS;
I also checked that the NETWORK SERVICE account is declared both at the sql
server level and at the database level.
Any suggestions on why i am getting this error ?
Tks
Apparently the login you are using is not able to access the database.
I suggest that you try this:
Change the connection string to read
Database=master
Then change the application so that the first command is
"USE myDBname"
The error message you get, may give you more information.
It may also be worth to run this SELECT as a debug:
SELECT system_user, user
(Run this while you are still in master.)
--
Erland Sommarskog, SQL Server MVP, esq...@sommarskog.se
Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
Thanks
Nicolas
"Erland Sommarskog" wrote:
> .
>
SELECT system_user, user gives me the following (1 line) result :
myServerName\myAdminAccountName on the first column
and
dbo on the second column
Is this correct or are there other accounts missing ?
Otherwise, where do i change the application to add: USE myDBname ?
Thanks
Nicolas
But apparently then myServerName\myAdminAccountName should be added
as a user to the database.
> Actually, by adding the "Built-In\Users" account to the "security" tab
> of my database, the connection problem seems to be solved. Is there
> anything wrong with this solution from a security point of view ?
When it comes to security there is always a problem if you don't know
what you are doing. :-)
Builtin\users means that all users on the machine has access to the
database. Which may or may not be OK depending on what other people
who can log in.
the sql server manager (R2 version) is not letting me add the IUSR account
to the database, it says this account does not exist, although i do know that
it exists. That's why i had to add the Builtin\users account. So is it me who
does not know what to do or is it the software ? ;-)
Thanks a lot anyway, i will consider that this problem is solved.
btw. this newsgroups reader software (in the browser), that i got to from
the WEBSITESPARK area (oh la la !) is behaving very weard, it shows the
messages once upon a time. Is it my eyes that do not know what they do ? :-)
Cheers
Nicolas
"Erland Sommarskog" wrote:
> .
>
I don't know which IUSR you are talking about. In your previous post
you said it was myServerName\myAdminAccountName, no IUSR there what I
can see.
> btw. this newsgroups reader software (in the browser), that i got to from
> the WEBSITESPARK area (oh la la !) is behaving very weard, it shows the
> messages once upon a time. Is it my eyes that do not know what they do ?
Well, that software is not the topic for this newsgroup.
Mary
One of the topics that i may have found useful is the one entitled "Guides"
/ "Building Secure ASP.Net applications".
http://msdn.microsoft.com/en-us/library/cc394781.aspx
But unfortunately, while i'm writing this message, it still returns a broken
link showing a "Page not found" alert.
In a way, this has been useful, since it has taught me that the best way to
make your database content more secure is to avoid putting data in it :-)
Thanks
Nicolas
--Mary