本文整理匯總了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());
}