[Jboss-cvs] JBossAS SVN: r54951 - trunk/connector/src/main/org/jboss/resource/adapter/jdbc/vendor
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Mon Jul 31 18:21:09 EDT 2006
Author: weston.price at jboss.com
Date: 2006-07-31 18:21:08 -0400 (Mon, 31 Jul 2006)
New Revision: 54951
Modified:
trunk/connector/src/main/org/jboss/resource/adapter/jdbc/vendor/DB2ValidConnectionChecker.java
Log:
Fixed lead in statement execution.
Modified: trunk/connector/src/main/org/jboss/resource/adapter/jdbc/vendor/DB2ValidConnectionChecker.java
===================================================================
--- trunk/connector/src/main/org/jboss/resource/adapter/jdbc/vendor/DB2ValidConnectionChecker.java 2006-07-31 21:55:13 UTC (rev 54950)
+++ trunk/connector/src/main/org/jboss/resource/adapter/jdbc/vendor/DB2ValidConnectionChecker.java 2006-07-31 22:21:08 UTC (rev 54951)
@@ -1,30 +1,31 @@
/*
-* JBoss, Home of Professional Open Source
-* Copyright 2005, JBoss Inc., and individual contributors as indicated
-* by the @authors tag. See the copyright.txt in the distribution for a
-* full listing of individual contributors.
-*
-* This is free software; you can redistribute it and/or modify it
-* under the terms of the GNU Lesser General Public License as
-* published by the Free Software Foundation; either version 2.1 of
-* the License, or (at your option) any later version.
-*
-* This software is distributed in the hope that it will be useful,
-* but WITHOUT ANY WARRANTY; without even the implied warranty of
-* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-* Lesser General Public License for more details.
-*
-* You should have received a copy of the GNU Lesser General Public
-* License along with this software; if not, write to the Free
-* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
-* 02110-1301 USA, or see the FSF site: http://www.fsf.org.
-*/
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
package org.jboss.resource.adapter.jdbc.vendor;
import java.io.Serializable;
import java.sql.Connection;
import java.sql.SQLException;
+import java.sql.Statement;
import org.jboss.resource.adapter.jdbc.ValidConnectionChecker;
@@ -36,29 +37,45 @@
*/
public class DB2ValidConnectionChecker implements ValidConnectionChecker, Serializable
{
-
/** The serialVersionUID */
private static final long serialVersionUID = -1256537245822198702L;
-
+
/** The VALID_QUERY */
private static final String VALID_QUERY = "SELECT CURRENT TIMESTAMP FROM SYSIBM.SYSDUMMY1";
-
-
+
public SQLException isValidConnection(final Connection c)
{
SQLException theResult = null;
-
- try{
+ Statement s = null;
- c.createStatement().execute(VALID_QUERY);
-
-
- }catch(SQLException e){
-
+ try
+ {
+
+ s = c.createStatement();
+ s.execute(VALID_QUERY);
+
+ }
+ catch (SQLException e)
+ {
+
theResult = e;
-
+
}
-
+ finally
+ {
+
+ try
+ {
+
+ if (s != null)
+ s.close();
+ }
+ catch (SQLException e)
+ {
+ }
+
+ }
+
return theResult;
}
More information about the jboss-cvs-commits
mailing list