To establish a connection to an Aster Database using the Aster Database JDBC driver, you must provide the driver with the URL to use to connect to the database. The URL has this format:
jdbc:ncluster://<Host:Port>/<Database>?enable_backslash_escapes=<on_or off>&enable_quoted_identifiers=<on_or off>[&AUTOAUTHENTICATE=true]
For example:
jdbc:ncluster://192.65.197.90:2406/beehive?enable_backslash_escapes=on&enable_quoted_identifiers=on&AUTOAUTHENTICATE=true
The URL needs three parameters to connect to an Aster Database:
Parameter | Required? | Description |
---|---|---|
Host | Optional | The name of the server where the database resides. Default is localhost. |
Port | Optional | The port number that the database server is listening on. Default is 2406. |
Database | Required | The database name. |
enable_backslash_escapes | Optional | Sets the queen parameter enable_backslash_escapes for the current session. The two possible values are: on—Enables this parameter on the queen (default). off—Disables this parameter on the queen. |
enable_quoted_identifiers | Optional | Sets the queen parameter enable_quoted_identifiers for the current session. The two possible values are: on—Enables this parameter on the queen (default). off—Disables this parameter on the queen. |
AUTOAUTHENTICATE=true | Optional | Sets the JDBC driver to use the authentication token rather than requiring the username and password to be sent for each connection. |
In addition, to the URL, you must also provide the username and password needed to access the Aster Database, which you can get from your Aster Database administrator.
You can add AUTOAUTHENTICATE=true to the URL to use the existing connection token rather than reauthenticating on every connection the JDBC driver makes within the context of a session. See Enable Authentication Cascading for more details.
You can set the Autocommit and fetch_count settings for the connection in the URL by adding the autocommit and fetch_count parameters. See Frequently Used JDBC Setting. If your application will query large tables, you should set autocommit to false, and you should declare a fetch_count for the connection. By doing this, you enable the connection to use distributed cursors for improved performance.
You can also use the NumericAndDecimalAsDouble parameter to map NUMERIC and DECIMAL type columns to SQL_DOUBLE. When you set this parameter, its value will be stored in a connection context. This example shows how to use this parameter to decode the row header:
if ((sqlType == Types.NUMERIC || sqlType == Types.DECIMAL) && inSettings.connectionSettings_.numericAsDouble_) { sqlType = Types.DOUBLE; }