本文整理汇总了Java中ca.sqlpower.sql.JDBCDataSourceType.setJdbcDriver方法的典型用法代码示例。如果您正苦于以下问题:Java JDBCDataSourceType.setJdbcDriver方法的具体用法?Java JDBCDataSourceType.setJdbcDriver怎么用?Java JDBCDataSourceType.setJdbcDriver使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca.sqlpower.sql.JDBCDataSourceType
的用法示例。
在下文中一共展示了JDBCDataSourceType.setJdbcDriver方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUp
import ca.sqlpower.sql.JDBCDataSourceType; //导入方法依赖的package包/类
/**
* Sets up a MockJDBC database with one table in it called "table".
*/
@Override
protected void setUp() throws Exception {
logger.debug("=====setUp=====");
super.setUp();
DataSourceCollection<SPDataSource> dscol = new PlDotIni();
JDBCDataSourceType dstype = new JDBCDataSourceType();
dstype.setJdbcDriver("ca.sqlpower.testutil.MockJDBCDriver");
JDBCDataSource ds = new JDBCDataSource(dscol);
ds.setParentType(dstype);
ds.setUrl("jdbc:mock:name=refresh_test&tables=table");
ds.setUser("");
ds.setPass("");
db = new SQLDatabase(ds);
db.getConnection().close(); // just make sure the connection gets made
table = db.getTableByName("table");
}
示例2: setUp
import ca.sqlpower.sql.JDBCDataSourceType; //导入方法依赖的package包/类
/**
* Sets up a MockJDBC database with nothing in it. Individual tests can specify
* the structure as required.
*/
@Override
protected void setUp() throws Exception {
logger.debug("=====setUp=====");
super.setUp();
DataSourceCollection<SPDataSource> dscol = new PlDotIni();
JDBCDataSourceType dstype = new JDBCDataSourceType();
dstype.setJdbcDriver("ca.sqlpower.testutil.MockJDBCDriver");
JDBCDataSource ds = new JDBCDataSource(dscol);
ds.setParentType(dstype);
ds.setUrl("jdbc:mock:name=refresh_test");
ds.setUser("");
ds.setPass("");
db = new SQLDatabase(ds);
db.getConnection().close(); // just make sure the connection gets made
con = MockJDBCDriver.getConnection("refresh_test");
assertNotNull(con);
}
示例3: testReverseEngineerAutoInc
import ca.sqlpower.sql.JDBCDataSourceType; //导入方法依赖的package包/类
public void testReverseEngineerAutoInc() throws Exception {
PlDotIni plini = new PlDotIni();
JDBCDataSourceType dst = new JDBCDataSourceType();
dst.setJdbcDriver("ca.sqlpower.testutil.MockJDBCDriver");
plini.addDataSourceType(dst);
JDBCDataSource ds = new JDBCDataSource(plini);
String url = "jdbc:mock:tables=table1" +
"&columns.table1=pkcol,normalcol" +
"&autoincrement_cols=table1.pkcol";
ds.setUrl(url);
ds.setParentType(dst);
ds.setUser("x");
ds.setPass("x");
plini.addDataSource(ds);
SQLDatabase db = new SQLDatabase(ds);
SQLTable t = db.getTableByName("table1");
SQLColumn pkcol = t.getColumnByName("pkcol");
SQLColumn normalcol = t.getColumnByName("normalcol");
assertTrue(pkcol.isAutoIncrement());
assertFalse(normalcol.isAutoIncrement());
}