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


Java EmbeddedConnectionPoolDataSource.setDatabaseName方法代码示例

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


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

示例1: IPADatabaseManager

import org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource; //导入方法依赖的package包/类
/**
 * Hidden constructor
 */
private IPADatabaseManager() {
	// we assume database has been created
	// and filled with data
	
	// setup connection pool
	EmbeddedConnectionPoolDataSource dataSource = new EmbeddedConnectionPoolDataSource();
	
	File dbLoc = new File(_dbLoc + File.separator + _dbName);
	boolean create = false;
	if(!dbLoc.exists()) {
		dataSource.setCreateDatabase("create");
		create = true;
	}
	dataSource.setDatabaseName(_dbLoc + File.separator + _dbName);
	
	connPool = new MiniConnectionPoolManager(dataSource, 10);
	
	if(create)
		createDatabase();
	
	LOGGER.info("[IPADatabaseManager]: Database location = " + _dbLoc + File.separator + _dbName +
			", maxConnections = 10");

}
 
开发者ID:phon-ca,项目名称:phon,代码行数:28,代码来源:IPADatabaseManager.java

示例2: before

import org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource; //导入方法依赖的package包/类
@Before
public void before() throws SQLException {
    EmbeddedConnectionPoolDataSource ds = new EmbeddedConnectionPoolDataSource();
    ds.setDatabaseName("memory:testDB");
    ds.setCreateDatabase("create");
    ds.setLogWriter(new PrintWriter(System.out));
    
    try (Connection conn = ds.getConnection();
            Statement statement = conn.createStatement()) {
        statement.execute(
                "CREATE TABLE ACTOR (\n"
                + "    ADDRESS VARCHAR(1024) NOT NULL, \n"
                + "    CHECKPOINT_DATA BLOB NOT NULL,\n"
                + "    CHECKPOINT_MESSAGE_DATA BLOB NOT NULL,\n"
                + "    CHECKPOINT_TIME BIGINT NOT NULL,\n"
                + "    CHECKPOINT_INSTANCE INTEGER NOT NULL,\n"
                + "    IDLE INTEGER NOT NULL,\n"
                + "    DATA BLOB NOT NULL,\n"
                + "    PRIMARY KEY (ADDRESS)\n"
                + ")\n"
        );
        statement.execute(
                "CREATE TABLE MESSAGE_QUEUE (\n"
                + "    MSG_NUMBER INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),\n"
                + "    ADDRESS VARCHAR(1024) NOT NULL,\n"
                + "    DATA BLOB NOT NULL,\n"
                + "    PRIMARY KEY (MSG_NUMBER),\n"
                + "    FOREIGN KEY (ADDRESS) REFERENCES ACTOR(ADDRESS) ON DELETE CASCADE\n"
                + ")\n"
        );
    }
    
    JdbcStore store = JdbcStore.create("actor", ds);
    actorSystem = ActorSystem.builder()
            .withDirectGateway()
            .withActorGateway(1, store)
            .build();
}
 
开发者ID:offbynull,项目名称:actors,代码行数:39,代码来源:ActorSystemTest.java

示例3: before

import org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource; //导入方法依赖的package包/类
@Before
public void before() throws SQLException {
    EmbeddedConnectionPoolDataSource ds = new EmbeddedConnectionPoolDataSource();
    ds.setDatabaseName("memory:testDB");
    ds.setCreateDatabase("create");
    ds.setLogWriter(new PrintWriter(System.out));
    
    try (Connection conn = ds.getConnection();
            Statement statement = conn.createStatement()) {
        statement.execute(
                "CREATE TABLE ACTOR (\n"
                + "    ADDRESS VARCHAR(1024) NOT NULL, \n"
                + "    CHECKPOINT_DATA BLOB NOT NULL,\n"
                + "    CHECKPOINT_MESSAGE_DATA BLOB NOT NULL,\n"
                + "    CHECKPOINT_TIME BIGINT NOT NULL,\n"
                + "    CHECKPOINT_INSTANCE INTEGER NOT NULL,\n"
                + "    IDLE INTEGER NOT NULL,\n"
                + "    DATA BLOB NOT NULL,\n"
                + "    PRIMARY KEY (ADDRESS)\n"
                + ")\n"
        );
        statement.execute(
                "CREATE TABLE MESSAGE_QUEUE (\n"
                + "    MSG_NUMBER INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),\n"
                + "    ADDRESS VARCHAR(1024) NOT NULL,\n"
                + "    DATA BLOB NOT NULL,\n"
                + "    PRIMARY KEY (MSG_NUMBER),\n"
                + "    FOREIGN KEY (ADDRESS) REFERENCES ACTOR(ADDRESS) ON DELETE CASCADE\n"
                + ")\n"
        );
    }
    
    fixture = JdbcStore.create("actor", ds);
}
 
开发者ID:offbynull,项目名称:actors,代码行数:35,代码来源:JdbcStoreTest.java

示例4: before

import org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource; //导入方法依赖的package包/类
@Before
public void before() throws SQLException {
    EmbeddedConnectionPoolDataSource ds = new EmbeddedConnectionPoolDataSource();
    ds.setDatabaseName("memory:testDB");
    ds.setCreateDatabase("create");
    ds.setLogWriter(new PrintWriter(System.out));
    
    try (Connection conn = ds.getConnection();
            Statement statement = conn.createStatement()) {
        statement.execute(
                "CREATE TABLE SERVLET_CLIENT_IN_QUEUE (\n"
                + "MSG_NUMBER INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),\n"
                + " ADDRESS VARCHAR(1024) NOT NULL,\n"
                + " OFFSET INTEGER NOT NULL,\n"
                + " DATA BLOB NOT NULL,\n"
                + " PRIMARY KEY (MSG_NUMBER),\n"
                + " UNIQUE (ADDRESS, OFFSET)\n"
                + ")");
        statement.execute(
                "CREATE TABLE SERVLET_CLIENT_IN_OFFSET (\n"
                + " ADDRESS VARCHAR(1024) NOT NULL,\n"
                + " OFFSET INTEGER NOT NULL,\n"
                + " PRIMARY KEY (ADDRESS)"
                + ")");
        statement.execute(
                "CREATE TABLE SERVLET_CLIENT_OUT_QUEUE (\n"
                + "MSG_NUMBER INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),\n"
                + " ADDRESS VARCHAR(1024) NOT NULL,\n"
                + " OFFSET INTEGER NOT NULL,\n"
                + " DATA BLOB NOT NULL,\n"
                + " PRIMARY KEY (MSG_NUMBER),\n"
                + " UNIQUE (ADDRESS, OFFSET)\n"
                + ")");
        statement.execute(
                "CREATE TABLE SERVLET_CLIENT_OUT_OFFSET (\n"
                + " ADDRESS VARCHAR(1024) NOT NULL,\n"
                + " OFFSET INTEGER NOT NULL,\n"
                + " PRIMARY KEY (ADDRESS)"
                + ")");
    }
    
    fixture = JdbcStore.create("servlet", ds);
}
 
开发者ID:offbynull,项目名称:actors,代码行数:44,代码来源:JdbcStoreTest.java


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