public PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency, int resultSetHoldability) throws SQLException {
enlistResource();
if (useStatementCache) {
CacheKey cacheKey = new CacheKey(sql, resultSetType, resultSetConcurrency, resultSetHoldability);
PreparedStatement cachedStmt = jdbcPooledConnection.getCachedStatement(cacheKey);
if (cachedStmt == null) {
PreparedStatement stmt = delegate.prepareStatement(sql, resultSetType, resultSetConcurrency, resultSetHoldability);
cachedStmt = JdbcProxyFactory.INSTANCE.getProxyPreparedStatement(jdbcPooledConnection, stmt, cacheKey);
jdbcPooledConnection.putCachedStatement(cacheKey, cachedStmt);