I can't post all of my code, but here is the basic layout (well, the important stuff):
I've got a Threaded app, that calls a new instance of a class, basically, well, forever.
// poll a database table, check some values
if (CONDITION CHECKS OUT)
new Test().start(); // <-- do some db transactions in here
So...I could possibly have 10 or so Threads going at once...maybe more.
Now here is now I'm doing my connection to the database:
private static Connection conn = null;
public static Connection getConn()
if (conn == null)
logger.error("Get Connection failed: " + e.getMessage());
public static void setConn(Connection conn)
logger.debug("Setting new connection...");
FlashClient.conn = conn;
Basically I get the connection ONE TIME, and keep it, so whenever the Thread touches the db, it uses the connection that I created above....
Now someone was telling me EACH THREAD needs to have it's own connection to do work.
TRUE OR FALSE???
And isn't that alot of overhead? Opening a new connection, closing it...opening another one, closing it...blah blah blah??
What should I do???
I know nothing about Thread pooling..and I don't think that's an option for me.