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.wlami.mibox.client.db.DbBootstraper.java

public static void bootstrap(DataSource dataSource) {
    JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
    try {/*from   w ww  .  java 2s .c om*/
        jdbcTemplate.execute("SELECT 1 FROM meta_sync");
    } catch (DataAccessException e) {
        jdbcTemplate.execute(CREATE_TABLE_META_SYNC);
    }
}

From source file:factory.JdbcTemplateFactory.java

public static JdbcTemplate getClearQuestDBTemplate() throws SQLException {
    String cq_user = Configuration.getConfig_properties().getProperty("cq.db.user");
    String cq_passwd = Configuration.getConfig_properties().getProperty("cq.db.password");
    String cq_url = Configuration.getConfig_properties().getProperty("cq.db.url");

    OracleDataSource dataSource = new OracleDataSource();
    dataSource.setUser(cq_user);//from   w w  w .  j  a  v  a 2s.c  om
    dataSource.setPassword(cq_passwd);
    dataSource.setURL(cq_url);
    return new JdbcTemplate(dataSource);
}

From source file:com.iih5.smartorm.kit.SpringKit.java

public static JdbcTemplate getJdbcTemplateByDataSource(String dataSourceName) {
    DataSource dataSource = (DataSource) appContext.getBean(dataSourceName);
    return new JdbcTemplate(dataSource);
}

From source file:source.Config.java

public void setConfig(DataSource dataSource) {
    this.dataSource = dataSource;
    template = new JdbcTemplate(dataSource);
}

From source file:database.StudentJDBCTemplate.java

public void setDataSource(DataSource dataSource)

{
    this.dataSource = dataSource;
    this.jdbcTemplateObject = new JdbcTemplate(dataSource);
}

From source file:cn.com.sims.crawler.util.JDBCHelper.java

public static JdbcTemplate createMysqlTemplate(String templateName, String url, String username,
        String password, int initialSize, int maxActive) {
    BasicDataSource dataSource = new BasicDataSource();
    dataSource.setDriverClassName("com.mysql.jdbc.Driver");
    dataSource.setUrl(url);/*  w  w  w.  ja  v a 2 s  .  com*/
    dataSource.setUsername(username);
    dataSource.setPassword(password);
    dataSource.setInitialSize(initialSize);
    dataSource.setMaxActive(maxActive);
    JdbcTemplate template = new JdbcTemplate(dataSource);
    templateMap.put(templateName, template);
    return template;
}

From source file:nbadb.DAO.TeamJDBCTemplate.java

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

From source file:test.StudentJDBCTemplate.java

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

From source file:com.anthony.forumspring.dao.CategorieDao.java

public void setDatasource(DataSource datasource) {
    this.jdbcTemplate = new JdbcTemplate(datasource);
}

From source file:com.javacodegags.waterflooding.model.ResultImplemented.java

public ResultImplemented(DataSource dataSource) {
    jdbcTemplate = new JdbcTemplate(dataSource);
}