This chapter consists of a description of the specified format and data types that can be used in a program using JDBC parameters, and the points to note during use.
Add the JDBC driver file /usr/share/java/gridstore-jdbc.jar
to the class path. When added, the driver will be registered automatically. In addition, import the driver class as follows if necessary (Normally not required).
Class.forName("com.toshiba.mwcloud.gs.sql.Driver");
To secure communication between the GridDB cluster and the client, using the SSL function, additionally specify /usr/share/java/gridstore-advanced.jar
in the class path.
The URL has the following forms (A) to (D). If the multicast method is used to compose a cluster, normally it is connected using method (A). The load will be automatically distributed on the GridDB cluster side and the appropriate nodes will be connected. Connect using other method only if multicast communication with the GridDB cluster is not possible.
(A) If connecting automatically to a suitable node in a GridDB cluster using the multicast method
jdbc:gs://(multicastAddress):(portNo)/(clusterName)/(databaseName)
(B) If connecting directly to a node in a GridDB cluster using the multicast method
jdbc:gs://(nodeAddress):(portNo)/(clusterName)/(databaseName)
(C) If connecting to a GridDB cluster using the fixed list method
If the fixed list method is used to compose a cluster, use this method to connect.
jdbc:gs:///(clusterName)/(databaseName)?notificationMember=(notificationMember)
* notificationMember can be changed by editing the gs_cluster.json file. The port in the address list can be changed by editing the gs_node.json file.
(D) If connecting to a GridDB cluster using the provider method
If the provider method is used to compose a cluster, use this method to connect.
jdbc:gs:///(clusterName)/(databaseName)?notificationProvider=(notificationProvider)
* notificationProvider can be changed by editing the gs_cluster.json file.
If the user name and password are going to be included in the URL in either one of the cases (A) to (D), add them at the end of the URL as shown below.
?user=(user name)&password=(password)
The connection timeout can be set in either of the following methods (A) or (B). Setting (B) is prioritized if both (A) and (B) are set. Default value of 300 seconds (5 minutes) is used if neither (1) or (2) has been set, or if there are no settings.
(A) Specify with the DriverManager#setLoginTimeout (int seconds)
The connection timeout is set in one of the following ways depending on the value of seconds. After setting, the connection timeout will be set in the connections to all the GridDB acquired by the DriverManager#getConnection or Driver#connect.
(B) Specify with DriverManager#getConnection(String url, Properties info) or Driver#connect(String url, Properties info)
Add a property to argument info in the key “loginTimeout”. If the value corresponding to the key “loginTimeout” could be converted to a numerical value, the connection timeout will be set in the connection obtained as follows.
Along with the settings described above, the following information can be set at the time of connection.
Time zone (Z | ±HH:MM | ±HHMM) |
The information above can be set in either of the following methods (A) or (B). An error occurs when the name is specified using both methods.
(A) Specify in URL
For authentication with the GridDB cluster, use internal authentication (INTERNAL) or LDAP authentication (LDAP) according to the cluster settings. To specify the authentication method during connection, add the following to the URL:
?authentication=(INTERNAL|LDAP)
Secure communication with the GridDB cluster through SSL. Three options are available: PREFERRED (follows the cluster settings), VERIFY (SSL is valid and performs server certificate validation), and DISABLED (SSL is invalid), add the following to the URL:
?sslMode=(PREFERRED|VERIFY|DISABLED)
*When LDAP authentication is used, disabling SSL communication is not recommended.
* To specify VERIFY for the settings for SSL communications (sslMode), settings on the GridDB cluster side are also required. For detail, see the section on “Communication encryption” in the GridDB Features Reference. If a certificate by the Certificate Authority (CA) is not in a truststore, import it using the keytool command. If necessary, specify a truststore (-Djavax.net.ssl.trustStore) and a password (-Djavax.net.ssl.trustStorePassword) as arguments upon launching java. Note that the driver does not support the checking of the expiration date of a CA certificate to ensure it is valid.
To configure the cluster network in multicast mode when multiple network interfaces are available, the address of the interface to receive the multicast packets from can be specified. Add the following to the URL:
?notificationNetworkInferfaceAddress=(address of the interface to receive the multicast packets from)
To include the application name in the URL, add it to the end of the URL as follows:
?applicationName=(application name)
To include the time zone in the URL, add it to the end of the URL as follows:
?timeZone=(time zone)
To include also the user name and the password in the URL, use the following method.
?user=(user name)&password=(password)&applicationName=(application name)&timeZone=(time zone)
Encode the time zone symbol “:” and other characters that need to be encoded in the URL format.
(B) Specify with DriverManager#getConnection(String url, Properties info) or Driver#connect(String url, Properties info)
Add the property with the following key to the argument info.
INTERNAL (internal authentication) | LDAP (LDAP authentication) |
PREFERRED (follows the cluster settings) | DISABLED (invalid) |
The specifications of the GridDB JDBC driver are shown in this chapter. The chapter explains mainly the support range of the driver as well as the differences with the JDBC standard. See the JDK API reference for the API specifications that conform to the JDBC standard unless otherwise stated. Please note that the following could be revised in the future versions.
The following functions corresponding to some of the functions of JDBC4.1 are not supported.
As per the JDBC specifications, when a method other than isClosed() is invoked for an object that has a close() method, e.g. a connection object, etc., a SQLException will occur. The error name is JDBC_ALREADY_CLOSED.
If null is specified as the API method argument despite not being permitted, SQLException due to a JDBC_EMPTY_PARAMETER error will occur. Null is not permitted except for arguments which explicitly accepts null in the JDBC specifications or this guide.
If there are multiple error causes, control will be returned to the application at the point either one of the errors is detected. In particular, if use of an unsupported function is attempted, it will be detected earlier than other errors. For example, if there is an attempt to create a stored procedure for a closed connection object, an error indicating that the operation is “not supported” instead of “closed” will be returned.
A check exception thrown from the driver is made up of a SQLException or a subclass instance of the SQLException. Use the following method to get the exception details.
Return an error message containing the error number and error description as a set. The format is as follows.
[(Error number):( error name)] (error description)
When the error number is not on the list, the following error message format will be used instead:
(Error Details)
The list of main errors detected inside the driver is as follows.
Error no. | Error code name | Error description format |
---|---|---|
(See “GridDB error code”) | JDBC_NOT_SUPPORTED | Currently not supported |
(See “GridDB error code”) | JDBC_OPTIONAL_FEATURE_NOT_SUPPORTED | Optional feature not supported |
(See “GridDB error code”) | JDBC_EMPTY_PARAMETER | The parameter (argument name) must not be null |
(See “GridDB error code”) | JDBC_ALREADY_CLOSED | Already closed |
(See “GridDB error code”) | JDBC_COLUMN_INDEX_OUT_OF_RANGE | Column index out of range |
(See “GridDB error code”) | JDBC_VALUE_TYPE_CONVERSION_FAILED | Failed to convert value type |
(See “GridDB error code”) | JDBC_UNWRAPPING_NOT_SUPPORTED | Unwrapping interface not supported |
(See “GridDB error code”) | JDBC_ILLEGAL_PARAMETER | Illegal value: (argument name) |
(See “GridDB error code”) | JDBC_UNSUPPORTED_PARAMETER_VALUE | Unsupported (parameter name) |
(See “GridDB error code”) | JDBC_ILLEGAL_STATE | Protocol error occurred |
(See “GridDB error code”) | JDBC_INVALID_CURSOR_POSITION | Invalid cursor position |
(See “GridDB error code”) | JDBC_STATEMENT_CATEGORY_UNMATCHED | Writable query specified for read only request Read only query specified for writable request |
(See “GridDB error code”) | JDBC_MESSAGE_CORRUPTED | Protocol error |
When there is an error in the source generating the error and so on, additional details may be added to the end of the error description mentioned above. See “GridDB Error Codes” for the errors other than the above.
Describes each method of the connection interface. Unless otherwise stated, only the description for the case when connection has not been closed is included.
As for transaction control, which operates in automatic commitment mode, commit/rollback is not supported. Note that a request for a commitment or a rollback from applications which use transactions is ignored so that the transaction control may be available even for these applications. SQLFeatureNotSupportedException does not occur.
Transaction isolation level supports only TRANSACTION_READ_COMMITTED. Other levels cannot be set.
Methods that have differences with the JDBC specification
Method | Description | Difference with JDBC specification |
---|---|---|
void commit() | Commit | Ignore a commit request because the API has only an automatic commitment mode. |
void rollback() | Rollback | Ignore a rollback request because the API has only an automatic commitment mode. |
void setAutoCommit(boolean autoCommit) | Set a commitment mode. | Mode setting is unavailable because the API has only an automatic commitment mode. Setting autoCommit is ignored and true is always set. |
Partially unsupported method
Method | Description | Unsupported feature |
---|---|---|
Statement createStatement(int resultSetType, int resultSetConcurrency) | Create a statement. | resultSetType supports ResultSet.TYPE_FORWARD_ONLY only, and resultSetConcurrency supports ResultSet.CONCUR_READ_ONLY only. For other values, SQLFeatureNotSupportedException will occur. |
Statement createStatement(int resultSetType, int resultSetConcurrency, int resultSetHoldability) | Create a statement. | resultSetType supports ResultSet.TYPE_FORWARD_ONLY only, resultSetConcurrency supports ResultSet.CONCUR_READ_ONLY only, and resultSetHoldability supports ResultSet.CLOSE_CURSORS_AT_COMMIT only. For other values, SQLFeatureNotSupportedException will occur. |
PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) | Create a prepared statement. | resultSetType supports ResultSet.TYPE_FORWARD_ONLY only, and resultSetConcurrency supports ResultSet.CONCUR_READ_ONLY only. For other values, SQLFeatureNotSupportedException will occur. |
PreparedStatement prepareStatement(String sql, int resultSetType, int resultSetConcurrency) | Create a prepared statement. | resultSetType supports ResultSet.TYPE_FORWARD_ONLY only, resultSetConcurrency supports ResultSet.CONCUR_READ_ONLY only, and resultSetHoldability supports ResultSet.CLOSE_CURSORS_AT_COMMIT only. For other values, SQLFeatureNotSupportedException will occur. |
void setTransactionIsolation(int level) | Set a transaction isolation level. | Argument “level” accepts only Connection.TRANSACTION_READ_COMMITTED. If any other value is set, SQLException will occur. |
Supported method
Method | Description |
---|---|
void close() | Close connection. |
Statement createStatement() | Create a statement. |
boolean getAutoCommit() | Get commitment mode. |
DatabaseMetaData getMetaData() | Get DatabaseMetaData. |
int getTransactionIsolation() | Get the transaction isolation level. |
boolean isClosed() | Get whether the Connection is closed. |
PreparedStatement prepareStatement(String sql) | Create a prepared statement. |
This section describes methods for setting and getting attributes other than transaction control methods.
Methods that have differences with the JDBC specification
Method | Description | Difference with JDBC specification |
---|---|---|
void setReadOnly(boolean readOnly) | Sets the read-only mode of the Connection object. | Ignore readOnly and always set false. |
Partially unsupported method
Method | Description | Unsupported feature |
---|---|---|
void setHoldability(int holdability) | Set the holding function of ResultSet object. | Argument “holdability” accepts only ResultSet.CLOSE_CURSORS_AT_COMMIT. For other values, SQLFeatureNotSupportedException will occur. |
Supported method
Method | Description |
---|---|
int getHoldability() | Get the holding function of the ResultSet object. |
boolean isReadOnly() | Get whether the Connection object is in read-only mode. |
boolean isValid(int timeout) | Get the state of connection. |
Unsupported methods in the connection interface is listed below. When these methods are executed, SQLFeatureNotSupportedException will occur.
This section describes DatabaseMetaData interface, which gets the metadata of a table.
Among the methods that return ResultSet as the execution result in DatabaseMetaData interface, the supported methods are as follows. The methods that return ResultSets other than these are not supported.
Method | Description |
---|---|
ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) | Return the column information of a table. |
ResultSet getIndexInfo(String catalog, String schema, String table, boolean unique, boolean approximate) | Return the index information of a table. |
ResultSet getPrimaryKeys(String catalog, String schema, String table) | Return the row key information of a table. |
ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types) | Return the list of tables. |
ResultSet getTableTypes() | Return the type of a table. |
ResultSet getTypeInfo() | Return the list of column data types. |
Each of the above methods is explained below.
ResultSet getColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern)
The columns of execution result “ResultSet” are as follows.
Column name | Data type | Value |
---|---|---|
TABLE_CAT | String | null |
TABLE_SCHEM | String | null |
TABLE_NAME | String | table name |
COLUMN_NAME | String | column name |
DATA_TYPE | int | Data type value of a column (see the table below) |
TYPE_NAME | String | Data type name of a column (see the table below) |
COLUMN_SIZE | int | 131072 |
BUFFER_LENGTH | int | 2000000000 |
DECIMAL_DIGITS | int | 10 |
NUM_PREC_RADIX | int | 10 |
NULLABLE | int | If the column is PRIMARY KEY or has NOT NULL constraint, 0 (the value of a constant “DatabaseMetaData.columnNoNulls”); otherwise, 1 (the value of a constant “DatabaseMetaData.columnNullable”) |
REMARKS | String | null |
COLUMN_DEF | String | null |
SQL_DATA_TYPE | int | 0 |
SQL_DATETIME_SUB | int | 0 |
CHAR_OCTET_LENGTH | int | 2000000000 |
ORDINAL_POSITION | int | The number of a column (serial number from 1) |
IS_NULLABLE | String | NOT NULL constraint. If the column is PRIMARY KEY or has NOT NULL constraint, ‘NO’; otherwise, ‘YES’ |
SCOPE_CATALOG | String | null |
SCOPE_SCHEMA | String | null |
SCOPE_TABLE | String | null |
SOURCE_DATA_TYPE | short | 0 |
IS_AUTOINCREMENT | String | ‘NO’ |
IS_GENERATEDCOLUMN | String | ‘NO’ |
Return the combination of TYPE_NAME and DATA_TYPE values according to the data type of each column.
Data type of a column | Value of TYPE_NAME | Value of DATA_TYPE |
---|---|---|
BOOL | ‘BOOL’ | -7 (Types.BIT) |
STRING | ‘STRING’ | 12 (Types.VARCHAR) |
BYTE | ‘BYTE’ | -6 (Types.TINYINT) |
SHORT | ‘SHORT’ | 5 (Types.SMALLINT) |
INTEGER | ‘INTEGER’ | 4 (Types.INTEGER) |
LONG | ‘LONG’ | -5 (Types.BIGINT) |
FLOAT | ‘FLOAT’ | 6 (Types.FLOAT) |
DOUBLE | ‘DOUBLE’ | 8 (Types.DOUBLE) |
TIMESTAMP | ‘TIMESTAMP’ | 93 (Types.TIMESTAMP) |
BLOB | ‘BLOB’ | 2004 (Types.BLOB) |
GEOMETRY | ‘GEOMETRY’ | 1111 (Types.OTHER) |
BOOL ARRAY | ‘BOOL_ARRAY’ | 1111 (Types.OTHER) |
STRING ARRAY | ‘STRING_ARRAY’ | 1111 (Types.OTHER) |
BYTE ARRAY | ‘BYTE_ARRAY’ | 1111 (Types.OTHER) |
SHORT ARRAY | ‘SHORT_ARRAY’ | 1111 (Types.OTHER) |
INTEGER ARRAY | ‘INTEGER_ARRAY’ | 1111 (Types.OTHER) |
LONG ARRAY | ‘LONG_ARRAY’ | 1111 (Types.OTHER) |
FLOAT ARRAY | ‘FLOAT_ARRAY’ | 1111 (Types.OTHER) |
DOUBLE ARRAY | ‘DOUBLE_ARRAY’ | 1111 (Types.OTHER) |
TIMESTAMP ARRAY | ‘TIMESTAMP_ARRAY’ | 1111 (Types.OTHER) |
ResultSet getIndexInfo(String catalog, String schema, String table, boolean unique, boolean approximate)
The columns of execution result “ResultSet” are as follows.
Column name | Data type | Value |
---|---|---|
TABLE_CAT | String | null |
TABLE_SCHEM | String | null |
TABLE_NAME | String | table name |
NON_UNIQUE | boolean | true |
INDEX_QUALIFIER | String | null |
INDEX_NAME | String | index name |
TYPE | short | 2 (value of a constant “DatabaseMetaData.tableIndexHashed” representing a hash index) or 3 (value of a constant “DatabaseMetaData.tableIndexOther” representing an index other than hash) |
ORDINAL_POSITION | short | Start from 1. |
COLUMN_NAME | String | Column name |
ASC_OR_DESC | String | null |
CARDINALITY | long | 0 |
PAGES | long | 0 |
FILTER_CONDITION | String | null |
ResultSet getPrimaryKeys(String catalog, String schema, String table)
The columns of execution result “ResultSet” are as follows.
Column name | Data type | Value |
---|---|---|
TABLE_CAT | String | null |
TABLE_SCHEM | String | null |
TABLE_NAME | String | table name |
COLUMN_NAME | String | column name |
KEY_SEQ | short | 1 |
PK_NAME | String | null |
ResultSet getTables(String catalog, String schemaPattern, String tableNamePattern, String[] types)
The columns of execution result “ResultSet” are as follows.
Column name | Data type | Value |
---|---|---|
TABLE_CAT | String | null |
TABLE_SCHEM | String | null |
TABLE_NAME | String | table name |
TABLE_TYPE | String | ‘TABLE’ or ‘VIEW’ |
REMARKS | String | null |
TYPE_CAT | String | null |
TYPE_SCHEM | String | null |
TYPE_NAME | String | null |
SELF_REFERENCING_COL_NAME | String | null |
REF_GENERATION | String | null |
ResultSet getTableTypes()
The columns of execution result “ResultSet” are as follows.
Column name | Data type | Value |
---|---|---|
TABLE_TYPE | String | ‘TABLE’ or ‘VIEW’ |
ResultSet getTypeInfo()
The information common to all data types and the information of each data type are as follows.
Column name | Data type | Value |
---|---|---|
TYPE_NAME | String | Name of data type (see the table below) |
DATA_TYPE | int | Value of data type (see the table below) |
PRECISION | int | 0 |
LITERAL_PREFIX | String | null |
LITERAL_SUFFIX | String | null |
CREATE_PARAMS | String | null |
NULLABLE | short | 1 (Value of a constant DatabaseMetaData.typeNullable representing that a null value is allowed for this data type) |
CASE_SENSITIVE | boolean | true |
SEARCHABLE | short | 3 (Value of a constant DatabaseMetaData.typeSearchable indicating that this data type can be used in the WHERE clause |
UNSIGNED_ATTRIBUTE | boolean | false |
FIXED_PREC_SCALE | boolean | false |
AUTO_INCREMENT | boolean | false |
LOCAL_TYPE_NAME | String | null |
MINIMUM_SCALE | short | 0 |
MAXIMUM_SCALE | short | 0 |
SQL_DATA_TYPE | int | 0 |
SQL_DATETIME_SUB | int | 0 |
NUM_PREC_RADIX | int | 10 |
For columns TYPE_NAME and DATA_TYPE, all values of the following combinations are returned
Value of TYPE_NAME | Value of DATA_TYPE |
---|---|
‘BOOL’ | -7 (Types.BIT) |
‘STRING’ | 12 (Types.VARCHAR) |
‘BYTE’ | -6 (Types.TINYINT) |
‘SHORT’ | 5 (Types.SMALLINT) |
‘INTEGER’ | 4 (Types.INTEGER) |
‘LONG’ | -5 (Types.BIGINT) |
‘FLOAT’ | 6 (Types.FLOAT) |
‘DOUBLE’ | 8 (Types.DOUBLE) |
‘TIMESTAMP’ | 93 (Types.TIMESTAMP) |
‘BLOB’ | 2004 (Types.BLOB) |
‘UNKNOWN’ | 0 (Types.NULL) |
Among the methods of DatabaseMetaData interface, the execution results are listed about the method that returns simple value such as int type and String type as execution result.
Method | Result | |
---|---|---|
allProceduresAreCallable() | false | |
allTablesAreSelectable() | true | |
autoCommitFailureClosesAllResultSets() | false | |
dataDefinitionCausesTransactionCommit() | false | |
dataDefinitionIgnoredInTransactions() | true | |
deletesAreDetected(type) | false | |
doesMaxRowSizeIncludeBlobs() | false | |
generatedKeyAlwaysReturned() | false | |
getCatalogSeparator() | ”.” | |
getCatalogTerm() | “catalog” | |
getDefaultTransactionIsolation() | TRANSACTION_READ_COMMITTED | |
getExtraNameCharacters() | . - / = (unordered) | |
getIdentifierQuoteString() | ” | |
getMaxBinaryLiteralLength() | 0 | |
getMaxCatalogNameLength() | 0 | |
getMaxCharLiteralLength() | 0 | |
getMaxColumnNameLength() | 0 | |
getMaxColumnsInGroupBy() | 0 | |
getMaxColumnsInIndex() | 0 | |
getMaxColumnsInOrderBy() | 0 | |
getMaxColumnsInSelect() | 0 | |
getMaxColumnsInTable() | 0 | |
getMaxConnections() | 0 | |
getMaxCursorNameLength() | 0 | |
getMaxIndexLength() | 0 | |
getMaxSchemaNameLength() | 0 | |
getMaxProcedureNameLength() | 0 | |
getMaxRowSize() | 0 | |
getMaxStatementLength() | 0 | |
getMaxStatements() | 0 | |
getMaxTableNameLength() | 0 | |
getMaxTablesInSelect() | 0 | |
getMaxUserNameLength() | 0 | |
getProcedureTerm() | “procedure” | |
getResultSetHoldability() | CLOSE_CURSORS_AT_COMMIT | |
getRowIdLifetime() | true | |
getSchemaTerm() | “schema” | |
getSearchStringEscape() | ” | |
getSQLKeywords() | ”” | |
getSQLStateType() | sqlStateSQL99 | |
getStringFunctions() | ”” | |
getSystemFunctions() | ”” | |
getURL() | null | |
getUserName() | (user name) | |
insertsAreDetected(type) | false | |
isCatalogAtStart() | true | |
isReadOnly() | false | |
locatorsUpdateCopy() | false | |
nullPlusNonNullIsNull() | true | |
nullsAreSortedAtEnd() | false | |
nullsAreSortedAtStart() | false | |
nullsAreSortedHigh() | true | |
nullsAreSortedLow() | false | |
othersDeletesAreVisible(type) | false | |
othersInsertsAreVisible(type) | false | |
othersUpdatesAreVisible(type) | false | |
ownDeletesAreVisible(type) | false | |
ownInsertsAreVisible(type) | false | |
ownUpdatesAreVisible(type) | false | |
storesLowerCaseIdentifiers() | false | |
storesLowerCaseQuotedIdentifiers() | false | |
storesMixedCaseIdentifiers() | true | |
storesMixedCaseQuotedIdentifiers() | false | |
storesUpperCaseIdentifiers() | false | |
storesUpperCaseQuotedIdentifiers() | false | |
supportsAlterTableWithAddColumn() | false | |
supportsAlterTableWithDropColumn() | false | |
supportsANSI92EntryLevelSQL() | false | |
supportsANSI92FullSQL() | false | |
supportsANSI92IntermediateSQL() | false | |
supportsBatchUpdates() | false | |
supportsCatalogsInDataManipulation() | false | |
supportsCatalogsInIndexDefinitions() | false | |
supportsCatalogsInPrivilegeDefinitions() | false | |
supportsCatalogsInProcedureCalls() | false | |
supportsCatalogsInTableDefinitions() | false | |
supportsColumnAliasing() | true | |
supportsConvert() | false | |
supportsConvert(fromType, toType) | false | |
supportsCoreSQLGrammar() | true | |
supportsCorrelatedSubqueries() | true | |
supportsDataDefinitionAndDataManipulationTransactions() | false | |
supportsDataManipulationTransactionsOnly() | false | |
supportsDifferentTableCorrelationNames() | false | |
supportsExpressionsInOrderBy() | true | |
supportsExtendedSQLGrammar() | false | |
supportsFullOuterJoins() | false | |
supportsGetGeneratedKeys() | false | |
supportsGroupBy() | true | |
supportsGroupByBeyondSelect() | true | |
supportsGroupByUnrelated() | true | |
supportsIntegrityEnhancementFacility() | false | |
supportsLikeEscapeClause() | true | |
supportsLimitedOuterJoins() | true | |
supportsMinimumSQLGrammar() | true | |
supportsMixedCaseIdentifiers() | false | |
supportsMixedCaseQuotedIdentifiers() | true | |
supportsMultipleOpenResults() | false | |
supportsMultipleResultSets() | false | |
supportsMultipleTransactions() | false | |
supportsNamedParameters() | false | |
supportsNonNullableColumns() | true | |
supportsOpenCursorsAcrossCommit() | false | |
supportsOpenCursorsAcrossRollback() | false | |
supportsOpenStatementsAcrossCommit() | false | |
supportsOpenStatementsAcrossRollback() | false | |
supportsOrderByUnrelated() | true | |
supportsOuterJoins() | true | |
supportsPositionedDelete() | false | |
supportsPositionedUpdate() | false | |
supportsResultSetConcurrency(type, concurrency) | Only in the case where type is TYPE_FORWARD_ONLY, and concurrency is CONCUR_READ_ONLY | |
supportsResultSetHoldability(holdability) | Only in case of CLOSE_CURSORS_AT_COMMIT | |
supportsResultSetType() | Only in case of TYPE_FORWARD_ONLY | |
supportsSavepoints() | false | |
supportsSchemasInDataManipulation() | false | |
supportsSchemasInIndexDefinitions() | false | |
supportsSchemasInPrivilegeDefinitions() | false | |
supportsSchemasInProcedureCalls() | false | |
supportsSchemasInTableDefinitions() | false | |
supportsSelectForUpdate() | false | |
supportsStatementPooling() | false | |
supportsStoredFunctionsUsingCallSyntax() | false | |
supportsStoredProcedures() | false | |
supportsSubqueriesInComparisons() | false | |
supportsSubqueriesInExists() | true | |
supportsSubqueriesInIns() | true | |
supportsSubqueriesInQuantifieds() | false | |
supportsTableCorrelationNames() | false | |
supportsTransactionIsolationLevel(level) | Only in case of TRANSACTION_READ_COMMITTED | |
supportsTransactions() | true | |
supportsUnion() | true | |
supportsUnionAll() | true | |
updatesAreDetected(type) | false | |
usesLocalFilePerTable() | false | |
usesLocalFiles() | false |
Among the methods of DatabaseMetaData interface, the unsupported methods are listed below. When these methods are executed, SQLFeatureNotSupportedException will not occur and the following results will be returned.
Method | Result |
---|---|
ResultSet getAttributes(String catalog, String schemaPattern, String typeNamePattern, String attributeNamePattern) | Empty ResultSet |
ResultSet getBestRowIdentifier(String catalog, String schema, String table, int scope, boolean nullable) | Empty ResultSet |
ResultSet getCatalogs() | Empty ResultSet |
ResultSet getClientInfoProperties() | Empty ResultSet |
ResultSet getColumnPrivileges(String catalog, String schema, String table, String columnNamePattern) | Empty ResultSet |
ResultSet getCrossReference(String parentCatalog, String parentSchema, String parentTable, String foreignCatalog, String foreignSchema, String foreignTable) | Empty ResultSet |
ResultSet getExportedKeys(String catalog, String schema, String table) | Empty ResultSet |
ResultSet getFunctionColumns(String catalog, String schemaPattern, String functionNamePattern, String columnNamePattern) | Empty ResultSet |
ResultSet getFunctions(String catalog, String schemaPattern, String functionNamePattern) | Empty ResultSet |
ResultSet getImportedKeys(String catalog, String schema, String table) | Empty ResultSet |
ResultSet getProcedureColumns(String catalog, String schemaPattern, String procedureNamePattern, String columnNamePattern) | Empty ResultSet |
ResultSet getProcedures(String catalog, String schemaPattern, String procedureNamePattern) | Empty ResultSet |
ResultSet getPseudoColumns(String catalog, String schemaPattern, String tableNamePattern, String columnNamePattern) | Empty ResultSet |
ResultSet getSchemas() | Empty ResultSet |
ResultSet getSchemas(String catalog, String schemaPattern) | Empty ResultSet |
ResultSet getSuperTables(String catalog, String schemaPattern, String tableNamePattern) | Empty ResultSet |
ResultSet getSuperTypes(String catalog, String schemaPattern, String typeNamePattern) | Empty ResultSet |
ResultSet getTablePrivileges(String catalog, String schemaPattern, String tableNamePattern) | Empty ResultSet |
ResultSet getUDTs(String catalog, String schemaPattern, String typeNamePattern, int[] types) | Empty ResultSet |
ResultSet getVersionColumns(String catalog, String schema, String table) | Empty ResultSet |
Only check the specified value.
When checking this value, check that the number of rows obtained by getMaxRows() of the statement is not exceeded as well. Limits related to this value are stated only in the JDBC specifications from JDBC4.0 or earlier. However, unlike the previous JDBC specifications, this excludes the case in which the result of getMaxRows() has been set to the default value 0.
Only FETCH_FORWARD is supported for the fetch direction. A SQLException occurs if FETCH_FORWARD is not specified.
The following methods are supported. A SQLException occurs when invoking the query execution API like executeQuery without setting all parameters.
The following methods are supported.
This section describes the ParameterMetaData interface which gets PreparedStatement metadata.
All methods in the JDBC specification are supported but the methods below will always return a fixed value regardless of the value of argument param.
Method | Result |
---|---|
int getParameterType(int param) | Types.OTHER |
String getParameterTypeName(int param) | “UNKNOWN” |
int getPrecision(int param) | 0 |
int getScale(int param) | 0 |
boolean isSigned(int param) | false |
Only the specified value is checked and configuration changes will not affect the actual fetch process. When checking the value, check that the number of rows obtained by getMaxRows() of the statement in the source generating the target ResultSet is not exceeded as well. This limit is stated only in the JDBC specifications from JDBC4.0 or earlier. However, unlike the previous JDBC specifications, this excludes the case in which the result of getMaxRows() has been set to the default value 0. Actual fetch process is not affected but the revised setting can be acquired.
Only FETCH_FORWARD is supported for the fetch direction. A SQLException occurs if FETCH_FORWARD is not specified. This behavior is different from the JDBC specifications.
The following cursor-related methods are supported.
Since the only fetch direction supported is FETCH_FORWARD, when the following method is invoked, a SQLException caused by a command being invoked against a FETCH_FORWARD type ResultSet will occur.
As warnings will not be recorded, the actions to manage warnings are therefore as follows.
Method | Behavior |
---|---|
getWarnings() | null |
clearWarnings() | Warnings are not cleared. |
The support status of a method to return a fixed value all the time while the ResultSet remains open is as follows.
Method | Result |
---|---|
getCursorName() | null |
getType() | TYPE_FORWARD_ONLY |
getConcurrency() | CONCUR_READ_ONLY |
getMetaData() | (JDBC-compliant) |
getStatement() | (JDBC-compliant) |
When getting the value of a specified column, if the data type maintained by the ResultSet differs from the requested data type, data type conversion will be attempted for the following combinations only.
The Java type of the destination | BOOL | INTEGRAL *1 | FLOATING *2 | TIMESTAMP | STRING | BLOB |
---|---|---|---|---|---|---|
boolean | ✔ | ✔ *3 | ✔ *4 | |||
byte | ✔ | ✔ | ✔ | ✔ | ||
short | ✔ | ✔ | ✔ | ✔ | ||
int | ✔ | ✔ | ✔ | ✔ | ||
long | ✔ | ✔ | ✔ | ✔ | ||
float | ✔ | ✔ | ✔ | |||
double | ✔ | ✔ | ✔ | |||
byte[] | ✔ | ✔ | ✔ | ✔ | ||
java.sql.Date | ✔ | ✔ *5 | ||||
Time | ✔ | ✔ *5 | ||||
Timestamp | ✔ | ✔ *5 | ||||
String | ✔ | ✔ | ✔ | ✔ *6 | ✔ | ✔ *7 |
Blob | ✔ *7 | ✔ | ||||
Object | ✔ | ✔ | ✔ | ✔ | ✔ | ✔ |
The column value can be acquired using a method that corresponds to the data type of the supported data type conversion address. Both column label and column index are supported as methods to specify a column. Besides this, the following functions can be used.
The following optional functions are not supported. All overloads for which the argument has been omitted are not supported.
This section describes the ResultSetMetaData interface which gets the search result ResultSet metadata.
For all the methods in the JDBC specification of the ResultSetMetaData interface, the contents and the execution results of each method are described under the following classification.
ResultSetMetaData interface has a method that returns the column data type of the search result ResultSet.
Method | Description |
---|---|
String getColumnClassName(int column) | Returns the class name of the specified column data type. |
int getColumnType(int column) | Return the value of the specified column data type. |
String getColumnTypeName(int column) | Return the name of the specified column data type. |
The correspondence between the column data type and the value of the execution result of each method is shown below.
Data type of a column | getColumnClassName | getColumnType | getColumnTypeName |
---|---|---|---|
BOOL | “java.lang.Boolean” | Types.BIT | “BOOL” |
STRING | “java.lang.String” | Types.VARCHAR | “STRING” |
BYTE | “java.lang.Byte” | Types.TINYINT | “BYTE” |
SHORT | “java.lang.Short” | Types.SMALLINT | “SHORT” |
INTEGER | “java.lang.Integer” | Types.INTEGER | “INTEGER” |
LONG | “java.lang.Long” | Types.BIGINT | “LONG” |
FLOAT | “java.lang.Float” | Types.FLOAT | “FLOAT” |
DOUBLE | “java.lang.Double” | Types.DOUBLE | “DOUBLE” |
TIMESTAMP | “java.util.Date” | Types.TIMESTAMP | “TIMESTAMP” |
BLOB | “java.sql.Blob” | Types.BLOB | “BLOB” |
GEOMETRY | “java.lang.Object” | Types.OTHER | “UNKNOWN” |
ARRAY | “java.lang.Object” | Types.OTHER | “UNKNOWN” |
When the data type of a column cannot be identified (*1) | “java.lang.Object” | Types.OTHER | “UNKNOWN” |
[Memo]
The result of executing the method other than returning the data type of the column in the ResultSetMetaData interface is shown below.
Method | Result |
---|---|
String getCatalogName(int column) | ”” |
int getColumnCount() | The number of columns |
int getColumnDisplaySize(int column) | 131072 |
String getColumnLabel(int column) | The label name of a column |
String getColumnName(int column) | The name of a column |
int getPrecision(int column) | 0 |
int getScale(int column) | 0 |
String getSchemaName(int column) | ”” |
String getTableName(int column) | ”” |
boolean isAutoIncrement(int column) | false |
boolean isCaseSensitive(int column) | true |
boolean isCurrency(int column) | false |
boolean isDefinitelyWritable(int column) | true |
int isNullable(int column) | The constant ResultSetMetaData.columnNullable(=1) that allows NULL values for the column, or the constant columnNoNulls(=0) that does not allow NULL values for the column |
boolean isReadOnly(int column) | false |
boolean isSearchable(int column) | true |
boolean isSigned(int column) | false |
boolean isWritable(int column) | true |
There are no unsupported methods (methods that cause SQLFeatureNotSupportedException) in the ResultSetMetaData interface.
A JDBC sample programs is given below.
// Execute Sample 2 before running this program.
package test;
import java.sql.*;
public class SampleJDBC {
public static void main(String[] args) throws SQLException {
if (args.length != 5) {
System.err.println(
"usage: java SampleJDBC (multicastAddress) (port) (clusterName) (user) (password)");
System.exit(1);
}
// url format "jdbc:gs://(multicastAddress):(portNo)/(clusterName)"
String url = "jdbc:gs://" + args[0] + ":" + args[1] + "/" + args[2];
String user = args[3];
String password = args[4];
System.out.println("DB Connection Start");
// Connection to a GridDB cluster
Connection con = DriverManager.getConnection(url, user, password);
try {
System.out.println("Start");
Statement st = con.createStatement();
ResultSet rs = st.executeQuery("SELECT * FROM point01");
ResultSetMetaData md = rs.getMetaData();
while (rs.next()) {
for (int i = 0; i < md.getColumnCount(); i++) {
System.out.print(rs.getString(i + 1) + "|");
}
System.out.println("");
}
rs.close();
System.out.println("End");
st.close();
} finally {
System.out.println("DB Connection Close");
con.close();
}
}
}