Package org.springframework.jdbc.core

Examples of org.springframework.jdbc.core.JdbcTemplate.execute()


        DriverManagerDataSource dataSource = new DriverManagerDataSource(url, user, password);
        dataSource.setDriverClassName(driverClass);
        ds = dataSource;

        JdbcTemplate jdbc = new JdbcTemplate(ds);
        jdbc.execute("create table customer (id varchar(15), name varchar(10))");
        jdbc.execute("insert into customer values('cust1','jstrachan')");
        jdbc.execute("insert into customer values('cust2','nsandhu')");
        super.setUp();
    }
View Full Code Here


        dataSource.setDriverClassName(driverClass);
        ds = dataSource;

        JdbcTemplate jdbc = new JdbcTemplate(ds);
        jdbc.execute("create table customer (id varchar(15), name varchar(10))");
        jdbc.execute("insert into customer values('cust1','jstrachan')");
        jdbc.execute("insert into customer values('cust2','nsandhu')");
        super.setUp();
    }

    @After
View Full Code Here

        ds = dataSource;

        JdbcTemplate jdbc = new JdbcTemplate(ds);
        jdbc.execute("create table customer (id varchar(15), name varchar(10))");
        jdbc.execute("insert into customer values('cust1','jstrachan')");
        jdbc.execute("insert into customer values('cust2','nsandhu')");
        super.setUp();
    }

    @After
    public void tearDown() throws Exception {
View Full Code Here

    @After
    public void tearDown() throws Exception {
        super.tearDown();
        JdbcTemplate jdbc = new JdbcTemplate(ds);
        jdbc.execute("drop table customer");
    }

}
View Full Code Here

  @Test
  public void testHiveConnection() throws Exception {
    JdbcTemplate jdbc = ctx.getBean("template", JdbcTemplate.class);
    String tableName = "testHiveDriverTable";

    jdbc.execute("drop table if exists " + tableName);
    jdbc.execute("create table " + tableName + " (key int, value string)");
    jdbc.query("show tables", new ResultSetExtractor<String>() {
      public String extractData(ResultSet rs) throws SQLException, DataAccessException {
        return "";
      }
View Full Code Here

  public void testHiveConnection() throws Exception {
    JdbcTemplate jdbc = ctx.getBean("template", JdbcTemplate.class);
    String tableName = "testHiveDriverTable";

    jdbc.execute("drop table if exists " + tableName);
    jdbc.execute("create table " + tableName + " (key int, value string)");
    jdbc.query("show tables", new ResultSetExtractor<String>() {
      public String extractData(ResultSet rs) throws SQLException, DataAccessException {
        return "";
      }
    });
View Full Code Here

            dataSource.setDriverClassName(properties.getProperty("jdbc.driver"));
            dataSource.setUrl(properties.getProperty("jdbc.url") + dataSourceName + ";DB_CLOSE_DELAY=-1");
            dataSource.setUsername(properties.getProperty("jdbc.username"));
            dataSource.setPassword(properties.getProperty("jdbc.password"));
            JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
            jdbcTemplate.execute("create table db_name (name varchar(128))");
            jdbcTemplate.update("insert into db_name values ('" + dataSourceName + "')");
        }
    }

    @Test
View Full Code Here

    jdbcTemplate.setDataSource(dataSource);

    TransactionStatus status = txnManager.getTransaction(new DefaultTransactionDefinition());
    try {
      long id = 1;
      jdbcTemplate.execute("DELETE FROM COP_AUDIT_TRAIL_EVENT");
      System.out.println("wait #1");
      Thread.sleep(10000);
      doTransactional(dataSource, "INSERT INTO COP_AUDIT_TRAIL_EVENT (SEQ_ID, OCCURRENCE, CONVERSATION_ID, LOGLEVEL, CONTEXT, LONG_MESSAGE) VALUES ("+(id++)+", SYSTIMESTAMP, '123', 1, 'CTX', 'Hello World!')");
      doTransactional(dataSource, "INSERT INTO COP_AUDIT_TRAIL_EVENT (SEQ_ID, OCCURRENCE, CONVERSATION_ID, LOGLEVEL, CONTEXT, LONG_MESSAGE) VALUES ("+(id++)+", SYSTIMESTAMP, '123', 1, 'CTX', 'Hello World!')");
      System.out.println("wait #2");
View Full Code Here

        assertEquals("reconciled@syncope.apache.org", userTO.getAttributeMap().get("userId").getValues().get(0));
        assertEquals("suspended", userTO.getStatus());

        // enable user on external resource
        JdbcTemplate jdbcTemplate = new JdbcTemplate(testDataSource);
        jdbcTemplate.execute("UPDATE TEST SET STATUS=TRUE");

        // re-execute the same SyncTask: now user must be active
        preSyncSize = actual.getExecutions().size();

        execution = restTemplate.postForObject(BASE_URL + "task/execute/{taskId}", null, TaskExecTO.class,
View Full Code Here

        String email = userTO.getAttributeMap().get("email").getValues().iterator().next();
        assertNotNull(email);

        // 4. update TESTSYNC on external H2 by changing e-mail address
        JdbcTemplate jdbcTemplate = new JdbcTemplate(testDataSource);
        jdbcTemplate.execute("UPDATE TESTSYNC SET email='updatedSYNCOPE230@syncope.apache.org'");

        // 5. re-execute the SyncTask
        execution = restTemplate.postForObject(BASE_URL + "task/execute/{taskId}", null, TaskExecTO.class,
                task.getId());
        assertEquals("JOB_FIRED", execution.getStatus());
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.