Jason, Thanks for the input. My concern is that actually connecting to the database is the most expensive task. After a connection is established, queries are not that expensive.
I'm just wondering what is the best thing to do on an application where, say, 100 users are connected simultaneously and constantly hitting the database. Any thoughts? -Mike Jason Powell wrote: > Hey Mike. > > You'll find that with some DBMSs your connection will be closed after a > certain amount of inactivity. > I've personally always considered it bad form to have a database > connection sitting open and idle when it's not really needed, especially > when opening a new database connection is such a trivial action. > The database class I use creates connections on demand via a get() > method and closes them via a return() method. I also have it start a > thread that kills connections if they've been open more than half an > hour, plus I have it call System.gc() every now and then :) > > Jason > > Mike wrote: > >> I'm creating a Red5 application that talks to MySQL via JDBC. >> >> Once I establish a connection to the database, is there every any reason >> to close it? >> Should I just establish a connection on appStart() and leave the >> connection open for the duration of my application? >> >> As clients connect and interact with my application, I will of course be >> doing a lot of SELECT, INSERT, UPDATE, etc. >> >> Any input is welcome on this topic. >> -Mike >> >> >> >> _______________________________________________ >> Red5 mailing list >> [email protected] >> http://osflash.org/mailman/listinfo/red5_osflash.org >> >> > > > _______________________________________________ > Red5 mailing list > [email protected] > http://osflash.org/mailman/listinfo/red5_osflash.org > > > _______________________________________________ Red5 mailing list [email protected] http://osflash.org/mailman/listinfo/red5_osflash.org
