本文整理汇总了Java中ca.sqlpower.sql.JDBCDataSource.setName方法的典型用法代码示例。如果您正苦于以下问题:Java JDBCDataSource.setName方法的具体用法?Java JDBCDataSource.setName怎么用?Java JDBCDataSource.setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca.sqlpower.sql.JDBCDataSource
的用法示例。
在下文中一共展示了JDBCDataSource.setName方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import ca.sqlpower.sql.JDBCDataSource; //导入方法依赖的package包/类
protected void setUp() throws Exception {
super.setUp();
session = new TestingMatchMakerSession() {
@Override
public SQLDatabase getDatabase(JDBCDataSource dataSource) {
return this.db;
};
};
JDBCDataSource dataSource = new JDBCDataSource(
((TestingMatchMakerContext)session.getContext()).getDataSources().get(0));
dataSource.setName("testing datasource");
((TestingMatchMakerContext)session.getContext()).setDataSou2rces(
Collections.singletonList(dataSource));
session.setDatabase(new SQLDatabase());
project = new Project();
project.setSession(session);
}
示例2: makeDefaultDataSource
import ca.sqlpower.sql.JDBCDataSource; //导入方法依赖的package包/类
/**
* Creates a new hsqldb infile database and adds it to the list.
*/
private JDBCDataSource makeDefaultDataSource() {
JDBCDataSource ds = new JDBCDataSource(getPlDotIni());
ds.setName(DEFAULT_REPOSITORY_DATA_SOURCE_NAME);
ds.setPlSchema("public");
ds.setUser("sa");
ds.setPass("");
ds.setUrl("jdbc:hsqldb:file:"+System.getProperty("user.home")+"/.mm/hsql_repository;shutdown=true");
// find HSQLDB parent type
JDBCDataSourceType hsqldbType = null;
for (JDBCDataSourceType type : getPlDotIni().getDataSourceTypes()) {
if ("HSQLDB".equals(type.getName())) {
hsqldbType = type;
break;
}
}
if (hsqldbType == null) {
throw new RuntimeException("HSQLDB Database type is missing in pl.ini");
}
ds.setParentType(hsqldbType);
getPlDotIni().addDataSource(ds);
return ds;
}
示例3: testAddAndRemoveQuery
import ca.sqlpower.sql.JDBCDataSource; //导入方法依赖的package包/类
/**
* Test a query can be added to and removed from a workspace with the
* addChild method. Also checks that the index is correct.
* @throws Exception
*/
public void testAddAndRemoveQuery() throws Exception {
final JDBCDataSource spds = new JDBCDataSource(new StubDataSourceCollection<SPDataSource>());
spds.setName("ds");
WabitDataSource ds = new WabitDataSource(spds);
workspace.addDataSource(ds);
QueryCache q = new QueryCache(new StubSQLDatabaseMapping());
q.setName("query");
workspace.addChild(q, 0);
assertTrue(workspace.getChildren().contains(q));
workspace.removeChild(q);
assertFalse(workspace.getChildren().contains(q));
}
示例4: testNoEmptySimulatedTable
import ca.sqlpower.sql.JDBCDataSource; //导入方法依赖的package包/类
public void testNoEmptySimulatedTable() throws Exception {
session = new TestingMatchMakerSession() {
public SQLDatabase getDatabase(JDBCDataSource dataSource) {
return this.db;
};
};
JDBCDataSource dataSource = new JDBCDataSource(
((TestingMatchMakerContext)session.getContext()).getDataSources().get(0));
dataSource.setName("testing datasource");
((TestingMatchMakerContext)session.getContext()).setDataSou2rces(
Collections.singletonList(dataSource));
session.setDatabase(new SQLDatabase());
project.setSession(session);
SQLTable sourceTable = new SQLTable(session.getDatabase(), true);
session.getDatabase().addChild(sourceTable);
sourceTable.addColumn(new SQLColumn(sourceTable, "pk1", Types.INTEGER, 10, 0));
sourceTable.addToPK(sourceTable.getColumn(0));
project.setSourceTable(sourceTable);
project.setSourceTableIndex(sourceTable.getPrimaryKeyIndex());
project.setResultTableCatalog(null);
project.setResultTableSchema(null);
project.setResultTableName("new_table_that_doesnt_exist");
project.setResultTableSPDatasource("testing datasource");
project.createResultTable();
SQLTable newTable = project.getResultTable();
assertTrue(newTable.getColumns().size() > 0);
SQLTable newTableInDatabase = session.getDatabase().getChildByName("new_table_that_doesnt_exist", SQLTable.class);
assertNotNull(newTableInDatabase);
assertTrue(newTableInDatabase.getColumns().size() > 0);
assertSame(newTable, newTableInDatabase);
}
示例5: getHSQLDBInMemoryDS
import ca.sqlpower.sql.JDBCDataSource; //导入方法依赖的package包/类
/**
* Returns a new SPDataSource which is configured to create
* an in-memory (non persistent) HSQLDB instance. The PL schema is in pl.
*/
public static JDBCDataSource getHSQLDBInMemoryDS() {
final String hsqlUserName = "sa";
final String hsqlPassword = "";
final String hsqlUrl = "jdbc:hsqldb:mem:aname";
JDBCDataSource hsqlDataSource = new JDBCDataSource(new PlDotIni());
hsqlDataSource.getParentType().setJdbcDriver("org.hsqldb.jdbcDriver");
hsqlDataSource.getParentType().setDDLGeneratorClass(HSQLDBDDLGenerator.class.getName());
hsqlDataSource.setName("In-memory HSQLDB");
hsqlDataSource.setUser(hsqlUserName);
hsqlDataSource.setPass(hsqlPassword);
hsqlDataSource.setPlDbType("hsql");
hsqlDataSource.setPlSchema("pl");
hsqlDataSource.setUrl(hsqlUrl);
try {
Connection con = connectToDatabase(hsqlDataSource);
createHsqlPlSchemaIfNecessary(con);
// have to leave connection open (see connectToDatabase())
} catch (Exception ex) {
throw new RuntimeException(ex);
}
return hsqlDataSource;
}
示例6: TableMergeRuleTest
import ca.sqlpower.sql.JDBCDataSource; //导入方法依赖的package包/类
public TableMergeRuleTest(String name) {
super(name);
JDBCDataSource dataSource = new JDBCDataSource(
((TestingMatchMakerContext)testingMatchMakerSession.getContext()).getDataSources().get(0));
dataSource.setName("testing datasource");
((TestingMatchMakerContext)session.getContext()).setDataSou2rces(
Collections.singletonList(dataSource));
}