Package org.h2.jdbcx

Examples of org.h2.jdbcx.JdbcDataSource


    private Connection connection;

    @Override
    public void start(BundleContext context) throws Exception
    {
        ds = new JdbcDataSource();
        ds.setURL("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE");

        Dictionary<String, String> props = new Hashtable<String, String>();
        props.put("dataSourceName", "test");
        context.registerService(DataSource.class.getName(), ds, props);
View Full Code Here



    jndiResources = new ArrayList<Resource>();

    // create the real data sources and bind to jndi
    JdbcDataSource realDs1 = new JdbcDataSource();
    realDs1.setUser("sa");
    realDs1.setURL("jdbc:h2:mem:multids1");
    jndiResources.add(new Resource("jdbc/realDs1", realDs1));

    JdbcDataSource realDs2 = new JdbcDataSource();
    realDs2.setUser("sa");
    realDs2.setURL("jdbc:h2:mem:multids2");
    jndiResources.add(new Resource("jdbc/realDs2", realDs2));

    JDBCDataSource realDs3 = new JDBCDataSource();
    realDs3.setUser("sa");
    realDs3.setPassword("");
View Full Code Here

    }

    private static final BasicResponseHandler BASIC_RESPONSE_HANDLER = new BasicResponseHandler();

    private static JdbcDataSource createDataSource(final String url) {
        JdbcDataSource ds = new JdbcDataSource();
        ds.setURL(url);
        return ds;
    }
View Full Code Here

public class JdbcRepositoryTestH2Config extends JdbcRepositoryTestConfig {

  @Bean
  @Override
  public DataSource dataSource() {
    JdbcDataSource ds = new JdbcDataSource();
    ds.setURL("jdbc:h2:mem:DB_CLOSE_DELAY=-1;INIT=RUNSCRIPT FROM 'classpath:schema_h2.sql'");
    return ds;
  }
View Full Code Here

        Class.forName(JDBC_DRIVER);
   
    // Or you can use a spring SingleConnectionDataSource
    // SingleConnectionDataSource realDataSource = new SingleConnectionDataSource(DriverManager.getConnection(JDBC_URL, TESTDB_USERNAME, TESTDB_PASSWORD), false);
   
    JdbcDataSource realDataSource = new JdbcDataSource();
    realDataSource.setURL(JDBC_URL);
    realDataSource.setUser(TESTDB_USERNAME);
    realDataSource.setPassword(TESTDB_PASSWORD);
   
    Log4jdbcProxyDataSource proxyDataSource = new Log4jdbcProxyDataSource(realDataSource);
   
    Connection proxyConnection = proxyDataSource.getConnection();
   
View Full Code Here

        Class.forName(JDBC_DRIVER);
       
        // Or you can use a spring SingleConnectionDataSource
        // SingleConnectionDataSource realDataSource = new SingleConnectionDataSource(DriverManager.getConnection(JDBC_URL, TESTDB_USERNAME, TESTDB_PASSWORD), false);
       
        JdbcDataSource realDataSource = new JdbcDataSource();
        realDataSource.setURL(JDBC_URL);
        realDataSource.setUser(TESTDB_USERNAME);
        realDataSource.setPassword(TESTDB_PASSWORD);
       
        Log4jdbcProxyDataSource proxyDataSource = new Log4jdbcProxyDataSource(realDataSource);
       
        Connection proxyConnection = proxyDataSource.getConnection();
        Statement st = proxyConnection.createStatement();
View Full Code Here

        Class.forName(JDBC_DRIVER);
       
        // Or you can use a spring SingleConnectionDataSource
        // SingleConnectionDataSource realDataSource = new SingleConnectionDataSource(DriverManager.getConnection(JDBC_URL, TESTDB_USERNAME, TESTDB_PASSWORD), false);
       
        JdbcDataSource realDataSource = new JdbcDataSource();
        realDataSource.setURL(JDBC_URL);
        realDataSource.setUser(TESTDB_USERNAME);
        realDataSource.setPassword(TESTDB_PASSWORD);
       
        Log4jdbcProxyDataSource proxyDataSource = new Log4jdbcProxyDataSource(realDataSource);
       
        Connection proxyConnection = proxyDataSource.getConnection();
        Statement st = proxyConnection.createStatement();
View Full Code Here

   * escape character is disabled, to match the DQL behavior (and
   * standard SQL).
   */
  public static Connection getSharedConnection() {
    try {
      JdbcDataSource ds = new JdbcDataSource();
      ds.setURL("jdbc:h2:mem:test;DEFAULT_ESCAPE=");
      ds.setUser("sa");
      ds.setPassword("");
      return ds.getConnection();
    } catch (SQLException e) {
      throw new RuntimeException(e);
    }
  }
View Full Code Here

  private String url;
  private String user;
  private String password;
 
  public H2DBManager() {
    dataSource=new JdbcDataSource();
    connPool = JdbcConnectionPool.create(dataSource);
  }
View Full Code Here

     * @return Returns {@code dataSource} which was initialised by the
     *         constructor.
     */
    @Override
    public DataSource getDataSource(final Map<String, String> attributes) {
        final JdbcDataSource dataSource = new JdbcDataSource();
        dataSource.setURL(getUrl(attributes));
        dataSource.setUser(getUsername());
        dataSource.setPassword(getPassword());
        return dataSource;
    }
View Full Code Here

TOP

Related Classes of org.h2.jdbcx.JdbcDataSource

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.