KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > snaq > db > AutoCommitValidator


1 /*
2     DBPool - JDBC Connection Pool Manager
3     Copyright (c) Giles Winstanley
4 */

5 package snaq.db;
6
7 import java.sql.*;
8
9 /**
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 {
17     public boolean isValid(Connection con)
18     {
19         try
20         {
21             con.setAutoCommit(true);
22             return true;
23         }
24         catch (SQLException sql) { return false; }
25     }
26 }
Popular Tags