Package java.sql

Examples of java.sql.CallableStatement.execute()


      assertEquals(2011, rs.getInt(1));
    }
   
    @Test public void testSetProperty() throws Exception {
      CallableStatement s = connection.prepareCall("{? = call sysadmin.setProperty((select uid from tables where name='vw'), 'foo', 'bar')}");
      assertFalse(s.execute());
      assertNull(s.getClob(1));
     
      Statement stmt = connection.createStatement();
      ResultSet rs = stmt.executeQuery("select name, \"value\" from properties where uid = (select uid from tables where name='vw')");
      rs.next();
View Full Code Here


      assertEquals("bar", rs.getString(2));
    }
   
    @Test(expected=SQLException.class) public void testSetProperty_Invalid() throws Exception {
      CallableStatement s = connection.prepareCall("{? = call sysadmin.setProperty('ah', 'foo', 'bar')}");
      s.execute();
    }
   
    @Test public void testAlterView() throws Exception {
      Statement s = connection.createStatement();
      ResultSet rs = s.executeQuery("select * from vw");
View Full Code Here

        assertEquals(Integer[].class.getName(), rs.getObject(1).getClass().getName());

        CallableStatement call = conn.prepareCall("{ ? = call array_test(?) }");
        call.setObject(2, new Integer[] { 2, 1 });
        call.registerOutParameter(1, Types.ARRAY);
        call.execute();
        assertEquals(Integer[].class.getName(), call.getArray(1).getArray().getClass().getName());
        assertEquals(new Integer[] { 2, 1 }, (Integer[]) call.getObject(1));

        stat.execute("drop alias array_test");
View Full Code Here

    private void testCallWithResultSet(Connection conn) throws SQLException {
        CallableStatement call;
        ResultSet rs;
        call = conn.prepareCall("select 10");

        call.execute();
        rs = call.getResultSet();
        rs.next();
        assertEquals(10, rs.getInt(1));

        call.executeUpdate();
View Full Code Here

        CallableStatement call;
        for (String s : new String[]{"{?= call abs(?)}", " { ? = call abs(?)}", " {? = call abs(?)}"}) {
            call = conn.prepareCall(s);
            call.setInt(2, -3);
            call.registerOutParameter(1, Types.INTEGER);
            call.execute();
            assertEquals(3, call.getInt(1));
            call.executeUpdate();
            assertEquals(3, call.getInt(1));
        }
    }
View Full Code Here

        ResultSet rs;
        stat.execute("CREATE TABLE TEST(ID INT, NAME VARCHAR)");
        call = conn.prepareCall("INSERT INTO TEST VALUES(?, ?)");
        call.setInt(1, 1);
        call.setString(2, "Hello");
        call.execute();
        call = conn.prepareCall("SELECT * FROM TEST",
                ResultSet.TYPE_FORWARD_ONLY,
                ResultSet.CONCUR_READ_ONLY);
        rs = call.executeQuery();
        rs.next();
View Full Code Here

        CallableStatement proc = null;
        try {
            proc = conn.prepareCall(sql);
            fillStatement(proc, params);
            verboseQuery(sql, params);
            return proc.execute();
        } catch (SQLException e) {
            rethrow(e, sql, params);
        } finally {
            close(proc);
        }
View Full Code Here

      oStmt.registerOutParameter(4, Types.VARCHAR); // path_metadata
      oStmt.registerOutParameter(5, Types.CHAR);    // gu_workarea

      if (DebugFile.trace) DebugFile.writeln("CallableStatement.execute()");

      oStmt.execute();

      sNmMicrosite = oStmt.getString(3);

      bRetVal = (null!=sNmMicrosite);
View Full Code Here

      oStmt.executeQuery("SELECT k_sp_del_adhoc_mailing ('" + getString(DB.gu_mailing) + "')");
      oStmt.close();
      bRetVal = true;
    } else {
      CallableStatement oCall = oConn.prepareCall("{ call k_sp_del_adhoc_mailing ('" + getString(DB.gu_mailing) + "') }");
      bRetVal = oCall.execute();
      oCall.close();
    }
    return bRetVal;   
  }
   
View Full Code Here

        oCall = oConn.prepareCall("{ call " + sStoredProc + " (?,?)}");

        oCall.setString(1, sInstanceNm);
        oCall.registerOutParameter(2, java.sql.Types.CHAR);

        oCall.execute();

        sInstanceId = oCall.getString(2);

        if (JDCConnection.DBMS_ORACLE==oConn.getDataBaseProduct() && null!=sInstanceId)
          sInstanceId = sInstanceId.trim();
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.