connectionstring and user Instance

  • Thread starter Thread starter Tony Johansson
  • Start date Start date
T

Tony Johansson

Hello!

Assume I use the ASP.NET web site administration tool that is generating
ASPNETDB.MDF database file and the web.config.

My first question if the web.config doesn't have any connection string from
where is the connection string fetched ?
I guess that the connection string is fetched from machine.config is that
correct ?

My second question is about user instance=True. Sometimes is the connection
string generated with the user instance=True
at which occasions can I remove this user instance=True. I have read about
this User Instance but I can't fully understand what they mean.

//Tony
 
Hi,
My first question if the web.config doesn't have any connection string
from where is the connection string fetched ?
I guess that the connection string is fetched from machine.config is that
correct ?

Correct, this is hierarchical. The documentation always mention the default
values (http://msdn.microsoft.com/en-us/library/bf7sd233.aspx shows the
LocalSqlServer connection string).
My second question is about user instance=True. Sometimes is the
connection string generated with the user instance=True
at which occasions can I remove this user instance=True. I have read about
this User Instance but I can't fully understand what they mean.

Usually databases are to be configured once for all in SQL Server and then
are just usable (basically the SQL Server engine registers the path for the
data files and then all those databases are just ready to be used whenever
the SQL Server service starts).

A user instance allows to dynamically open an arbitrary SQL Server data
file without prior configuration and even if the user has no adminitrative
rights. It is used by both VS (allowing to easily create and use a database
even if the user has no admin rights) or desktop application. IMO for an
ASP.NET application this is useless (but you'll have to configure SQL Server
Express to "attach" once for all this DB file to the engine).

Not sure if the paper that was unclear is the one I mentioned
(http://msdn.microsoft.com/en-us/library/ms254504(VS.80).aspx). Else you can
also try http://msdn.microsoft.com/en-us/library/bb264564(SQL.90).aspx that
is straigth from the SQL Server documentation.
 
Your firt question: Yes it takes connectionstring from machine.config. If you
define it in web.config then it will override the default values of
machine.config.
 
Back
Top