Example usage for org.springframework.jdbc.datasource DriverManagerDataSource setSchema

List of usage examples for org.springframework.jdbc.datasource DriverManagerDataSource setSchema

Introduction

In this page you can find the example usage for org.springframework.jdbc.datasource DriverManagerDataSource setSchema.

Prototype

public void setSchema(@Nullable String schema) 

Source Link

Document

Specify a database schema to be applied to each Connection.

Usage

From source file:in.sc.dao.ListGenerator.java

public NamedParameterJdbcTemplate getTemplate() {
    if (namedParameterJdbcTemplate == null) {
        DriverManagerDataSource dataSource = new DriverManagerDataSource();
        dataSource.setSchema("smart_compare");
        dataSource.setUsername("root");
        dataSource.setPassword("root");
        dataSource.setUrl("jdbc:mysql://localhost:3306/smart_compare");
        //            dataSource.setPassword("rose@123");
        //            dataSource.setURL("jdbc:mysql://52.42.111.208:3033/smart_compare");

        namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(dataSource);
    }/* w  ww.j a  va  2s.co  m*/
    return namedParameterJdbcTemplate;
}

From source file:in.sc.dao.ProductHelper.java

public NamedParameterJdbcTemplate getTemplate() {
    if (namedParameterJdbcTemplate == null) {
        DriverManagerDataSource dataSource = new DriverManagerDataSource();
        dataSource.setSchema("smart_compare");
        dataSource.setUsername("root");
        dataSource.setPassword("root");
        //            dataSource.setPassword("rose@123");
        dataSource.setUrl("jdbc:mysql://localhost:3306/smart_compare");
        //            dataSource.setURL("jdbc:mysql://52.42.111.208:3033/smart_compare");
        namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(dataSource);
    }/*from   w  w  w  .  ja  v a 2  s .  c o  m*/
    return namedParameterJdbcTemplate;
}