Search in sources :

Example 11 with DriverPropertyInfo

use of java.sql.DriverPropertyInfo in project voltdb by VoltDB.

the class JDBCDriver method getPropertyInfo.

/**
     *  Gets information about the possible properties for this driver. <p>
     *
     *  The getPropertyInfo method is intended to allow a generic GUI tool
     *  to discover what properties it should prompt a human for in order to
     *  get enough information to connect to a database. Note that depending
     *  on the values the human has supplied so far, additional values may
     *  become necessary, so it may be necessary to iterate though several
     *  calls to getPropertyInfo.<p>
     *
     * <!-- start release-specific documentation -->
     * <div class="ReleaseSpecificDocumentation">
     * <h3>HSQLDB-Specific Information:</h3> <p>
     *
     * HSQLDB uses the values submitted in info to set the value for
     * each DriverPropertyInfo object returned. It does not use the default
     * value that it would use for the property if the value is null. <p>
     *
     * </div> <!-- end release-specific documentation -->
     *
     * @param  url the URL of the database to which to connect
     * @param  info a proposed list of tag/value pairs that will be sent on
     *      connect open
     * @return  an array of DriverPropertyInfo objects describing possible
     *      properties. This array may be an empty array if no properties
     *      are required.
     */
public DriverPropertyInfo[] getPropertyInfo(String url, Properties info) {
    if (!acceptsURL(url)) {
        return new DriverPropertyInfo[0];
    }
    String[] choices = new String[] { "true", "false" };
    DriverPropertyInfo[] pinfo = new DriverPropertyInfo[6];
    DriverPropertyInfo p;
    if (info == null) {
        info = new Properties();
    }
    p = new DriverPropertyInfo("user", null);
    p.value = info.getProperty("user");
    p.required = true;
    pinfo[0] = p;
    p = new DriverPropertyInfo("password", null);
    p.value = info.getProperty("password");
    p.required = true;
    pinfo[1] = p;
    p = new DriverPropertyInfo("get_column_name", null);
    p.value = info.getProperty("get_column_name", "true");
    p.required = false;
    p.choices = choices;
    pinfo[2] = p;
    p = new DriverPropertyInfo("ifexists", null);
    p.value = info.getProperty("ifexists", "false");
    p.required = false;
    p.choices = choices;
    pinfo[3] = p;
    p = new DriverPropertyInfo("default_schema", null);
    p.value = info.getProperty("default_schema", "false");
    p.required = false;
    p.choices = choices;
    pinfo[4] = p;
    p = new DriverPropertyInfo("shutdown", null);
    p.value = info.getProperty("shutdown", "false");
    p.required = false;
    p.choices = choices;
    pinfo[5] = p;
    return pinfo;
}
Also used : Properties(java.util.Properties) HsqlDatabaseProperties(org.hsqldb_voltpatches.persist.HsqlDatabaseProperties) HsqlProperties(org.hsqldb_voltpatches.persist.HsqlProperties) DriverPropertyInfo(java.sql.DriverPropertyInfo)

Example 12 with DriverPropertyInfo

use of java.sql.DriverPropertyInfo in project spanner-jdbc by olavloite.

the class ConnectionProperties method getPropertyInfo.

