Show TOC

com.sap.dbtech.jdbcext.DataSourceSapDB ClassLocate this document in the navigation structure

Use

To connect your Java application to a database and to open a database session, you can use the com.sap.dbtech.jdbcext.DataSourceSapDB class (part of sapdbc.jar). This class implements the javax.sql.DataSource interface of the Java platform. More information: http://java.sun.comInformation published on non-SAP site

Note

Alternatively, you can use the java.sql.DriverManager.getConnection method of the Java platform.

Prerequisites
Features

Method

Description

<type> get<property_name>()

Querying the value of a property

void set<property_name>(<type> <value>)

Setting the value of a property

<property_name>= Name of the property (see below), the first letter of the name is written in upper case

Example

String getCache()

String getDatabaseName()

<property_name>

Default value

Description

cache

-

Specifies for which SQL statements in prepared statements the JDBC driver saves information (for example, on the used parameters) in a dedicated cache

Possible values:

  • all: all SQL statements

  • Combination of the following letters

    s (SELECT statements)

    i (INSERT statements)

    u (UPDATE statements)

    d (DELETE statements)

    Example

    cache=iud

    The database system saves information on INSERT, UPDATE, and DELETE statements in the cache.

databaseName

-

Database name

description

-

Description

loginTimeout

30

Timeout for the logon (in seconds)

password

-

Password

port

7210

Port of the X Server on the database computer

More information: Global Listener and X Servers

reconnect

on

RECONNECT mode

Possible values:

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

off: There is no automatic new connection.

serverName

localhost

Database computer

sqlMode

INTERNAL

SQL mode

ORACLE | INTERNAL

timeout

-

Timeout for the database session (in seconds)

If you specify this connection option, you override the timeout that has been configured for the database with the special database parameter SessionTimeout (see Database Administration, Special Database Parameters).

trace

-

<directory>/<jdbc_trace_file>

If you specify this connection option, then the database system writes a JDBC trace in the <jdbc_trace_file> file in the directory <directory>.

traceSize

-

Maximum number of lines in the JDBC trace file.

If this number of lines is exceeded, the database system begins to overwrite the content of the JDBC trace file

transport

socket

Communication method for communicating with the DBM server

Possible values:

socket: TCP/IP connection

secure: SSL connection, see Setting Up an SSL Connection

unicode

false

Unicode Support

true: the JDBC driver sends the user name, password, and SQL statements in Unicode to the database

false: the JDBC driver uses ASCII

url

-

Connection URL

user

-

Name of the database user

You can also transfer most properties as connection options within the connection URL url. The following properties are exceptions: description, databasename, servername, url, port, loginTimeout.