Example usage for org.springframework.jdbc.core JdbcTemplate JdbcTemplate

List of usage examples for org.springframework.jdbc.core JdbcTemplate JdbcTemplate

Introduction

In this page you can find the example usage for org.springframework.jdbc.core JdbcTemplate JdbcTemplate.

Prototype

public JdbcTemplate(DataSource dataSource) 

Source Link

Document

Construct a new JdbcTemplate, given a DataSource to obtain connections from.

Usage

From source file:com.googlecode.jdbcproc.daofactory.guice.SimpleModule.java

@Provides
JdbcTemplate provideJDBCTemplate(DataSource dataSource) {
    return new JdbcTemplate(dataSource);
}

From source file:com.team3637.service.ScheduleServiceMySQLImpl.java

@Override
public void setDataSource(DataSource dataSource) {
    this.jdbcTemplateObject = new JdbcTemplate(dataSource);
}

From source file:com.dai.dao.EscalaoDaoImpl.java

@Override
public List<Escalao> listarEscalao() {
    List<Escalao> le = new ArrayList();
    JdbcTemplate template = new JdbcTemplate(dataSource);
    le = template.query("SELECT * FROM escalao", new EscalaoRowMapper());
    return le;/*from w  w  w  .  j  a va2 s  .  c o  m*/
}

From source file:edu.upenn.cis.orchestra.obsolete.SchemaConverterJDBC.java

public SchemaConverterJDBC(DataSource ds, String jdbcDriver, Schema sc) {
    _jt = new JdbcTemplate(ds);
    _statementsGen = new SchemaConverterStatementsGen(ds, jdbcDriver, sc);
}

From source file:com.gvmax.data.queue.JDBCBasedQueueDAO.java

public JDBCBasedQueueDAO(Class<?> clazz, DataSource dataSource, String tableName, String encKey) {
    this.clazz = clazz;
    this.jdbcTemplate = new JdbcTemplate(dataSource);
    this.tableName = tableName;
    this.enc = new Enc(encKey);
}

From source file:com.sfs.dao.BaseDAOImpl.java

/**
 * Gets the jdbc template reader./*from ww  w  .j  a v  a  2s  .c o  m*/
 *
 * @return the jdbc template reader
 */
protected final JdbcTemplate getJdbcTemplateReader() {
    return new JdbcTemplate(dataSource);
}

From source file:org.wso2.carbon.metrics.impl.ReporterTest.java

public static Test suite() {
    return new TestSetup(new TestSuite(ReporterTest.class)) {

        protected void setUp() throws Exception {
            DataSource dataSource = JdbcConnectionPool.create("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1", "sa", "");
            template = new JdbcTemplate(dataSource);
            ResourceDatabasePopulator populator = new ResourceDatabasePopulator();
            populator.addScript(new ClassPathResource("dbscripts/h2.sql"));
            populator.populate(dataSource.getConnection());

            // Create initial context
            System.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.naming.java.javaURLContextFactory");
            System.setProperty(Context.URL_PKG_PREFIXES, "org.apache.naming");
            InitialContext ic = new InitialContext();
            ic.createSubcontext("jdbc");
            ic.bind("jdbc/WSO2MetricsDB", dataSource);

            // Set setup system property to cover database creator logic
            System.setProperty("setup", "");
        }/*from w w w . jav  a 2 s  .  c o m*/

        protected void tearDown() throws Exception {
            InitialContext ic = new InitialContext();
            ic.unbind("jdbc/WSO2MetricsDB");
            ic.unbind("jdbc");
        }
    };
}

From source file:com.github.totyumengr.minicubes.cluster.DiscardController.java

@RequestMapping(value = "/dummyMerge", method = { RequestMethod.POST, RequestMethod.GET })
public @ResponseBody String mergePrepare(@NotBlank @RequestParam String timeSeries, @RequestParam String sql) {

    LOGGER.info("Try to merge data to {}.", sql, timeSeries);
    JdbcTemplate template = new JdbcTemplate(dataSource);
    template.afterPropertiesSet();/*from w  ww. j  av a2s .  c o  m*/
    template.execute(sql);
    LOGGER.info("Success for merge data to {}.", sql, timeSeries);

    return OK;
}

From source file:com.googlecode.flyway.core.dbsupport.postgresql.PostgreSQLSuperUserMigrationMediumTest.java

@Before
public void setUp() {
    jdbcTemplate = new JdbcTemplate(migrationDataSource);

    flyway = new Flyway();
    flyway.setDataSource(migrationDataSource);
    flyway.setValidationMode(ValidationMode.ALL);
    flyway.clean();//from  w w  w .  j av a2 s . c  o m
}