當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。