Show TOC

JDBC PropertiesLocate this document in the navigation structure

Configure Java Database Connectivity (JDBC) connection properties.

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

jdbc:<NativeConnPropName>=<Value>

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

into

Batch Delimiter Sets a delimiter, for example, a semicolon, that can be used to separate multiple SQL statements within a statement batch. <delimiter>
Blob Updater 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.

Clob Updater 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.

Code Set 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.

Commit Protocol

Specifies how SAP Mobile 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.
Data Source Class

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 SAP Mobile 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 SAP Mobile Server supports distributed transactions, some datasources may require that a datasource class be implemented for SAP Mobile Server to interact with it.

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

<com.<mydatasource>.jdbc.Driver>

Database Command Echo

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, SAP Mobile 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.

Database Create Command 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: SMP_HOME\Servers\SQLAnywhere11\BIN32\dbinit -q ${databaseFile}

Database File

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.

Database Name

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 SAP Mobile 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.

Database Start Command 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: SMP_HOME\Servers\SQLAnywhere11\BIN32\dbsrv<XX>.exe

Database Stop Command 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 SQL Anywhere® database, where the user name and password are the defaults (dba and sql), enter:

SMP_HOME\Servers\SQLAnywhere11\BIN32\dbsrv<XX>.exe

Database Type Specifies the database type. <database type>
Database URL

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.

Driver Class

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 SAP Mobile 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. SAP 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.

Driver Debug Enables debugging for the driver.

[true|false]

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

Driver Debug Settings Configures debug settings for the driver debugger.

[default|<setting>]

The default is STATIC:ALL.

Initial Pool Size

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 SAP Mobile Server.

<int>

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

SAP 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.

Is Download Zipped

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 <SMP_HOME>\lib\jdbc.

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

JDBC Driver Download URL

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.

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, SAP Mobile 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

SAP Mobile Server can access Unicode data in an Adaptive Server® 12.5 or later, or in Unicode columns in Adaptive Server 12.5 or later. SAP Mobile 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.

Max Idle Time 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.

Max Pool Size

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. The default is 10.

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

<int>

The default is 60.

Max Statements 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.

Min Pool Size 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.

Network Protocol

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 SAP Mobile 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.

Password Specifies the password for connecting to the database.

[default|<password>]

Ping and Set Session Auth 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.

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

[True|False]

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

Ping SQL 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".

Port Number

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.

PS Max Blob Length 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.

PS Max Clob Length 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.

Role Name

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.

Server Name Defines the host where the database server is running.

<name>

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

Service Name

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.

Set Session Auth

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.

Set Session Auth System ID 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.

Start Wait

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 SAP Mobile Server waits before reporting an error.

Truncate Nanoseconds 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.

Use Quoted Identifiers Specifies whether or not SQL identifiers are quoted.

[True|False]

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

User Identifies the user who is connecting to the database.

[default|<user name>]

Replace <user name> with the database user name.

XA Data Source Class 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