Package org.springframework.jdbc.datasource

Examples of org.springframework.jdbc.datasource.DriverManagerDataSource


        };
    }

    @Before
    public void setUp() throws Exception {
        DriverManagerDataSource dataSource = new SingleConnectionDataSource(url, user, password, true);
        dataSource.setDriverClassName(driverClass);
        ds = dataSource;

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


        this.context = context;
    }

    public JdbcTemplate jdbcTempalte() {
        initContext();
        DriverManagerDataSource dataSource = context.getBean("dataSource", DriverManagerDataSource.class);
        System.out.println("Data source is " + dataSource);
        JdbcTemplate template = new JdbcTemplate(dataSource);
        return template;
    }
View Full Code Here

        }
        return l;
    }

    public List<String> getDBInfo() throws SQLException {
        DriverManagerDataSource dataSource = context.getBean("dataSource", DriverManagerDataSource.class);
        List<String> data;
        try (Connection connect = dataSource.getConnection()) {
            DatabaseMetaData metaData = connect.getMetaData();
            data = new ArrayList<>();
            data.add(metaData.getDatabaseProductName());
            data.add(metaData.getDatabaseProductVersion());
        }
View Full Code Here

        }
        return data;
    }

    public List<String> getDBInfo(String param) throws SQLException {
        DriverManagerDataSource dataSource = context.getBean("dataSource", DriverManagerDataSource.class);
        List<String> list = null;
        try (Connection connect = dataSource.getConnection()) {

            Statement statement = connect.createStatement();
            ResultSet result = statement.getResultSet();
            while (result.next()) {
                list.add(result.getString("topic"));
View Full Code Here

        return emf;
    }

    @Bean
    public DataSource dataSource() {
        DriverManagerDataSource dataSource = new DriverManagerDataSource();
        dataSource.setDriverClassName(env.getProperty("database.connection.driver"));
        dataSource.setUrl(env.getProperty("database.connection.url"));
        dataSource.setUsername(env.getProperty("database.connection.user"));
        dataSource.setPassword(env.getProperty("database.connection.password"));
        return dataSource;
    }
View Full Code Here

    return ds;
  }
 
  static long hsqlDbIdSequence = 0;
  public static synchronized DataSource getDataSource() {
    DriverManagerDataSource ds = new DriverManagerDataSource();
    ds.setDriverClassName("org.hsqldb.jdbcDriver");
    ds.setUrl("jdbc:hsqldb:mem:memDB"+System.currentTimeMillis()+""+(hsqlDbIdSequence++));
    ds.setUsername("sa");
    ds.setPassword("");
    return ds;
  }
View Full Code Here

    InputStream in = LimsDAOTestCase.class.getClassLoader().getResourceAsStream("test.db.properties");
    Properties props = new Properties();
    props.load(in);

    datasource = new DriverManagerDataSource(props.getProperty("db.url"), props.getProperty("db.username"), props.getProperty("db.password"));

    DataObjectFactory dataObjectFactory = new TgacDataObjectFactory();
    LobHandler lh = new DefaultLobHandler();
    JdbcTemplate template = new JdbcTemplate(datasource);
View Full Code Here

    @Value("${db.password}") private String password;

    @Bean
    public DataSource dataSource()
    {
        return new DriverManagerDataSource(driverClass, jdbcUrl, user, password);
    }
View Full Code Here

    @Value("${db.password}") private String password;

    @Bean
    public DataSource dataSource()
    {
        return new DriverManagerDataSource(driverClass, jdbcUrl, user, password);
    }
View Full Code Here

            }
        };
    }

    protected void setUp() throws Exception {
        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('0','jstrachan')");
View Full Code Here

TOP

Related Classes of org.springframework.jdbc.datasource.DriverManagerDataSource

Copyright © 2018 www.massapicom. 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.