当前位置: 首页>>代码示例>>Java>>正文


Java EmbeddedDataSource.setCreateDatabase方法代码示例

本文整理汇总了Java中org.apache.derby.jdbc.EmbeddedDataSource.setCreateDatabase方法的典型用法代码示例。如果您正苦于以下问题:Java EmbeddedDataSource.setCreateDatabase方法的具体用法?Java EmbeddedDataSource.setCreateDatabase怎么用?Java EmbeddedDataSource.setCreateDatabase使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.derby.jdbc.EmbeddedDataSource的用法示例。


在下文中一共展示了EmbeddedDataSource.setCreateDatabase方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setupInitialContext

import org.apache.derby.jdbc.EmbeddedDataSource; //导入方法依赖的package包/类
protected static void setupInitialContext() throws Exception {
    if (System.getProperty(Context.INITIAL_CONTEXT_FACTORY) == null) {
        System.setProperty(Context.INITIAL_CONTEXT_FACTORY, javaURLContextFactory.class.getName());
        System.setProperty(Context.URL_PKG_PREFIXES, "org.apache.naming");
        InitialContext ic = new InitialContext();

        ic.createSubcontext("java:");
        ic.createSubcontext("java:comp");
        ic.createSubcontext("java:comp/env");
        ic.createSubcontext("java:comp/env/jdbc");

        EmbeddedDataSource ds = new EmbeddedDataSource();
        ds.setDatabaseName("memory:testDB");
        ds.setCreateDatabase("create");

        ic.bind("java:comp/env/jdbc/testDS", ds);

    }
}
 
开发者ID:geetools,项目名称:geeMVC-Java-MVC-Framework,代码行数:20,代码来源:BaseTest.java

示例2: configs

import org.apache.derby.jdbc.EmbeddedDataSource; //导入方法依赖的package包/类
@Parameterized.Parameters
    public static Collection<Object[]> configs() {
        EmbeddedDataSource derbyDs = new EmbeddedDataSource();
        derbyDs.setDatabaseName("test");
        derbyDs.setCreateDatabase("create");

        JdbcDataSource h2Ds = new JdbcDataSource();
        h2Ds.setURL("jdbc:h2:mem:test;DB_CLOSE_DELAY=-1;MODE=PostgreSQL");

        // Tests on postgres disabled

//        PGPoolingDataSource postgresDs = new PGPoolingDataSource();
//        postgresDs.setServerName("localhost");
//        postgresDs.setDatabaseName("syndesis");
//        postgresDs.setUser("postgres");
//        postgresDs.setPassword("password");

        return Arrays.asList(new Object[][]{
            {derbyDs},
//            {postgresDs},
            {h2Ds}
        });
    }
 
开发者ID:syndesisio,项目名称:syndesis-rest,代码行数:24,代码来源:SqlFileStoreTest.java

示例3: createDataSource

import org.apache.derby.jdbc.EmbeddedDataSource; //导入方法依赖的package包/类
public static DataSource createDataSource(String homeDir) throws IOException {

        // Setup the Derby datasource.
        System.setProperty("derby.system.home", homeDir);
        System.setProperty("derby.storage.fileSyncTransactionLog", "true");
        System.setProperty("derby.storage.pageCacheSize", "100");

        final EmbeddedDataSource ds = new EmbeddedDataSource();
        ds.setDatabaseName("derbydb");
        ds.setCreateDatabase("create");
        return ds;
    }
 
开发者ID:DiamondLightSource,项目名称:daq-eclipse,代码行数:13,代码来源:DataSourceServiceSupport.java

示例4: createPersistenceAdapter

