SQL Server 2005 Connection Strings
Gah. Bit of head-beating today, as it takes me a while to figure out that under SQL Server 2005, at least the Express version, you should not include Initial Catalog in the Connection String for a user who cannot read the Master database.
Even if it is a database to which the relevant credentials are OK, the connection will fail with an error "Cannot open database... requested by the login. The login failed."
Instead, you must specify a default database for that user, and omit the Initial Catalog. So in the end the Connection String is pretty much only "Integrated Security=SSPI;Data Source=.\SQLEXPRESS"
Even if it is a database to which the relevant credentials are OK, the connection will fail with an error "Cannot open database... requested by the login. The login failed."
Instead, you must specify a default database for that user, and omit the Initial Catalog. So in the end the Connection String is pretty much only "Integrated Security=SSPI;Data Source=.\SQLEXPRESS"
2 Comments:
me too!
but atleast i had your blog to look at and saved some time.
thanx!
This info helped.
/thanks
(I hate connection strings)
Post a Comment
<< Home