Пример #1
0
 private Connection getRawConnectionForReadOnly(Options options) {
   try {
     Connection conn = target.getConnection(options);
     conn.setAutoCommit(true);
     conn.setReadOnly(true);
     if (session.getTransactionIsolation() != 0) {
       if (conn.getTransactionIsolation() != session.getTransactionIsolation()) {
         conn.setTransactionIsolation(session.getTransactionIsolation());
       }
     }
     return conn;
   } catch (SQLException e) {
     throw DbException.convert(e);
   }
 }
Пример #2
0
 /**
  * @param options
  * @return
  * @throws SQLException
  */
 private Connection getRawConnection(Options options) throws DbException {
   Connection conn = target.getConnection(options);
   try {
     if (conn.getAutoCommit() != session.getAutoCommit()) {
       conn.setAutoCommit(session.getAutoCommit());
     }
     if (session.getTransactionIsolation() != 0) {
       if (conn.getTransactionIsolation() != session.getTransactionIsolation()) {
         conn.setTransactionIsolation(session.getTransactionIsolation());
       }
     }
     if (conn.isReadOnly() != session.isReadOnly()) {
       conn.setReadOnly(session.isReadOnly());
     }
   } catch (Exception e) {
     throw DbException.convert(e);
   }
   return conn;
 }