Hii ,
I am developing an application where I ran across into this problem ...I have this GUI where in I have many buttons ... Each button performs some action like INSERT , SELECT , UPDATE , DELETE , VIEW etc... on a database . My question is ...
Is it better to have a single connection open for the entire lifetime of this particular class and close when this class is no longer in use ... or should i open a DB Connection on the fly and close immediately the operation is performed...
If i choose the first case , what if we require to do some processing and only then can we perform the operation ...in which case the connection is going to be idle ..
If i choose the second case , will it not impose any overhead on frequent opening and closing of the connections... given the user can only perform only DB Operations from this screen (lets say) ...
If we require multiple connections , is Connection Pooling the best option ... ?
I actually dont know and please correct me if i am wrong ... Does establishing a DB Conncetion impart any significant overhead to the system in terms of memory ... ?