JDBC Properties

Configure Java Database Connectivity (JDBC) connection properties.

This list of properties can be used by all datasource types. Sybase does not document native properties used only by a single driver. However, you can also use native driver properties, naming them using this syntax:

<driver_type>:<NativeConnPropName>=<SupportedValue>

Note: If Unwired Server is connecting to a database with a JDBC driver, ensure you have copied required JAR files to correct locations. See the Installation for Runtime guide.
Name Description Supported values
afterInsert Changes the value to into if a database requires insert into rather than the abbreviated into.

into

batchDelimiter Sets a delimiter, for example, a semicolon, that can be used to separate multiple SQL statements within a statement batch. <delimiter>
blobUpdater Specifies the name of a class that can be used to update database BLOB (long binary) objects when the BLOB size is greater than psMaximumBlobLength.

<class name>

The class must implement the com.sybase.djc.sql.BlobUpdater interface.

compactColumnAlias An expression that uses the nested variables “${index}” and “${column}” for shortening column names in result sets. This can reduce the data transmitted between the database server and the application server. An expression. For example: _${index}=${column} ${column} AS _${index}
clobUpdater Specifies the name of a class that can be used to update database CLOB (long string) objects when the CLOB size is greater than psMaximumClobLength.

<class name>

The class must implement the com.sybase.djc.sql.ClobUpdater interface.

codeSet Specifies how to represent a repertoire of characters by setting the value of CS_SYB_CHARSET for this datasource. Used when the data in the datasource is localized. If you do not specify the correct code set, characters may be rendered incorrectly.

[server]

If the value is server, the value of the current application server’s defaultCodeSet property is used.

commitProtocol

Specifies how Unwired Server handles connections for a datasource at commit time, specifically when a single transaction requires data from multiple endpoints.

If you use XA, the recovery log is stored in the tx_manager datasource, and its commit protocol must be optimistic. If tx_manager is aliased to another datasource (that is, one that is defined with the aliasFor property), the commit protocol for that datasource must be optimistic. A last-resource optimization ensures full conformance with the XA specification. The commit protocol for all other datasources should be XA_2PC. Alternately, a transaction that accesses multiple datasources for which the commit protocols are optimistic is permitted.

[optimistic| pessimistic | XA_2PC]

Choose only one of these protocols:

  • Optimistic – enables connections to be committed without regard for other connections enlisted in the transaction, assuming that the transaction is not marked for rollback and will successfully commit on all resources. Note: if a transaction accesses multiple data sources with commit protocol of "optimistic", atomicity is not guaranteed.
  • Pessimistic – specifies that you do not expect any multi-resource transactions. An exception will be thrown (and transaction rolled back) if any attempt is made to use more than one "pessimistic" data source in the same transaction.
  • XA_2PC – specifies use of the XA two phase commit protocol. If you are using two phase commit, then the recovery log is stored in the "tx_manager" data source, and that data source (or the one it is aliased to) must have the commit protocol of "optimistic" or "pessimistic". All other data sources for which atomicity must be ensured should have the "XA_2PC" commit protocol.
dataSourceClass

Sets the class that implements the JDBC datasource.

Use this property (along with the driverClass property) only if you do not have a predefined database-type entry in Unwired Server for the kind of SQL database you are connecting to. For example, you must use this property for MySQL database connections.

You can implement a datasource class to work with a distributed transaction environment. Because Unwired Server supports distributed transactions, some datasources may require that a datasource class be implemented for Unwired Server to interact with it.

For two-phase transactions, use the xaDataSourceClass connection property instead.

<com.mydatasource.jdbc.Driver>

databaseCommandEcho

Echoes a database command to both the console window and the server log file.

Use this property to immediately see and record the status or outcome of database commands.

When you enable this property, Unwired Server echoes every SQL query to ml.log, which may help you debug your application.

[true|false]

Set a value of 1 to echo the database commands like databaseStartCommand, and databaseStopCommand.

Otherwise, do not set this property, or use a value of 0 to disable the echo.

databaseCreateCommand Specifies the operating system command used to create the database for this datasource. If this command is defined and the file referenced by ${databaseFile} does not exist, the command is run to create the database when an application component attempts to obtain the first connection from the connection pool for this datasource.

<command>

Example: <UnwiredPlatform_InstallDir>\Servers\SQLAnywhere11\BIN32\dbinit -q ${databaseFile}

databaseFile

Indicates the database file to load when connecting to a datasource.