DriverPropertyInfo[] getPropertyInfo() {
    DriverPropertyInfo[] res = new DriverPropertyInfo[12];
    res[0] = new DriverPropertyInfo(PROJECT_URL_PART.substring(0, PROJECT_URL_PART.length() - 1), project);
    res[0].description = "Google Cloud Project id";
    res[1] = new DriverPropertyInfo(INSTANCE_URL_PART.substring(0, INSTANCE_URL_PART.length() - 1), instance);
    res[1].description = "Google Cloud Spanner Instance id";
    res[2] = new DriverPropertyInfo(DATABASE_URL_PART.substring(0, DATABASE_URL_PART.length() - 1), database);
    res[2].description = "Google Cloud Spanner Database name";
    res[3] = new DriverPropertyInfo(KEY_FILE_URL_PART.substring(0, KEY_FILE_URL_PART.length() - 1), keyFile);
    res[3].description = "Path to json key file to be used for authentication";
    res[4] = new DriverPropertyInfo(OAUTH_ACCESS_TOKEN_URL_PART.substring(0, OAUTH_ACCESS_TOKEN_URL_PART.length() - 1), oauthToken);
    res[4].description = "OAuth access token to be used for authentication (optional, only to be used when no key file is specified)";
    res[5] = new DriverPropertyInfo(SIMULATE_PRODUCT_NAME.substring(0, SIMULATE_PRODUCT_NAME.length() - 1), productName);
    res[5].description = "Use this property to make the driver return a different database product name than Google Cloud Spanner, for example if you are using a framework like Spring that use this property to determine how to a generate data model for Spring Batch";
    res[6] = new DriverPropertyInfo(SIMULATE_PRODUCT_MAJOR_VERSION.substring(0, SIMULATE_PRODUCT_MAJOR_VERSION.length() - 1), defaultString(majorVersion));
    res[6].description = "Use this property to make the driver return a different major version number, for example if you are using a framework like Spring that use this property to determine how to a generate data model for Spring Batch";
    res[7] = new DriverPropertyInfo(SIMULATE_PRODUCT_MINOR_VERSION.substring(0, SIMULATE_PRODUCT_MINOR_VERSION.length() - 1), defaultString(minorVersion));
    res[7].description = "Use this property to make the driver return a different minor version number, for example if you are using a framework like Spring that use this property to determine how to a generate data model for Spring Batch";
    res[8] = new DriverPropertyInfo(ALLOW_EXTENDED_MODE.substring(0, ALLOW_EXTENDED_MODE.length() - 1), String.valueOf(allowExtendedMode));
    res[8].description = "Allow the driver to enter 'extended' mode for bulk operations. A value of false (default) indicates that the driver should never enter extended mode. If this property is set to true, the driver will execute all bulk DML-operations in a separate transaction when the number of records affected is greater than what will exceed the limitations of Cloud Spanner.";
    res[9] = new DriverPropertyInfo(ASYNC_DDL_OPERATIONS.substring(0, ASYNC_DDL_OPERATIONS.length() - 1), String.valueOf(asyncDdlOperations));
    res[9].description = "Run DDL-operations (CREATE TABLE, ALTER TABLE, DROP TABLE, etc.) in asynchronous mode. When set to true, DDL-statements will be checked for correct syntax and other basic checks before the call returns. It can take up to several minutes before the statement has actually finished executing. The status of running DDL-operations can be queried by issuing a SHOW_DDL_OPERATIONS statement. DDL-operations that have finished can be cleared from this view by issuing a CLEAN_DDL_OPERATIONS statement.";
    res[10] = new DriverPropertyInfo(AUTO_BATCH_DDL_OPERATIONS.substring(0, AUTO_BATCH_DDL_OPERATIONS.length() - 1), String.valueOf(autoBatchDdlOperations));
    res[10].description = "Automatically batch DDL-operations (CREATE TABLE, ALTER TABLE, DROP TABLE, etc.). When set to true, DDL-statements that are submitted through a Statement (not PreparedStatement) will automatically be batched together and only executed after an EXECUTE_DDL_BATCH statement. This property can be used in combination with the AsyncDdlOperations property to run a batch asynchronously or synchronously.";
    res[11] = new DriverPropertyInfo(REPORT_DEFAULT_SCHEMA_AS_NULL.substring(0, REPORT_DEFAULT_SCHEMA_AS_NULL.length() - 1), String.valueOf(reportDefaultSchemaAsNull));
    res[11].description = "Report the default schema and catalog as null (true) or as an empty string (false).";
    return res;
}
Also used : DriverPropertyInfo(java.sql.DriverPropertyInfo)

Aggregations

DriverPropertyInfo (java.sql.DriverPropertyInfo)12 Properties (java.util.Properties)5 ArrayList (java.util.ArrayList)2 Driver (java.sql.Driver)1 HsqlDatabaseProperties (org.hsqldb_voltpatches.persist.HsqlDatabaseProperties)1 HsqlProperties (org.hsqldb_voltpatches.persist.HsqlProperties)1 PropertyDescriptor (org.jkiss.dbeaver.model.impl.PropertyDescriptor)1 DBPPropertyDescriptor (org.jkiss.dbeaver.model.preferences.DBPPropertyDescriptor)1