Re: Making a database connection global



No one has given a different view yet, accept to say I'm wrong and I'm
leaving the conncection open, which is not true. So, I asked if opening 30+
connections made more sense than one connection if in both cases the
connection would be opened the same amount of time (which no-one yas yet
answered). I really would like to hear another point of view. I have not
discounted anything anyone has said. Someone did say:

my suggestion is having one class that just handles commands to
database.

your other 30+ classes would just prepare commands and pass them for
execution. So you will have central place for working with
SQLConnection object

Which I like and am (have been) diagraph/mapping out to see if this would
work. Don't be offended about asking to clarity you position better. It
doesn't mean I think your wrong.






"Göran Andersson" <guffa@xxxxxxxxx> wrote in message
news:uJFn2b2dGHA.1272@xxxxxxxxxxxxxxxxxxxxxxx
Yes, you are probably right.

He got a lot of answers, but he didn't seem to listen to anyone who didn't
already agree with him. Mark Rae even answered him using my own words, so
there wasn't much I could add to that. I thought that I'd try a different
angle, but I might have taken it a bit too far.

Anyway, if he don't want to listen, a different angle will probably not
work anyway.

Ray Booysen wrote:
Hi Göran

Sarcasm like this isn't neccessary. Someone asked a question to something
that he/she obviously didn't know the correct answer for.
It doesn't help answering the question in this sort of vein.

Regards
Ray

Göran Andersson wrote:
Using only one single database connection for a web application? Good
one...

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.

What database are you using? If you are only going to use a single
connection against it you should consider downgrading to something
low-grade like MSDE or Access. Or why not anything even simpler like
storing the data in text files?


Terry Jolly wrote:
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

  • Database Connection Question
    ... we were using an asp include file with database functions ... and would open and close the database connection multiple times in 1 script. ... I don't know, the persistent connection seems much better to me, easier to ...
    (microsoft.public.inetserver.asp.db)
  • Re: garbage collection
    ... it will get a reader back.. ... you can not reuse the connection on which it opened. ... > garbage collection issue, its a logical error. ... > on database connection is, ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Database Connection question
    ... the other is a standalone app and is using ... >java.sql.DriverManager for Connection. ... Every time after obtaining a ... >My task is to write generic code for database connection to be used in both ...
    (comp.lang.java.programmer)
  • Re: Making a database connection global
    ... Have a global database connection ... I created a class with a static database connection and the class opens ... requests a page will be sharing the same connection. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: simplifying repeating database connections in a class?
    ... I wrote my first PHP class today. ... >> repeat the database connection lines, ... That's why I'm calling the include twice, once in each function, ...
    (comp.lang.php)