Package java.sql

Examples of java.sql.CallableStatement.executeUpdate()


      assertEquals(1, callable.getLong(1));

      // Add row with null value
      callable.setLong(2, 2);
      callable.setNull(3, Types.VARCHAR);
      callable.executeUpdate();
      assertEquals(2, callable.getLong(1));

      Method[] setters = CallableStatement.class.getMethods();

      for (int i = 0; i < setters.length; i++) {
View Full Code Here


      callable = aConn.prepareCall("{? = call test_function()}");

      callable.registerOutParameter(1, Types.BIGINT);

      try {
        callable.executeUpdate();
        fail("impossible; we should never get here.");
      } catch (SQLException sqlEx) {
        assertEquals("42S22", sqlEx.getSQLState());
      }
View Full Code Here

      callable = aConn.prepareCall("{? = call test_function(?)}");
      callable.registerOutParameter(1, Types.BIGINT);

      callable.setLong(2, 1);
      callable.executeUpdate();

      callable.setLong(2, 2);

      try {
        callable.executeUpdate();
View Full Code Here

      callable.executeUpdate();

      callable.setLong(2, 2);

      try {
        callable.executeUpdate();
        fail("impossible; we should never get here.");
      } catch (SQLException sqlEx) {
        assertEquals("23000", sqlEx.getSQLState());
      }
    } finally {
View Full Code Here

    cstmt.registerOutParameter(1, java.sql.Types.BIT);
    cstmt.registerOutParameter(2, java.sql.Types.BIT);
    cstmt.registerOutParameter(3, java.sql.Types.BIT);

    System.out.println("execute the procedure");
    cstmt.executeUpdate();

    System.out.println("invoke getBoolean method");
    boolean bRetVal = cstmt.getBoolean(2);
    oRetVal = new Boolean(bRetVal);
    minBooleanVal = new Boolean("false");
View Full Code Here

        CallableStatement statement = connection.prepareCall(sql);
        try {
            LOG.fine(sql + " | " + params);
            setParameters(params, statement);
            configure(statement);
            return statement.executeUpdate();
        }
        catch (SQLException e) {
            LOG.warning("Failed to execute: " + sql + " because: " + e.getMessage());
            throw e;
        }
View Full Code Here

    cstmt.registerOutParameter(1, java.sql.Types.BIT);
    cstmt.registerOutParameter(2, java.sql.Types.BIT);
    cstmt.registerOutParameter(3, java.sql.Types.BIT);

    cstmt.executeUpdate();

    boolean bRetVal = cstmt.getBoolean(2);
    oRetVal = new Boolean(bRetVal);
    minBooleanVal = new Boolean("false");
    this.rs = this.stmt.executeQuery(Min_Val_Query);
View Full Code Here

        // Update the value in the database.
        CallableStatement cstmt = prepareCall(
            "CALL UPDATE_LONGVARBINARY_PROC(?)");
        cstmt.setObject(1,bytearr,java.sql.Types.LONGVARBINARY);
        cstmt.executeUpdate();
       
        // Retrieve the updated value and verify it's correct.
        ResultSet rs = stmt.executeQuery(
            "SELECT LVBC FROM LONGVARBINARY_TABLE");
        assertNotNull("SELECT from LONGVARBINARY_TABLE", rs);
View Full Code Here

          {
            String key = (String) e.nextElement();
            if (oldValues.getProperty(key) == null)
            {
              setDBP.setString(1, key);
              setDBP.executeUpdate();
            }
          }
        } catch (SQLException sqle) {
          if(!sqle.getSQLState().equals(SQLStateConstants.PROPERTY_UNSUPPORTED_CHANGE))
            throw sqle;
View Full Code Here

        }
       
        if (change) {
                setDBP.setString(1, key);
                setDBP.setString(2, value);
                setDBP.executeUpdate();
           }
      }
        conn.commit();
        getDBP.close();
        setDBP.close();
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.