我有两种显示方法。
1)DB连接打开,并在finally块中关闭连接。
UPDATE department d
SET cat_id = (SELECT COUNT(DISTINCT d2.dname)
FROM department d2
WHERE d2.dname <= d.dname
);
2)从方法1调用的方法
using (OracleConnection connection =
ORAConnection.GetOracleConnection(schemaName))
{
try
{
Load(connection, schemaName);
}
catch (Exception ex)
{
if (connection.State != ConnectionState.Closed)
{
connection.Close();
}
throw new Exception(string.Format("Couldn't get offer by elivery ID ), ex);
}
finally
{
if (connection.State != ConnectionState.Closed)
{
connection.Close();
}
}
}
问题:执行第2步后未关闭连接。如AppDynamics所示,单笔交易的来电数超过2万。