Package java.sql

Examples of java.sql.Connection.clearWarnings()


        if(obj instanceof Connection) {
            Connection conn = (Connection)obj;
            if(!conn.getAutoCommit() && !conn.isReadOnly()) {
                conn.rollback();
            }
            conn.clearWarnings();
            conn.setAutoCommit(true);
        }
        if(obj instanceof DelegatingConnection) {
            ((DelegatingConnection)obj).passivate();
        }
View Full Code Here


        }

        Connection con = info.getPooledConnection().getConnection();
        try {
            setupDefaults(con, username);
            con.clearWarnings();
            return con;
        } catch (SQLException ex) { 
            try {
                con.close();
            } catch (Exception exc) {
View Full Code Here

            if ((!isAutoCommit) && (!isReadOnly)) {
                conn.rollback();
            }

            // 第三步,清楚警告信息,重设autoCommit为true
            conn.clearWarnings();
            if (!isAutoCommit) {
                conn.setAutoCommit(true);
            }

            // 第四步,检查是符合MaxIdle的设定
View Full Code Here

          // This connection isn't usable.
          return null;
        }

        cached.rollback(); // Reset any transaction state.
        cached.clearWarnings();

        LOG.debug("Got cached connection for " + key);
      }

      return cached;
View Full Code Here

                ResultSet.CONCUR_READ_ONLY);
        // We should have gotten no warnings and a read only forward only cursor
        warning = conn.getWarnings();
        assertNull(warning);

        conn.clearWarnings();

        // Verify that setMaxRows(-1) fails
        try {
            s_f_r.setMaxRows(-1);
            // Should never get here
View Full Code Here

                ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY);
        // We should have gotten no warnings and a read only forward only cursor
        warning = conn.getWarnings();
        assertNull(warning);
       
        conn.clearWarnings();

        // Verify that result set from statement is
        // scroll insensitive and read only
        rs = ps_f_r.executeQuery();
        assertEquals(ResultSet.TYPE_FORWARD_ONLY, rs.getType());
View Full Code Here

        s_f_r = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY,
                ResultSet.CONCUR_READ_ONLY);
        // We should have gotten no warnings and a read only forward only cursor
        warning = conn.getWarnings();
        assertNull(warning);
        conn.clearWarnings();

        // Verify that setMaxRows(4) succeeds
        s_f_r.setMaxRows(5);
        assertEquals(5, s_f_r.getMaxRows());
View Full Code Here

                ResultSet.CONCUR_READ_ONLY);

        // We should have gotten a warning and a scroll insensitive cursor
        warning = conn.getWarnings();
        assertNotNull(warning);
        conn.clearWarnings();

        // Verify that result set from statement is
        // scroll insensitive and read only
        rs = s_s_r.executeQuery("select * from t");
        assertEquals(ResultSet.TYPE_SCROLL_INSENSITIVE, rs.getType());
View Full Code Here

                ResultSet.CONCUR_UPDATABLE);
        // We should have gotten 1 warning and a updatable scroll
        // insensitive cursor.
        warning = conn.getWarnings();
        assertNotNull(warning);
        conn.clearWarnings();

        // Verify that result set from statement is
        // scroll insensitive and read only
        rs = s_s_u.executeQuery("select * from t");
        assertEquals(ResultSet.TYPE_SCROLL_INSENSITIVE, rs.getType());
View Full Code Here

        // We should not have gotten any warnings
        // and should have gotten a scroll insensitive cursor
        warning = conn.getWarnings();
        assertNull(warning);

        conn.clearWarnings();

        // run a query
        rs = s_i_r.executeQuery("select * from t");
        // verify scroll insensitive and read only
        assertEquals(ResultSet.TYPE_SCROLL_INSENSITIVE, rs.getType());
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.