Package org.springframework.jdbc.datasource

Examples of org.springframework.jdbc.datasource.SingleConnectionDataSource


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

                SqlEndpoint sql = new SqlEndpoint();
                sql.setJdbcTemplate(new JdbcTemplate(ds));
                sql.setQuery("select * from projects");

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

            this.jdbcOperations.execute(new ConnectionCallback<Object>() {
                @Override
                public Object doInConnection(Connection con) throws SQLException, DataAccessException {
                    //This is horribly hacky but we can't rely on the main uPortal TM directly or we get
                    //into a circular dependency loop from JPA to Ehcache to jGroups and back to JPA
                    final DataSource ds = new SingleConnectionDataSource(con, true);
                    final PlatformTransactionManager ptm = new DataSourceTransactionManager(ds);
                    final TransactionOperations to = new TransactionTemplate(ptm);
                   
                    to.execute(new TransactionCallbackWithoutResult() {
                        @Override
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 license = # order by id")
                    .to("mock:result");
View Full Code Here

        // Logger.getLogger(org.springframework.jdbc.datasource.DataSourceUtils.class).setLevel(Level.INFO);
        // Logger.getLogger("org.springframework.jdbc.core.JdbcTemplate").setLevel(Level.WARN);
        // Logger.getLogger("org.springframework.beans").setLevel(Level.WARN);
        // Logger.getLogger("org.springframework.jdbc.support").setLevel(Level.WARN);

        this.template = new JdbcTemplate(new SingleConnectionDataSource(this.connection, false));
    }
View Full Code Here

@Configuration
public class ColumnRangePartitionerConfiguration {

  @Bean
  DataSource dataSource() {
    return new SingleConnectionDataSource("jdbc:hsqldb:mem:test", "sa", "", true);
  }
View Full Code Here

  @Test
  public void testPartitionedSql() throws Exception {
    factory.setColumnNames("foo, bar");
    factory.setTableName("baz");
    factory.setPartitionClause("WHERE foo BETWEEN 17 AND 42");
    DataSource dataSource = new SingleConnectionDataSource("jdbc:hsqldb:mem:test", "sa", "", false);
    factory.setDataSource(dataSource);
    factory.afterPropertiesSet();
    assertEquals("Partitioned SQL", "SELECT foo, bar FROM baz WHERE foo BETWEEN 17 AND 42",
        ReflectionTestUtils.getField(factory, "sql"));
  }
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

  private DriverManagerDataSource dataSource;

  @Before
  public void init() {
    EmbeddedDatabaseConnection db = EmbeddedDatabaseConnection.HSQL;
    this.dataSource = new SingleConnectionDataSource(db.getUrl(), "sa", "", false);
    this.dataSource.setDriverClassName(db.getDriverClassName());
  }
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.