|Class to hold DB Connections [message #758187]
||Tue, 22 November 2011 09:43
Registered: July 2009
When my RCP application starts, in the Activator.start(BundleContext context) , I instantiate a DB Connection Pool that vends out DB connections. I also define a public getDBConnection() in Activator. Later, when I need access to DB Connection, I simply call Activator.getDefault.getConnection() and I get the connection. I close the connections in Activator.stop(..) method.
So, my question is:
Is it a good idea to keep DB connections in Activator (subclass of AbstractUIPlugin)?
What are the best practises about holding connection factories, whether for a DB or other resources?
Will the connection run in the UI thread? i.e., if the DB process takes a long time, will the application appear to be unresponsive during that time?
Please can you provide concrete solutions (with code example if possible) since I am quite new to RCP.
Powered by FUDForum
. Page generated in 0.02812 seconds