[ 1801842 ] DB connection fix & improvements for concurrent threads.

- Integrating contribution from the Posterita Team.
This commit is contained in:
Heng Sin Low 2007-09-26 09:52:07 +00:00
parent 0c2cb2bc54
commit 19fa509780
1 changed files with 1 additions and 27 deletions

View File

@ -600,33 +600,7 @@ public final class DB
{
if (SQL == null || SQL.length() == 0)
throw new IllegalArgumentException("Required parameter missing - " + SQL);
//
String sql = getDatabase().convertStatement(SQL);
try
{
Connection conn = null;
Trx trx = trxName == null ? null : Trx.get(trxName, true);
if (trx != null)
conn = trx.getConnection();
else
{
if (resultSetConcurrency == ResultSet.CONCUR_UPDATABLE)
conn = DB.getConnectionRW ();
else
conn = DB.getConnectionRO();
}
if (conn == null)
throw new DBException("No Connection");
return conn.prepareCall
(sql, ResultSet.TYPE_FORWARD_ONLY, resultSetConcurrency);
}
catch (SQLException e)
{
log.log(Level.SEVERE, sql, e);
// throw new DBException(e);
}
return null;
return new CCallableStatement(ResultSet.TYPE_FORWARD_ONLY, resultSetConcurrency, SQL, trxName);
} // prepareCall