当前位置: 首页>>代码示例>>Java>>正文


Java Driver.getPropertyInfo方法代码示例

本文整理汇总了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);
	}
}
 
开发者ID:olavloite,项目名称:spanner-jdbc,代码行数:18,代码来源:CloudSpannerDriverTest.java

示例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);
}
 
开发者ID:olavloite,项目名称:spanner-jdbc,代码行数:16,代码来源:CloudSpannerDriverTest.java

示例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;
    }
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:37,代码来源:DatabaseConnectionDialog.java

示例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;
}
 
开发者ID:twosigma,项目名称:beaker-notebook-archive,代码行数:15,代码来源:ConnectionStringHolder.java

示例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);
}
 
开发者ID:skeychen,项目名称:dswork.jdbc,代码行数:11,代码来源:DriverSpy.java


注:本文中的java.sql.Driver.getPropertyInfo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。