Use this property when the path to the database file differs from the one normally used by the database server.

If the database you want to connect to is already running, use the databaseName connection parameter.

<string>

Supply a complete path and file name. The database file you specify must be on the same host as the server.

databaseName

Identifies a loaded database with which to establish a connection, when connecting to a datasource.

Set a database name, so you can refer to the database by name in other property definitions for a datasource.

If the database to connect to is not already running, use the databaseFile connection parameter so the database can be started.

Note: For Unwired Server, you typically do not need to use this property. Usually, when you start a database on a server, the database is assigned a name. The mechanism by which this occurs varies. An administrator can use the DBN option to set a unique name, or the server may use the base of the file name with the extension and path removed.

[DBN|default]

If you set this property to default, the name is obtained from the DBN option set by the database administrator.

If no value is used, the database name is inherited from the database type.

databaseStartCommand Specifies the operating system command used to start the database for this datasource. If this command is defined and the database is not running, the command is run to start the database when the datasource is activated.

<command>

Example: <UnwiredPlatform_InstallDir>\Servers\SQLAnywhere11\BIN32\dbsrv11.exe

databaseStopCommand Specifies the operating system command used to stop the database for this datasource. If this property is defined and the database is running, this command executes during shutdown.

<command>

For a Adaptive Server® Anywhere database, where the user name and password are the defaults (dba and sql), enter:

<UnwiredPlatform_InstallDir>\Servers\SQLAnywhere11\BIN32\dbsrv11.exe

databaseType Specifies the database type. <database type>
databaseURL

Sets the JDBC URL for connecting to the database if the datasource requires an Internet connection.

Typically, the server attempts to construct the database URL from the various connection properties you specify (for example, portNumber, databaseName). However, because some drivers require a special or unique URL syntax, this property allows you to override the server defaults and instead provide explicit values for this URL.

<JDBCurl>

The database URL is JDBC driver vendor-specific. For details, refer to the driver vendor's JDBC documentation.

disableAutoCommit Enables or disables calling auto-commit mode. Auto-commit means that every update to the database is immediately made permanent.

[true|false]

The default is false.

disablePrefetch Enables or disables prefetch. Prefetch optimizes container-managed persistence by batching queries from a parent to its children (for example, from a customer to orders), to reduce the calls from the application server to the database.

[true|false]

The default is true.

disableTriggers Select to deactivate database triggers, on a per-connection basis, when the application server accesses the database. If selected, the database must support both the set triggers on and set triggers off commands.

[true|false]

The default is false.

driverClass

Sets the name of the class that implements the JDBC driver.

Use this property (along with the dataSourceClass property) only if you do not have a predefined database-type entry in Unwired Server for the kind of SQL database you are connecting to. For example, MySQL database connections require you to use this connection property.

To create a connection to a database system, you must use the compatible JDBC driver classes. Sybase does not provide these classes; you must obtain them from the database manufacturer.

<Class.forName("foo.bar.Driver")>

Replace <Class.forName("foo.bar.Driver")> with the name of your driver.

driverDebug Enables debugging for the driver.

[true|false]

Set to true to enable debugging, or false to disable.

driverDebugSettings Configures debug settings for the driver debugger.

[default|<setting>]

The default is STATIC:ALL.

endpointName The JDBC datasource name. JDBC datasource name.
getDateAndTime A SQL query to get the date and time.

A valid SQL query.

The default is select getdate().

InitialPoolSize

Sets the initial number of connections in the pool for a datasource.

In general, holding a connection causes a less dramatic performance impact than creating a new connection. Keep your pool size large enough for the number of concurrent requests you have; ideally, your connection pool size should ensure that you never run out of available connections.

The initialPoolSize value is applied to the next time you start Unwired Server.

<int>

Replace <int> with an integer to preallocate and open the specified number of connections at start-up. The default is 0.

Sybase suggests that you start with 0, and create additional connections as necessary. The value you choose allows you to create additional connections before client synchronization requires the server to create them.

isDownloadZipped

Specifies whether the driver file downloaded from jdbcDriverDownloadURL is in .ZIP format.

This property is ignored if the value of jdbcDriverDownloadURL connection is an empty string.

[True|False]

The default is false. The file is copied, but not zipped to <UnwiredPlatform-install>\lib\jdbc.

Set isDownloadZipped to true to save the file to <UnwiredPlatform-install>\lib\jdbc and unzip the archived copy.

