Package java.sql

Examples of java.sql.Statement.cancel()


        if (requestCancle) return ; // balk

        requestCancle = true ;
        try {
            Statement stmt = getStatement();
            stmt.cancel();
        } catch (NullPointerException ex) {
            throw new InterruptedException("can't canceled because of Query is not running, Maybe query is not initialized or is already completed");
        } catch (SQLException ex) {
            throw ex ;
        } finally{
View Full Code Here


            stmt.executeUpdate("INSERT INTO T_PRE_STMT_TEST (ID, NAME, BIRTHDATE) VALUES (4, 'D', NULL)",
                               new int[] { 1 });
            stmt.executeUpdate("INSERT INTO T_PRE_STMT_TEST (ID, NAME, BIRTHDATE) VALUES (5, 'E', NULL)",
                               new String[] { "ID" });
            try {
                stmt.cancel();
            } catch (SQLFeatureNotSupportedException ex) {
            }

            stmt.execute("SELECT * FROM T_PRE_STMT_TEST");
            Assert.assertFalse(stmt.getMoreResults(Statement.CLOSE_CURRENT_RESULT));
View Full Code Here

        stmt.execute(sql);
        stmt.addBatch(sql);
        stmt.executeBatch();
        stmt.executeQuery(sql);
        stmt.executeUpdate(sql);
        stmt.cancel();

        PreparedStatement pstmt = conn.prepareStatement(sql);
        pstmt.setArray(1, null);
        pstmt.setAsciiStream(2, null);
        pstmt.setBigDecimal(3, null);
View Full Code Here

        SQLException exception = new SQLException("xx", "xxx", 28);
        mockConn.setError(exception);

        SQLException stmtErrror = null;
        try {
            stmt.cancel();
        } catch (SQLException ex) {
            stmtErrror = ex;
        }
        Assert.assertNotNull(stmtErrror);
        Assert.assertSame(exception, stmtErrror);
View Full Code Here

      closedConn = getConnectionWithProps((String)null);
      cancelStmt = closedConn.createStatement();
   
      closedConn.close();

      cancelStmt.cancel();
    } finally {
      if (cancelStmt != null) {
        cancelStmt.close();
      }
     
View Full Code Here

                sleep(5000);
              } catch (InterruptedException iEx) {
                // ignore
              }

              cancelStmt.cancel();
            } catch (SQLException sqlEx) {
              throw new RuntimeException(sqlEx.toString());
            }
          }
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.