Package org.springframework.jdbc.datasource

Examples of org.springframework.jdbc.datasource.DriverManagerDataSource


    @Value("${hibernate.hbm2ddl.auto}")
    private String hbm2ddlAuto;

    @Bean
    public DataSource configureDataSource() {
        DriverManagerDataSource dataSource = new DriverManagerDataSource();
        dataSource.setDriverClassName(driver);
        dataSource.setUrl(url);
        dataSource.setUsername(username);
        dataSource.setPassword(password);
        return dataSource;
    }
View Full Code Here


    private String password;

    @Bean
    @Override
    public DataSource dataSource() {
        DriverManagerDataSource dataSource = new DriverManagerDataSource();
        dataSource.setDriverClassName(driver);
        dataSource.setUrl(url);
        dataSource.setUsername(username);
        dataSource.setPassword(password);
        return dataSource;
    }
View Full Code Here

    verify(tx).commit();
  }

  @Test
  public void testTransactionCommitWithNonExistingDatabase() throws Exception {
    final DriverManagerDataSource ds = new DriverManagerDataSource();
    LocalSessionFactoryBean lsfb = new LocalSessionFactoryBean();
    lsfb.setDataSource(ds);
    Properties props = new Properties();
    props.setProperty("hibernate.dialect", HSQLDialect.class.getName());
    props.setProperty("hibernate.cache.provider_class", NoCacheProvider.class.getName());
View Full Code Here

    assertTrue("JTA synchronizations not active", !TransactionSynchronizationManager.isSynchronizationActive());
  }

  @Test
  public void testTransactionCommitWithPreBoundSessionAndNonExistingDatabase() throws Exception {
    final DriverManagerDataSource ds = new DriverManagerDataSource();
    LocalSessionFactoryBean lsfb = new LocalSessionFactoryBean();
    lsfb.setDataSource(ds);
    Properties props = new Properties();
    props.setProperty("hibernate.dialect", HSQLDialect.class.getName());
    props.setProperty("hibernate.cache.provider_class", NoCacheProvider.class.getName());
View Full Code Here

    assertTrue("JTA synchronizations not active", !TransactionSynchronizationManager.isSynchronizationActive());
  }

  @Test
  public void testTransactionCommitWithNonExistingDatabaseAndLazyConnection() throws Exception {
    DriverManagerDataSource dsTarget = new DriverManagerDataSource();
    final LazyConnectionDataSourceProxy ds = new LazyConnectionDataSourceProxy();
    ds.setTargetDataSource(dsTarget);
    ds.setDefaultAutoCommit(true);
    ds.setDefaultTransactionIsolation(Connection.TRANSACTION_READ_COMMITTED);
    //ds.setDefaultTransactionIsolationName("TRANSACTION_READ_COMMITTED");
View Full Code Here

  }

  @Test
  public void testExample4() throws Exception {
    SimpleNamingContextBuilder builder = SimpleNamingContextBuilder.emptyActivatedContextBuilder();
    DataSource ds = new DriverManagerDataSource();
    builder.bind("java:comp/env/jdbc/MyDB", ds);

    PersistenceUnitReader reader = new PersistenceUnitReader(
        new PathMatchingResourcePatternResolver(), new JndiDataSourceLookup());
    String resource = "/org/springframework/orm/jpa/persistence-example4.xml";
View Full Code Here

    assertFalse("Exclude unlisted should default false in 1.0.", info[0].excludeUnlistedClasses());
  }

  @Test
  public void testExampleComplex() throws Exception {
    DataSource ds = new DriverManagerDataSource();

    String resource = "/org/springframework/orm/jpa/persistence-complex.xml";
    MapDataSourceLookup dataSourceLookup = new MapDataSourceLookup();
    Map<String, DataSource> dataSources = new HashMap<String, DataSource>();
    dataSources.put("jdbc/MyPartDB", ds);
View Full Code Here

    }
  }

  public void testSetTypeAfterCompile() {
    TestRdbmsOperation operation = new TestRdbmsOperation();
    operation.setDataSource(new DriverManagerDataSource());
    operation.setSql("select * from mytable");
    operation.compile();
    try {
      operation.setTypes(new int[] {Types.INTEGER });
      fail("Shouldn't allow setting parameters after compile");
View Full Code Here

    }
  }

  public void testDeclareParameterAfterCompile() {
    TestRdbmsOperation operation = new TestRdbmsOperation();
    operation.setDataSource(new DriverManagerDataSource());
    operation.setSql("select * from mytable");
    operation.compile();
    try {
      operation.declareParameter(new SqlParameter(Types.INTEGER));
      fail("Shouldn't allow setting parameters after compile");
View Full Code Here

    }
  }

  public void testCompileTwice() {
    TestRdbmsOperation operation = new TestRdbmsOperation();
    operation.setDataSource(new DriverManagerDataSource());
    operation.setSql("select * from mytable");
    operation.setTypes(null);
    operation.compile();
    operation.compile();
  }
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.