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.lz.generation.step.ColumnRangePartitioner.java

/**
 * The data source for connecting to the database.
 *
 * @param dataSource a {@link DataSource}
 *///from  ww w  . ja  v a 2 s.  c  o  m
public void setDataSource(DataSource dataSource) {
    jdbcTemplate = new JdbcTemplate(dataSource);
}

From source file:com.beezas.dao.DiscountDaoImpl.java

public List<Discount> getDiscountList() {
    List discountList = new ArrayList();

    String sql = "select * from discount";
    jdbcTemplate = new JdbcTemplate(dataSource);

    discountList = jdbcTemplate.query(sql, new DiscountRowMapper());
    System.out.println("bbbbbbb" + discountList);

    return discountList;
}

From source file:org.cloudfoundry.identity.uaa.rest.jdbc.JdbcPagingListTests.java

@Before
public void createDatasource() throws Exception {

    template = new JdbcTemplate(dataSource);
    template.execute("create table foo (id integer primary key, name varchar(10) not null)");
    template.execute("insert into foo (id, name) values (0, 'foo')");
    template.execute("insert into foo (id, name) values (1, 'bar')");
    template.execute("insert into foo (id, name) values (2, 'baz')");
    template.execute("insert into foo (id, name) values (3, 'zab')");
    template.execute("insert into foo (id, name) values (4, 'rab')");

}

From source file:com.jd.survey.dao.survey.QuestionStatisticMSSQLDAOImp.java

@Autowired
public void setBasicDataSource(DataSource basicDataSource) {
    this.jdbcTemplate = new JdbcTemplate(basicDataSource);

}

From source file:org.trustedanalytics.servicebroker.hive.config.ServiceInstanceProvisioningConfig.java

@Bean
public JdbcOperations hiveOperations(Driver driver) throws IOException {
    String hiveUrl = hiveClient.getConnectionUrl();
    LOGGER.info("Creating jdbc template for url: " + hiveUrl);
    if (!hiveClient.isKerberosEnabled()) {
        return new JdbcTemplate(new SimpleDriverDataSource(driver, hiveUrl));
    }//  www.j  av  a2 s. c  o  m
    return kerberizedHiveOperations(hiveUrl);
}

From source file:com.acme.spring.jdbc.repository.impl.JdbcStockRepository.java

/**
 * <p>Sets the data source.</p>
 *
 * @param dataSource the data source//from  w ww . j  a v a2  s .c o  m
 */
@Autowired
public void setDataSource(DataSource dataSource) {

    jdbcTemplate = new JdbcTemplate(dataSource);
}

From source file:com.iucosoft.eavertizare.dao.impl.ClientsDaoImpl.java

@Override
public void update(Firma firma, Client client) {
    String query = "update " + firma.getTabelaClientiLocal() + " set"
            + " nume=?, prenume=?, nr_telefon=?, email=?, " + "data_expirare=?, trimis=? where id=?";
    JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
    Object[] args = new Object[] { client.getNume(), client.getPrenume(), client.getNrTelefon(),
            client.getEmail(), new java.sql.Timestamp(client.getDateExpirare().getTime()), client.isTrimis(),
            client.getId() };//  ww  w .  j  a  v a 2  s  . c  o m

    jdbcTemplate.update(query, args);
}

From source file:com.vladmihalcea.util.DatabaseScriptLifecycleHandler.java

public DatabaseScriptLifecycleHandler(DataSource dataSource, Resource[] initScripts,
        Resource[] destroyScripts) {
    this.jdbcTemplate = new JdbcTemplate(dataSource);
    this.initScripts = initScripts;
    this.destroyScripts = destroyScripts;
}

From source file:com.rplt.studioMusik.studioMusik.StudioMusikDAO.java

@Override
public List<StudioMusik> getDataList() {
    List studioList = new ArrayList();

    String sql = "SELECT * FROM studio_musik";

    JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
    studioList = jdbcTemplate.query(sql, new StudioMusikRowMapper());
    return studioList;
}

From source file:com.sktelecom.cep.notebook.repo.JDBCNotebookRepo.java

public JDBCNotebookRepo(ZeppelinConfiguration conf) throws IOException, NamingException {
    this.conf = conf;

    Context ctx = new InitialContext();
    dataSource = (DataSource) ctx.lookup("java:comp/env/jdbc/cepDS");
    this.jdbcTemplate = new JdbcTemplate(dataSource);
}