Showing posts with label connection. Show all posts
Showing posts with label connection. Show all posts

Friday, March 9, 2012

question about connection string

Hi all,

I am new to asp.net. A book I read teached the way to put connection string in web.config file. the file looks like this:
<configuration>
... other settings here ...
<appSettings>
<add key="DsnWroxBooksSql"
value="server=delmonte; database=WroxBooks; user id=sa; password=" />
... other settings here ...
</appSettings>
</configuration
I was just wondering what the user id "sa" and password ""is? I have seen these in many books. is it a system build in user name and password? Can I use my own user id and password instead? Also must I hardcode the password in web.config file? is there anyway I could get around it?

thank you!SA is the default administrator account for SQL Server. YOu use that when you are using mixed mode for authentication as opposed to windows.

Default password is blank, not recommended of course.

Yes you can create your own account and use it instead.

Question about connection pooling

If I have two ASP.NET applications installed on the same machine, and both are using the same connection string to access SQL Server 2005. Are they share the same pool or use separated pools?

I need to be sure that how many connections would be connected to my database server. For example, the max. connection pool size is 100, if both Web app share the same pool, then there're may be maximum 100 connections to database. It they use separated pools, then connections may grow to 200.

Hi,

per documentation: "Connections are pooled per process, per application domain, per connection string and when using integrated security, per Windows identity."
Source:http://msdn2.microsoft.com/en-us/library/8xx3tyca.aspx (using Connection Pooling)

It means your application would have separate pools, since they are different applications and therefore have their own app domain.

Another thing is that maximum connection pool size is configurable (within connectionstring), 100 is the default maximum limit.

|||

joteke:

per documentation: "Connections are pooled per process, per application domain, per connection string and when using integrated security, per Windows identity."
Source:http://msdn2.microsoft.com/en-us/library/8xx3tyca.aspx (using Connection Pooling)

It means your application would have separate pools, since they are different applications and therefore have their own app domain.

What if my ASP.NET applications all use the same application pool? In this way, are they still have separate pools?

Thank you!

|||They don't because they have different appdomains. Every ASP.NEt application has its own AppDomain. Only connections in same application, using exactly same connection string, would use the same connection pool.|||

Ok! Now I got it.

Thank your for your help :)