RE: DBCP

2005-02-10 Thread Bernard D';Have
I think the first conn.close is unneeded, because the finally block is
always executed.

Bernard

-Original Message-
From: Craig McClanahan [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 10, 2005 7:24 PM
To: Jakarta Commons Developers List
Subject: Re: DBCP


Calling BasicDataSource.close() will only close the connections still in the
pool -- not the ones that have been checked out.  It is designed to be
called only when your app is ready to shut down.

For normal usage, the best approach is something like this:

DataSource ds = ... get your data source reference;
Connection conn = null;
try {
conn = ds.getConnection();
... use the connection as needed ...
conn.close(); // Returns this connection to the pool
} catch (SQLException e) {
... deal with any exception ...
} finally {
if (conn != null) {
try {
conn.close();
} catch (SQLException e) {
...
}
}
}

That way, you're always returning the connection to the pool, even if an
exception occurs while you're using it.

BTW, your MySQL admin will show active connections for all the entries in
the pool, as well as those that have been checked out and are in use.

Craig

On Thu, 10 Feb 2005 10:14:17 -0800, Paul Hsu <[EMAIL PROTECTED]> wrote:
> Hi,
> 
> I have one question about DBCP. I like to know if any one have used 
> BasicDataSource.close(). In my program I set up a BasicDataSource and 
> get connection from MYSQL, I call BasicDataSource.close() right after 
> get connection, I still see the connectioin from MYSQL admin. I just 
> wonder this function is working?
> 
> thanks,
> 
> Paul
>

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: [OT] Test generation

2004-12-02 Thread Bernard D';Have
Have a look at http://www.beust.com/testng/

Bernard

-Original Message-
From: Corey Scott [mailto:[EMAIL PROTECTED] 
Sent: Friday, December 03, 2004 6:11 AM
To: Jakarta Commons Developers List
Subject: [OT] Test generation


A quick question for the collective brains trust.

I have been looking into test (and code) generation and have come to a
unexpected results.
1) JUnitDoclet appears to be the only (reasonable) opensource product around
2) commerical equiv are incredibly expensive
3) JUnitDoclet seems extremely like a decent tool, up to a point.  It seems
extremely limited and not terribly configurable (at least easily).  And
support for standard tests or standard layouts for common code structures
does not seem easy/available

This brings me to my questions:
1) Are the statements above correct?  It seems like I must have missed
something
2) Are their any OSS efforts around to produce an extended test generation
framework and maybe a repository of easily customizable tests?
3) If not, is anyone interesting in looking into the creation of such a
thing?

Regards,
Corey

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]