use of java.sql.DriverPropertyInfo in project hive by apache.
the class HiveDriver method getPropertyInfo.
@Override
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) throws SQLException {
if (info == null) {
info = new Properties();
}
if ((url != null) && url.startsWith(Utils.URL_PREFIX)) {
info = parseURLforPropertyInfo(url, info);
}
DriverPropertyInfo hostProp = new DriverPropertyInfo(HOST_PROPERTY_KEY, info.getProperty(HOST_PROPERTY_KEY, ""));
hostProp.required = false;
hostProp.description = "Hostname of Hive Server2";
DriverPropertyInfo portProp = new DriverPropertyInfo(PORT_PROPERTY_KEY, info.getProperty(PORT_PROPERTY_KEY, ""));
portProp.required = false;
portProp.description = "Port number of Hive Server2";
DriverPropertyInfo dbProp = new DriverPropertyInfo(DBNAME_PROPERTY_KEY, info.getProperty(DBNAME_PROPERTY_KEY, "default"));
dbProp.required = false;
dbProp.description = "Database name";
DriverPropertyInfo[] dpi = new DriverPropertyInfo[3];
dpi[0] = hostProp;
dpi[1] = portProp;
dpi[2] = dbProp;
return dpi;
}
use of java.sql.DriverPropertyInfo in project Mycat-Server by MyCATApache.
the class DriverPropertyInfoHelper method addPropInfo.
private void addPropInfo(final ArrayList<DriverPropertyInfo> propInfos, final String propName, final String defaultVal, final String description, final String[] choices) {
DriverPropertyInfo newProp = new DriverPropertyInfo(propName, defaultVal);
newProp.description = description;
if (choices != null) {
newProp.choices = choices;
}
propInfos.add(newProp);
}
use of java.sql.DriverPropertyInfo in project Mycat-Server by MyCATApache.
the class DriverPropertyInfoHelper method addPropInfo.
private void addPropInfo(final ArrayList<DriverPropertyInfo> propInfos, final String propName, final String defaultVal, final String description, final String[] choices) {
DriverPropertyInfo newProp = new DriverPropertyInfo(propName, defaultVal);
newProp.description = description;
if (choices != null) {
newProp.choices = choices;
}
propInfos.add(newProp);
}
use of java.sql.DriverPropertyInfo in project robovm by robovm.
the class OldDriverPropertyInfoTest method testPublicFields.
public void testPublicFields() throws Exception {
Class.forName(classname).newInstance();
Properties props = new Properties();
Driver d = DriverManager.getDriver(connectionURL);
DriverPropertyInfo[] info = d.getPropertyInfo(connectionURL, props);
// get the property metadata
String name = info[0].name;
assertNotNull(name);
assertEquals(name, "encoding");
String[] choices = info[0].choices;
assertNull(choices);
boolean required = info[0].required;
assertFalse(required);
String description = info[0].description;
assertNull(description);
}
use of java.sql.DriverPropertyInfo in project robovm by robovm.
the class OldDriverPropertyInfoTest method testDriverPropertyInfoStringString.
public void testDriverPropertyInfoStringString() {
DriverPropertyInfo aDriverPropertyInfo = new DriverPropertyInfo(validName, validValue);
assertNotNull(aDriverPropertyInfo);
assertEquals(aDriverPropertyInfo.name, validName);
assertEquals(aDriverPropertyInfo.value, validValue);
aDriverPropertyInfo = new DriverPropertyInfo(null, null);
assertNotNull(aDriverPropertyInfo);
assertNull(aDriverPropertyInfo.name);
assertNull(aDriverPropertyInfo.value);
}
Aggregations