jdbc:DISABLE_UNPROCESSED_PARAM_WARNINGS All properties starting with “jdbc:” are used to pass the suffix (such as DISABLE_UNPROCESSED_PARAM_WARNINGS ) to the JDBC driver while getting a connection. This property is used for the jConnect driver. Set this property to true can disable the warning of “An output parameter was received and ignored”.

[True|False]

The default is false.

This property is for Sybase ASA or Sybase ASE databases only.

jdbc:IS_CLOSED_TEST

As above, this property is used for the jConnect driver. You can force jConnect to follow the standard JDBC behavior for isClosed() by setting the IS_CLOSED_TEST connection property to the special value 'INTERNAL'. The INTERNAL setting means that jConnect returns true for isClosed() only when Connection.close() has been called, or when jConnect has detected an IOException that has disabled the Connection.

You can specify a query other than sp_mda to use when isClosed() is called. For example, if you want jConnect to try select 1 when isClosed() is called, you can set the IS_CLOSED_TEST connection property to select 1.

The default is INTERNAL.

jdbc:DriverType The driverType property to be passed to the JDBC driver class. For example, for Oracle, you can set this property to “thin”.

The driverType property.

For an Oracle database type, use "thin".

jdbcDriverDownloadURL

Specifies the URL from which you can download a database driver.

Use this property with isDownloadZipped to put the driver in an archive file before the download starts.

<URL>

Replace <URL> with the URL from which the driver can be downloaded.

jit:imageParameterType Defines the SQL type of the image parameter. All properties that start with “jit:” are used for the Sybase JIT DataSource only.

A varbinary (16384) value.

For example, varbinary(255).

jit:textParameterType Defines the SQL type of the text parameter. Used for the Sybase JIT DataSource only.

A varchar (16384) value.

jit:unitextParameterType Defines the SQL type of the unicode text parameter. Used for the Sybase JIT DataSource only.

A univarchar (16384) value.

language

For those interfaces that support localization, this property specifies the language to use when connecting to your target database. When you specify a value for this property, Unwired Server:

  • Allocates a CS_LOCALE structure for this connection
  • Sets the CS_SYB_LANG value to the language you specify
  • Sets the Microsoft SQL Server CS_LOC_PROP connection property with the new locale information

Unwired Server can access Unicode data in an Adaptive Server® 12.5 or later, or in Unicode columns in Adaptive Server 12.5 or later. Unwired Server automatically converts between double-byte character set (DBCS) data and Unicode, provided that the Language and CodeSet parameters are set with DBCS values.

<language>

Replace <language> with the language being used.

maxIdleTime Specifies the number of seconds an idle connection remains in the pool before it is dropped.

<int>

If the value is 0, idle connections remain in the pool until the server shuts down. The default is 60.

maxPoolSize

Sets the maximum number of connections allocated to the pool for this datasource.

Increase the maxPoolSize property value when you have a large user base. To determine whether a value is high enough, look for ResourceMonitorTimeoutException exceptions in <hostname>-server.log. Continue increasing the value, until this exception no longer occurs.

To further reduce the likelihood of deadlocks, configure a higher value for maxWaitTime.

To control the range of the pool size, use this property with minPoolSize.

<int>

A value of 0 sets no limit to the maximum connection pool size.

maxWaitTime Sets the maximum number of seconds to wait for a connection before the request is cancelled.

<int>

The default is 60.

maxStatements Specifies the maximum number of JDBC prepared statements that can be cached for each connection by the JDBC driver. The value of this property is specific to each JDBC driver.

<int>

A value of 0 (default) sets no limit to the maximum statements.

minPoolSize Sets the minimum number of connections allocated to the pool for this datasource.

<int>

A value of 0 (default) sets no limit to the minimum connection pool size.

networkProtocol

Sets the protocol used for network communication with the datasource.

Use this property (along with the driverClass, and dataSourceClass properties) only if you do not have a predefined database-type entry in Unwired Server for the kind of SQL database you are connecting to. For example, you may be required to use this property for MySQL database connections.

The network protocol is JDBC driver vendor-specific. There are no predefined values.

See the driver vendor's JDBC documentation.

ownerPrefix The owner prefix for stored procedures and table names in this datasource. A prefix is used by the EJB persistence manager and JIT driver wrappers to qualify database identifiers for stored procedures and tables. An owner prefix.
password Specifies the password for connecting to the database.

[default|<password>]

pingAndSetSessionAuth Runs the ping and session-authorization commands in a single command batch; may improve performance. You can only enable the Ping and Set Session Auth property if you have enabled the Set Session Auth property so database work runs under the effective user ID of the client.

