2006-06-29

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"

2 Comments:

Blogger Atif Abdul-Rahman said...

me too!
but atleast i had your blog to look at and saved some time.
thanx!

11:18 pm GMT  
Anonymous Anonymous said...

This info helped.

/thanks
(I hate connection strings)

10:43 am BST  

Post a Comment

<< Home