Re: Making a database connection global

Tech-Archive recommends: Fix windows errors by optimizing your registry




With the web:

Open as late as possible.
Close as quick as possible.

I'd recommend looking into the EnterpriseLibrary (Data esp)
http://www.gotdotnet.com/codegallery/codegallery.aspx?id=295a464a-6072-4e25-94e2-91be63527327

They have already put in alot of best practices.

But regardless, global db connection is a terrible idea.

Pooling is a seperate issue.

I'd recommend
ISBN
159059522X
Expert ASP.NET 2.0 Advanced Application Design

"Terry Jolly" <terry@xxxxxxxxx> wrote in message
news:4464f7d0$0$6150$39cecf19@xxxxxxxxxxxxxxxxxxxxx
Web Solution

Goal: Have a global database connection
Why: (There will be 30+ tables, represented by 30+ classes) I only want to
reference the database connection once.

I put the connection string in the web.config.
I created a class with a static database connection and the class opens
and
closes the database.

This seems to work so the question: Is there a better way to handle the
database connection?

Thanks In Advance.




.



Relevant Pages

  • Re: Making a database connection global
    ... Does this static database connection object stay open throughout the entire ... I created a class with a static database connection and the class opens ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Making a database connection global
    ... The connection would not be opened the lifetime of the web app. ... then close the one database connection. ... I created a class with a static database connection and the class opens ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Making a database connection global
    ... Anyway, if he don't want to listen, a different angle will probably not work anyway. ... You could just as well neuter the web server by only allowing one single thread, as the other threads only will be waiting for the connection to get free. ... I only want to reference the database connection once. ... I created a class with a static database connection and the class opens and closes the database. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Making a database connection global
    ... It doesn't help answering the question in this sort of vein. ... You could just as well neuter the web server by only allowing one single thread, as the other threads only will be waiting for the connection to get free. ... I only want to reference the database connection once. ... I created a class with a static database connection and the class opens and closes the database. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Recovering from an updatebatch error with a clone
    ... LoadfromFile opens the dataset using the contents of the file. ... Open opens the dataset using records retrieved from the database connection. ... Prev by Date: ...
    (borland.public.delphi.database.ado)