Entering content frame

Procedure documentation Specifying Other Connection Options Locate the document in the library structure

Use

You can use connection options to define the properties of a database instance connection.

Procedure

Usually, an instance of the class java.util.Properties is used to send the connection options to the method java.sql.DriverManager.getConnection.

However, you can also specify these options as part of the connection URL. In this case, you must enter them in the following format:

?<name>=<value>[&<name>=<value>...]

Example

Switch on the JDBC trace for the database instance DEMODB on the local computer under Linux. The system writes the trace to file /tmp/jdbctrace.txt.

jdbc:sapdb:///DEMODB?trace=/tmp/jdbctrace.txt

Connection Options

Option

Description

user

Name of the database user

See Database System Concepts, Conventions for User Names and Passwords

password

Password of the database user

sqlmode

SQL mode

Possible values: ORACLE | INTERNAL

The default is INTERNAL.

cachelimit

Cache limit of the connection

timeout

Command timeout of the connection (in seconds)

isolation

Isolation Level of the connection

In the Java method, you can specify the isolation level as either a character string or an integer, as declared in the class java.sql.Connection.

The following character strings are possible: TRANSACTION_READ_UNCOMMITTED, TRANSACTION_READ_COMMITTED, TRANSACTION_REPEATABLE_READ, TRANSACTION_SERIALIZABLE

autocommit

AUTOCOMMIT Mode

Possible values:

on: A COMMIT is performed after every command.

off: Transactions must be controlled with the methods commit () and rollback ().

The default value is on.

reconnect

RECONNECT mode

Possible values:

on: The system automatically reconnects to the database instance after a command timeout.

off: There is no automatic new connection.

The default value is on.

trace

Path and name of the file that is written to the JDBC trace

tracesize

Maximum number of lines in the file for the JDBC trace. When the maximum number is exceeded the content of the file is overwritten cyclically.

cache

The internal information used by objects in the class java.sql.PreparedStatement is saved in the connection object. If more objects are generated by the same SQL statement in the same class, then this internal information can be used again, and no new request needs to be sent to the database.

Possible values:

all: all SQL statements are saved

A combination of s (SELECT), i (INSERT), u (UPDATE), d (DELETE): Only SQL statements of this type are saved

Example

cache=iud

Only INSERT, UPDATE, and DELETE statements are saved.

unicode

The user name, password and SQL statements are sent to the database in UNICODE.

connectiontimeout

Timeout for the connection in milliseconds

The default value is 0 (no timeout).

transport

Communication method for communicating with the DBM server

Possible values:

socket: TCP/IP connection

secure: SSL connection; see Setting up an SSL Connection

ignoreHostNameInServerCert

Specifies whether the name of the database computer is compared to the name specified in the SSL certificate in case of an SSL connection.

Possible values:

on: no check

off: check (system default)

acceptServerCertificateAlways

Specifies whether the SSL certificate of the database computer is checked.

Possible values:

on: no check (system default value)

off: check

 

See also:

Examples for Establishing a Connection to the Database Instance

 

Leaving content frame