Package org.springframework.jdbc.datasource

Examples of org.springframework.jdbc.datasource.SingleConnectionDataSource


    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            public void configure() {
                ds = new SingleConnectionDataSource(url, user, password, true);

                getContext().getComponent("sql", SqlComponent.class).setDataSource(ds);

                errorHandler(noErrorHandler());
View Full Code Here


    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            public void configure() {
                ds = new SingleConnectionDataSource(url, user, password, true);

                getContext().getComponent("sql", SqlComponent.class).setDataSource(ds);

                errorHandler(noErrorHandler());
               
View Full Code Here

   * The close method will not be called explicitly.
   * @param conn Connection to be used for DB calls
   * @return JdbcTemplate wrapper
   */
  public static JdbcTemplate asJdbcTemplate(Connection conn) {
    return new JdbcTemplate(new SingleConnectionDataSource(conn, true));
  }
View Full Code Here

    @Override
    public void doWork(final DsWork work) {
      this.doWork(new DbWork() {
        @Override
        public void execute(Connection conn) {
          work.execute(new SingleConnectionDataSource(conn, false));
        }
      });
    }
View Full Code Here

    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            public void configure() {
                ds = new SingleConnectionDataSource(url, user, password, true);
                getContext().getComponent("sql", SqlComponent.class).setDataSource(ds);

                from("direct:simple").to("sql:select * from projects where id = # order by id").to("mock:result");
            }
        };
View Full Code Here

    given(preparedStatement.executeQuery()).willReturn(resultSet);
    given(resultSet.next()).willReturn(true, true, false);
    given(resultSet.getString(1)).willReturn("tb1", "tb2");
    given(resultSet.getInt(2)).willReturn(1, 2);
    template = new JdbcTemplate();
    template.setDataSource(new SingleConnectionDataSource(connection, false));
    template.setExceptionTranslator(new SQLStateSQLExceptionTranslator());
    template.afterPropertiesSet();
  }
View Full Code Here

      given(resultSetMetaData.getColumnLabel(2)).willReturn("age");
      given(resultSetMetaData.getColumnLabel(3)).willReturn("birth_date");
      given(resultSetMetaData.getColumnLabel(4)).willReturn("balance");

      jdbcTemplate = new JdbcTemplate();
      jdbcTemplate.setDataSource(new SingleConnectionDataSource(connection, false));
      jdbcTemplate.setExceptionTranslator(new SQLStateSQLExceptionTranslator());
      jdbcTemplate.afterPropertiesSet();
    }
View Full Code Here

    given(this.connection.isClosed()).willReturn(false);
    given(this.connection.createStatement()).willReturn(this.preparedStatement);
    // if close is called entire test will fail
    willThrow(new RuntimeException()).given(this.connection).close();

    SingleConnectionDataSource scf = new SingleConnectionDataSource(this.dataSource.getConnection(), false);
    this.template = new JdbcTemplate(scf, false);
    RowCountCallbackHandler rcch = new RowCountCallbackHandler();
    this.template.query(sql, rcch);

    verify(this.resultSet).close();
View Full Code Here

        JdbcTemplate jdbcTemplate = new JdbcTemplate(createDataSource());
        jdbcTemplate.execute("drop table projects");
    }

    private DataSource createDataSource() {
        return new SingleConnectionDataSource(url, user, password, true);
    }
View Full Code Here

    @Override
    protected RouteBuilder createRouteBuilder() throws Exception {
        return new RouteBuilder() {
            public void configure() {
                ds = new SingleConnectionDataSource(url, user, password, true);

                getContext().getComponent("sql", SqlComponent.class).setDataSource(ds);

                errorHandler(noErrorHandler());
View Full Code Here

TOP

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

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.