本文整理汇总了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);
}