[True|False]

Set to true to enable, or false to disable.

pingConnections Pings connections before attempting to reuse them from the connection pool.

[True|False]

Set to true to enable ping connections, or false to disable.

pingSQL Specify the SQL statement to use when testing the database connection with ping.

[default|<statement>]

Replace <statement> with the SQL statement identifier. The default is "select 1".

portNumber

Sets the server port number where the database server listens for connection requests.

[default|<port>]

Replace <port> with the TCP/IP port number to use (that is, 1 – 65535).

If you set the value as default, the default protocol of the datasource is used.

psMaximumBlobLength Indicates the maximum number of bytes allowed when updating a BLOB datatype using PreparedStatement.setBytes.

[default|<int>]

Replace <int> with the number of bytes allowed during an update. The default is 16384.

psMaximumClobLength Indicates the maximum number of characters allowed when updating a CLOB datatype using PreparedStatement.setString.

[default|<int>]

Replace <int> with the number of bytes allowed during an update. The default is 16384.

roleName

Sets the database role that the user must have to log in to the database.

[default|<name>]

If you set this value to default, the default database role name of the datasource is used.

selectWithSharedLock A template SQL statement for selecting rows and acquiring a shared lock. If your database server does not support shared locks, specify a template for acquiring exclusive locks.

A template SQL statement.

For example, for a Sybase ASA database type:

${selectList}${intoClause}${fromClause} holdlock${whereClause}

selectWithUpdateLock A template SQL statement for selecting rows and acquiring an exclusive lock. The configuration property name is selectWithUpdateLock. If your database server does not support exclusive locks, specify a template for acquiring shared locks.

A template SQL statement.

For example, for a Sybase ASA database type:

update ${mainTable} set ${touchColumn} = 1 -${touchColumn}${fromClause}${whereClause};;

${selectList}${intoClause}${fromClause}${whereClause}

serializableSelect A template SQL statement for selecting rows and acquiring a lock that ensures strict serializability, in terms of equivalence with serial schedules.

A template SQL statement.

For example, for a Sybase database type:

${selectList}${intoClause}${fromClause} holdlock${whereClause}

serverName Defines the host where the database server is running.

<name>

Replace <name> with an appropriate name for the server.

serviceName

Defines the service name for the datasource.

For SQL Anywhere servers, use this property to specify the database you are attaching to.

<name>

Replace <name> with an appropriate name for the service.

setSessionAuth

Establishes an effective database identity that matches the current mobile application user.

If you use this property, you must also use setSessionAuthSystemID to set the session ID.

Alternately you can pingAndSetSessionAuth if you are using this property with pingConnection. The pingAndSetSessionAuth property runs the ping and session-authorization commands in a single command batch, which may improve performance.

[true|false]

Choose a value of 1 to use an ANSI SQL set session authorization command at the start of each database transaction. Set to 0 to use session-based authorizations.

setSessionAuthSystemID If Set Session Authorization is enabled, specifies the database identity to use when the application server accesses the database from a transaction that runs with "system" identity.

<database identity>

Replace <database identity> with the database identifier.

startWait

Sets the wait time (in seconds) before a connection problem is reported. If the start command completes successfully within this time period, no exceptions are reported in the server log.

startWait time is used only with the databaseStartCommand property.

<int>

Replace <int> with the number of seconds Unwired Server waits before reporting an error.

truncateNanos Sets a divisor/multiplier that is used to round the nanoseconds value in a java.sql.Timestamp to a granularity that the DBMS supports.

[default|<int>]

The default is 10 000 000.

useQuotedIdentifiers Specifies whether or not SQL identifiers are quoted.

[True|False]

Set to true to enable use of quoted identifiers, or false to disable.

useTransactionalPing Enables or disables the attempt to ping a connection from within a new transaction.

[True|False]

The default is true.

user/User Identifies the user who is connecting to the database.

[default|<user name>]

Replace <user name> with the database user name.

For DB2 and SQL Server databases, this property is user. For Informix, Oracle, and SQL Anywhere databases, this property is User.

xaDataSourceClass Specifies the class name or library name used to support two-phase commit transactions, and the name of the XA resource library.

<class name>

Replace <class name> with the class or library name.
  • SQL Anywhere database: com.sybase.jdbc3.jdbc.SybXADataSource
  • Oracle database: oracle.jdbc.xa.client.OracleXADataSource