01: /*
02: DBPool - JDBC Connection Pool Manager
03: Copyright (c) Giles Winstanley
04: */
05: package snaq.db;
06:
07: import java.sql.*;
08:
09: /**
10: * Validates database connections by issuing a <tt>setAutoCommit(true)</tt>
11: * method call on the connection. This class is provided as a convenience for
12: * providing basic connection validation.
13: * @author Giles Winstanley
14: */
15: public class AutoCommitValidator implements ConnectionValidator {
16: public boolean isValid(Connection con) {
17: try {
18: con.setAutoCommit(true);
19: return true;
20: } catch (SQLException sql) {
21: return false;
22: }
23: }
24: }
|