Link to home
Start Free TrialLog in
Avatar of curiouswebster
curiouswebsterFlag for United States of America

asked on

Cannot open database requested by the login.

I get an exception when I open an SQL Express database from a web service, yet the exact connection string works in my primary Windows program.

Here's the string:
@PROVIDER=SQLOLEDB;Initial Catalog=ODBCsubsystem;Data Source=BOBHP\SQLEXPESS;Integrated Security=SSPI;

Here's the error:
Cannot open database ODBCsubsystem requested by the login.  The login failed.

Any idea why this might be?

thanks,
newbieweb
Avatar of curiouswebster
curiouswebster
Flag of United States of America image

ASKER

Also, I intend to host the web service on Windows XP and use SQL Server database as the conduit between my web service and my windows program.

Is there any problem with this strategy?
1. Hosting on Windows XP will limit you to 5 concurrent connections to the XP machine. XP is not an OS designed for production server software.
2. Hosting on Windows XP will limit you to IIS 5x - you should be using IIS to allow you to configure application pools.
3. Your connection string is set to connect with Windows Authentication. You *either* need to configure your web.config for impersonation *or* connect with a SQL login to the database (and then you need to ensure that SQL is running in Mixed Authentication mode).
Hi,

1. What constitutes a concurrent connection?  Are you saying I might be near or above my limit?

2. I was planning on having two applications accessing my SQL Express 2005 database, that's all.  One is the web service and one is my Windows program.

3. Which method is better?  I did install SQL Express with Mixed Authentication so I would have the choice.  SO now I just need to add a usermname/pasword pair and put that into my connection string?  Right?

Could you blast me my connection string with username and password specifiers?

thanks,
newbieweb
ASKER CERTIFIED SOLUTION
Avatar of Nightman
Nightman
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
1. As far as scalability, I intend to use the web service for one restaurant only, via its intranet.  I have no plans to scale its use beyond that.

2. What kind of bottleneck do you mean? The web service will be getting new orders submitted from the restaurant's POS as many as a few per minute and as little as a few per hour.  The POS will need to poll my web service every 15 seconds checking the status of certain things.  Each access wil need a database query or update.  Might this caue a bottleneck?

3. I'd like Windows Authentication if it's safer, if I can have it.  Am I able to now that I installed it with mixed mode?
which connection string is the right one for WA?
Avatar of rboyd56
rboyd56

If you are creating user instances of SQL Server Express, the error your getting is most likely is most likely caused by a failure of the user database to attach when the instance starts. What is the service account you are using for SQL Server Express?  If you are not using the Network Service account, try using it instead.
I have no idea what a Network Service Account is.  Can you tell me how to find out?
Open you SQL Server Configuration Manager and right click on the SQL Server Express service. It is listed as one of the Built-in accounts on the Log in tab.
It says "Network Service"
Your first connection string uses Windows Authentication. Note though that unless you use impersonation in the web.config (to impersonate a domain account), the web application will attempt to connect as a user local to the web server, and this will fail.

As for the bottleneck, this is in the amount of concurrent connections to IIS. If you never plan on having more than one, this will not be a problem.
Nightman,

Thanks.

How do I use impersonation to solve this?

newbieweb
Have a look here:

http://www.aspdev.org/articles/web.config/

It shows you the different permutations you can use in the config for impersonation.
So would I just include this line in web.config?

<identity impersonate="true|false" userName="username" password="password"/>

and would the username and pasword be the same ones I use to log onto my Windows account?
It seems to be working.

Thanks.
Yes, that's pretty much. You may have to change the web site settings (I need to check, but I think anonymous access must be enabled, as well as integrated windows authentication).

Pretty much all of this should be in the MSDN documentation as well.
:)
It's a pleasure. Good luck with your project.