处理Connection的异常信息

git-svn-id: http://code.alibabatech.com/svn/druid/trunk@534 b9813039-fb51-4c41-a8b9-e21c2acb5095
This commit is contained in:
wenshao
2011-08-05 01:55:50 +00:00
parent 8fc589a0a1
commit bafaf34054
@@ -172,8 +172,15 @@ public class PoolableConnection implements PooledConnection, Connection {
}
}
PreparedStatement stmt = conn.prepareStatement(sql);
PreparedStatement stmt = null;
try {
stmt = conn.prepareStatement(sql);
} catch (SQLException ex) {
handleException(ex);
}
holder.getDataSource().initStatement(stmt);
PreparedStatement rtnVal = new PoolablePreparedStatement(this, stmt, key);
@@ -202,8 +209,13 @@ public class PoolableConnection implements PooledConnection, Connection {
}
}
PreparedStatement stmt = conn.prepareStatement(sql, resultSetType, resultSetConcurrency);
PreparedStatement stmt = null;
try {
stmt = conn.prepareStatement(sql, resultSetType, resultSetConcurrency);
} catch (SQLException ex) {
handleException(ex);
}
holder.getDataSource().initStatement(stmt);
PreparedStatement rtnVal = new PoolablePreparedStatement(this, stmt, key);
@@ -231,8 +243,13 @@ public class PoolableConnection implements PooledConnection, Connection {
}
}
PreparedStatement stmt = conn.prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability);
PreparedStatement stmt = null;
try {
stmt = conn.prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability);
} catch (SQLException ex) {
handleException(ex);
}
holder.getDataSource().initStatement(stmt);
PreparedStatement rtnVal = new PoolablePreparedStatement(this, stmt, key);
@@ -258,8 +275,13 @@ public class PoolableConnection implements PooledConnection, Connection {
}
}
PreparedStatement stmt = conn.prepareStatement(sql, columnIndexes);
PreparedStatement stmt = null;
try {
stmt = conn.prepareStatement(sql, columnIndexes);
} catch (SQLException ex) {
handleException(ex);
}
holder.getDataSource().initStatement(stmt);
PreparedStatement rtnVal = new PoolablePreparedStatement(this, stmt, key);
@@ -285,8 +307,13 @@ public class PoolableConnection implements PooledConnection, Connection {
}
}
PreparedStatement stmt = conn.prepareStatement(sql, columnNames);
PreparedStatement stmt = null;
try {
stmt = conn.prepareStatement(sql, columnNames);
} catch (SQLException ex) {
handleException(ex);
}
holder.getDataSource().initStatement(stmt);
PreparedStatement rtnVal = new PoolablePreparedStatement(this, stmt, key);
@@ -312,8 +339,13 @@ public class PoolableConnection implements PooledConnection, Connection {
}
}
PreparedStatement stmt = conn.prepareStatement(sql, autoGeneratedKeys);
PreparedStatement stmt = null;
try {
stmt = conn.prepareStatement(sql, autoGeneratedKeys);
} catch (SQLException ex) {
handleException(ex);
}
holder.getDataSource().initStatement(stmt);
PreparedStatement rtnVal = new PoolablePreparedStatement(this, stmt, key);
@@ -342,8 +374,13 @@ public class PoolableConnection implements PooledConnection, Connection {
}
}
CallableStatement stmt = conn.prepareCall(sql);
CallableStatement stmt = null;
try {
stmt = conn.prepareCall(sql);
} catch (SQLException ex) {
handleException(ex);
}
holder.getDataSource().initStatement(stmt);
CallableStatement rtnVal = new PoolableCallableStatement(this, stmt, key);
@@ -370,8 +407,13 @@ public class PoolableConnection implements PooledConnection, Connection {
}
}
CallableStatement stmt = conn.prepareCall(sql, resultSetType, resultSetConcurrency, resultSetHoldability);
CallableStatement stmt = null;
try {
stmt = conn.prepareCall(sql, resultSetType, resultSetConcurrency, resultSetHoldability);
} catch (SQLException ex) {
handleException(ex);
}
holder.getDataSource().initStatement(stmt);
CallableStatement rtnVal = new PoolableCallableStatement(this, stmt, key);
@@ -398,8 +440,13 @@ public class PoolableConnection implements PooledConnection, Connection {
}
}
CallableStatement stmt = conn.prepareCall(sql, resultSetType, resultSetConcurrency);
CallableStatement stmt = null;
try {
stmt = conn.prepareCall(sql, resultSetType, resultSetConcurrency);
} catch (SQLException ex) {
handleException(ex);
}
holder.getDataSource().initStatement(stmt);
CallableStatement rtnVal = new PoolableCallableStatement(this, stmt, key);
@@ -414,8 +461,13 @@ public class PoolableConnection implements PooledConnection, Connection {
public Statement createStatement() throws SQLException {
checkOpen();
Statement stmt = conn.createStatement();
Statement stmt = null;
try {
stmt = conn.createStatement();
} catch (SQLException ex) {
handleException(ex);
}
holder.getDataSource().initStatement(stmt);
PoolableStatement poolableStatement = new PoolableStatement(this, stmt);
@@ -429,8 +481,13 @@ public class PoolableConnection implements PooledConnection, Connection {
throws SQLException {
checkOpen();
Statement stmt = conn.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability);
Statement stmt = null;
try {
stmt = conn.createStatement(resultSetType, resultSetConcurrency, resultSetHoldability);
} catch (SQLException ex) {
handleException(ex);
}
holder.getDataSource().initStatement(stmt);
PoolableStatement poolableStatement = new PoolableStatement(this, stmt);
@@ -443,8 +500,13 @@ public class PoolableConnection implements PooledConnection, Connection {
public Statement createStatement(int resultSetType, int resultSetConcurrency) throws SQLException {
checkOpen();
Statement stmt = conn.createStatement(resultSetType, resultSetConcurrency);
Statement stmt = null;
try {
stmt = conn.createStatement(resultSetType, resultSetConcurrency);
} catch (SQLException ex) {
handleException(ex);
}
holder.getDataSource().initStatement(stmt);
PoolableStatement poolableStatement = new PoolableStatement(this, stmt);