import org.apache.derby.jdbc.EmbeddedDataSource; //导入方法依赖的package包/类
@Override
protected PersistenceAdapter createPersistenceAdapter() throws IOException {
   JDBCPersistenceAdapter jdbc = new JDBCPersistenceAdapter();
   EmbeddedDataSource dataSource = new EmbeddedDataSource();
   dataSource.setDatabaseName("derbyDb");
   dataSource.setCreateDatabase("create");
   jdbc.setDataSource(dataSource);
   jdbc.setCleanupPeriod(1000); // set up small cleanup period
   return jdbc;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:11,代码来源:JDBCDurableSubscriptionTest.java

示例5: initDB

import org.apache.derby.jdbc.EmbeddedDataSource; //导入方法依赖的package包/类
private void initDB() {
    try {
        logger.debug("Initializing DB...");
        Database db = new DatabaseIO().read(new InputStreamReader(JvmMonitorLoader.class.getResourceAsStream("/dbSchema.xml"), "UTF-8"));
        Platform platform = PlatformFactory.createNewPlatformInstance(DerbyPlatform.DATABASENAME);
        EmbeddedDataSource dataSource = new EmbeddedDataSource();
        dataSource.setDatabaseName(databasePath + DB_NAME);
        dataSource.setCreateDatabase("create");
        platform.setDataSource(dataSource);
        if (platform.readModelFromDatabase(DB_NAME).getTableCount() == 0) { //TODO is that needed?
            platform.createTables(db, false, false);
        } else {
            platform.alterTables(db, false);
        }
    } catch (DdlUtilsException | UnsupportedEncodingException e) {
        throw new IllegalStateException(e);
    }
}
 
开发者ID:Glamdring,项目名称:jvm-monitor,代码行数:19,代码来源:JvmMonitorLoader.java

示例6: before

import org.apache.derby.jdbc.EmbeddedDataSource; //导入方法依赖的package包/类
@BeforeClass
public void before() {
    storage = new StorageServiceImpl();
    EmbeddedDataSource dataSource = new EmbeddedConnectionPoolDataSource();
    dataSource.setDatabaseName(System.getProperty("java.io.tmpdir") +
            File.separator + "chii2" +
            File.separator + "mqtt" +
            File.separator + "server");
    dataSource.setCreateDatabase("create");
    storage.setDataSource(dataSource);
    storage.start();
    storage.clearTable("MESSAGE_ID");
    storage.clearTable("RETAIN");
    storage.clearTable("INFLIGHT");
    storage.clearTable("QOS2");
    storage.clearTable("SUBSCRIPTION");
}
 
开发者ID:longkerdandy,项目名称:chii2mqtt,代码行数:18,代码来源:StorageServiceImplTest.java

示例7: createEntityManagerFactory

import org.apache.derby.jdbc.EmbeddedDataSource; //导入方法依赖的package包/类
private EntityManagerFactory createEntityManagerFactory() {
	try {
		Properties connectionProperties = new Properties();
		connectionProperties.load(ClassLoader.getSystemResourceAsStream("at/arz/ngs/connection.properties"));
		EmbeddedDataSource dataSource = new EmbeddedDataSource();
		dataSource.setDatabaseName("memory:ngs-service-db");
		dataSource.setCreateDatabase("create");
		EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory(JPA_UNIT_NAME,
				connectionProperties);
		return entityManagerFactory;
	}
	catch (IOException e) {
		throw new RuntimeException("could not load create entity manager factory", e);
	}
}
 
开发者ID:arz-ngs,项目名称:arz-ngs,代码行数:16,代码来源:AbstractJpaIT.java

示例8: setUp

import org.apache.derby.jdbc.EmbeddedDataSource; //导入方法依赖的package包/类
@Before
public void setUp() throws Exception {
    dataSource = new EmbeddedDataSource();
    dataSource.setDatabaseName(dbName);
    dataSource.setCreateDatabase("create");
    conn = dataSource.getConnection();

    TestDb.dropTables(conn);
    TestDb.buildCoffeeTable(conn);
}
 
开发者ID:deeplearning4j,项目名称:DataVec,代码行数:11,代码来源:JDBCRecordReaderTest.java

示例9: provideDataSource

import org.apache.derby.jdbc.EmbeddedDataSource; //导入方法依赖的package包/类
@Singleton
@Provides
DataSource provideDataSource() {
	EmbeddedDataSource ds = new EmbeddedDataSource();
	ds.setDatabaseName("Network");
	ds.setCreateDatabase("create");
	return ds;
}
 
开发者ID:robertgmoss,项目名称:vectorization,代码行数:9,代码来源:AppInjector.java

示例10: create

import org.apache.derby.jdbc.EmbeddedDataSource; //导入方法依赖的package包/类
public DataSource create() {
	EmbeddedDataSource ds = new EmbeddedDataSource();
	ds.setDatabaseName(dbname);
	if (create)
		ds.setCreateDatabase("create");
	return ds;
}
 
开发者ID:robertgmoss,项目名称:vectorization,代码行数:8,代码来源:EmbeddedDataSourceFactory.java

示例11: provideDataSource

import org.apache.derby.jdbc.EmbeddedDataSource; //导入方法依赖的package包/类
@Singleton
@Provides
DataSource provideDataSource() {
	EmbeddedDataSource ds = new EmbeddedDataSource();
	ds.setDatabaseName("Auth");
	ds.setCreateDatabase("create");
	return ds;
}
 
开发者ID:robertgmoss,项目名称:vectorization,代码行数:9,代码来源:AppInjector.java

示例12: initDataSource

import org.apache.derby.jdbc.EmbeddedDataSource; //导入方法依赖的package包/类
private static void initDataSource(String dbname, String user, 
        String password) {
    ds = new EmbeddedDataSource();
    ds.setDatabaseName(dbname);
    ds.setUser(user);
    ds.setPassword(password);
    ds.setCreateDatabase("create");   
}
 
开发者ID:WhiteBearSolutions,项目名称:WBSAirback,代码行数:9,代码来源:DatabaseManager.java

示例13: setup

import org.apache.derby.jdbc.EmbeddedDataSource; //导入方法依赖的package包/类
protected void setup(final EmbeddedDataSource inSource,
        final Properties inProperties) {
	if (inProperties == null) {
		return;
	}
	if (inProperties.containsKey(DataSourceFactory.JDBC_DATABASE_NAME)) {
		inSource.setDatabaseName(inProperties
		        .getProperty(DataSourceFactory.JDBC_DATABASE_NAME));
		inSource.setCreateDatabase("create");
	}
	if (inProperties.containsKey(DataSourceFactory.JDBC_DATASOURCE_NAME)) {
		// not supported?
	}
	if (inProperties.containsKey(DataSourceFactory.JDBC_DESCRIPTION)) {
		// not supported?
	}
	if (inProperties.containsKey(DataSourceFactory.JDBC_NETWORK_PROTOCOL)) {
		// not supported?
	}
	if (inProperties.containsKey(DataSourceFactory.JDBC_PASSWORD)) {
		inSource.setPassword(inProperties
		        .getProperty(DataSourceFactory.JDBC_PASSWORD));
	}
	if (inProperties.containsKey(DataSourceFactory.JDBC_USER)) {
		inSource.setUser(inProperties
		        .getProperty(DataSourceFactory.JDBC_USER));
	}
}
 
开发者ID:aktion-hip,项目名称:relations,代码行数:29,代码来源:TestDataSourceFactoryDerby.java

示例14: setupDatasource

import org.apache.derby.jdbc.EmbeddedDataSource; //导入方法依赖的package包/类
protected void setupDatasource() throws Exception {
    destroyDatasource();

    InitialContext ic = new InitialContext();

    EmbeddedDataSource ds = new EmbeddedDataSource();
    ds.setDatabaseName("memory:testDB");
    ds.setCreateDatabase("create");

    ic.bind("java:comp/env/jdbc/testDS", ds);

}
 
开发者ID:geetools,项目名称:geeMVC-Java-MVC-Framework,代码行数:13,代码来源:BaseTest.java

示例15: createConnection

import org.apache.derby.jdbc.EmbeddedDataSource; //导入方法依赖的package包/类
public static Connection createConnection() throws SQLException {
    MjdbcUtils.loadDriver("org.apache.derby.jdbc.EmbeddedDataSource");

    EmbeddedDataSource ds = new org.apache.derby.jdbc.EmbeddedDataSource();

    ds.setCreateDatabase("create");
    ds.setDatabaseName("memory:testDb");

    Connection conn = ds.getConnection();

    return conn;
}
 
开发者ID:pryzach,项目名称:midao,代码行数:13,代码来源:DerbyParameters.java


注:本文中的org.apache.derby.jdbc.EmbeddedDataSource.setCreateDatabase方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。