本文整理匯總了Java中java.sql.Driver.getPropertyInfo方法的典型用法代碼示例。如果您正苦於以下問題:Java Driver.getPropertyInfo方法的具體用法?Java Driver.getPropertyInfo怎麽用?Java Driver.getPropertyInfo使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.sql.Driver
的用法示例。
在下文中一共展示了Driver.getPropertyInfo方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: driverPropertyInfoWithoutValues
import java.sql.Driver; //導入方法依賴的package包/類
@Test
public void driverPropertyInfoWithoutValues() throws SQLException
{
Driver driver = getDriver();
DriverPropertyInfo[] properties = driver.getPropertyInfo("jdbc:cloudspanner://localhost", null);
assertEquals(12, properties.length);
for (DriverPropertyInfo property : properties)
{
if (property.name.equals("AllowExtendedMode") || property.name.equals("AsyncDdlOperations")
|| property.name.equals("AutoBatchDdlOperations"))
assertEquals("false", property.value);
else if (property.name.equals("ReportDefaultSchemaAsNull"))
assertEquals("true", property.value);
else
assertNull(property.value);
}
}
示例2: driverPropertyInfoWithURLValues
import java.sql.Driver; //導入方法依賴的package包/類
@Test
public void driverPropertyInfoWithURLValues() throws SQLException
{
Driver driver = getDriver();
DriverPropertyInfo[] properties = driver.getPropertyInfo(
"jdbc:cloudspanner://localhost;Project=adroit-hall-xxx;Instance=test-instance;Database=testdb;PvtKeyPath=C:\\Users\\MyUserName\\Documents\\CloudSpannerKeys\\cloudspanner3.json;SimulateProductName=PostgreSQL",
null);
assertEquals(12, properties.length);
assertEquals("adroit-hall-xxx", properties[0].value);
assertEquals("test-instance", properties[1].value);
assertEquals("testdb", properties[2].value);
assertEquals("C:\\Users\\MyUserName\\Documents\\CloudSpannerKeys\\cloudspanner3.json", properties[3].value);
assertNull(properties[4].value);
assertEquals("PostgreSQL", properties[5].value);
}
示例3: getPropertyInfos
import java.sql.Driver; //導入方法依賴的package包/類
private DriverPropertyInfo[] getPropertyInfos() {
try {
String e = this.hostTextField.getText();
if(e == null || "".equals(e)) {
e = "192.168.0.0";
}
String port = this.portTextField.getText();
if(port == null || "".equals(port)) {
port = "1234";
}
String db = this.databaseTextField.getText();
if(db == null || "".equals(db)) {
db = "test";
}
String prop = this.propertyTextField.getText();
if (prop == null || "".equals(prop)) {
prop = "";
}
String driverURL = FieldConnectionEntry.createURL(this.getJDBCProperties(), e, port, db, prop);
Driver driver = DriverManager.getDriver(driverURL);
Properties givenProperties = this.currentlyEditedEntry.getConnectionProperties();
DriverPropertyInfo[] propertyInfo = driver.getPropertyInfo(driverURL, givenProperties);
if(propertyInfo == null) {
propertyInfo = new DriverPropertyInfo[0];
}
return propertyInfo;
} catch (SQLException var8) {
LogService.getRoot().log(Level.SEVERE, "com.rapidminer.gui.tools.dialogs.DatabaseConnectionDialog.loading_jdbc_driver_properties_error", var8);
return null;
}
}
示例4: getProperty
import java.sql.Driver; //導入方法依賴的package包/類
protected static String getProperty(String property, String connectionString, Driver dbDriver){
String ret = null;
if(property != null && !property.isEmpty() && dbDriver != null && connectionString != null && !connectionString.isEmpty()){
try {
for (DriverPropertyInfo dpi : dbDriver.getPropertyInfo(connectionString, null)) {
if(property.equalsIgnoreCase(dpi.name.trim())){
ret = dpi.value;
break;
}
}
} catch (SQLException e) {}
}
return ret;
}
示例5: getPropertyInfo
import java.sql.Driver; //導入方法依賴的package包/類
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException
{
Driver d = getDriverLoading(url);
if(d == null)
{
return new DriverPropertyInfo[0];
}
lastUnderlyingDriverRequested = d;
return d.getPropertyInfo(url, info);
}