Show TOC

Working with DataSourcesLocate this document in the navigation structure

Use

Definition

A DataSource is defined using:

  • A DataSource XML descriptor that contains essential information, such as the name of the underlying JDBC driver, database URL, connection pooling properties, and so on.

    The DataSource XML adheres to the Document Type Definition (DTD) contained in the data-sources.dtd file. The DTD is available under <install_directory>\<SID>\JC<instance_number>\j2ee\cluster\server0\dtd directory of your SAP NetWeaver Application Server for Java.

For a detailed description of the data-sources.dtd elements, see data-sources.dtd .

SQL Engines

In the context of the SAP NetWeaver Application Server for Java, you can use Open SQL, Native SQL or Vendor SQL as the SQL engine types in your DatSource definition.

Vendor SQL can be used with any database that provides a JDBC-compliant driver.

Native SQL is a wrapper for the vendor-specific JDBC driver and provides important enhancements such as SQL trace and statement pooling. However, it can be used only with databases supported by SAP: Oracle 9.2 and 10.2, MSSQL 8, MaxDB 7.x, and DB2 for Linux, UNIX, Windows, versions 9.x and 8.x.

Open SQL is an SAP-proprietary database abstraction layer, which is designed to provide portability across various database platforms and performance optimizations through client-side data buffering.

For more information, see Running JPA Applications on the System DataSource .

DataSource Types

Depending on the way DataSources obtain connections from the underlying database driver, as well as the way they handle transactions, the following two types are distinguished:

  • Driver-based

    This type of DataSource obtains Connection objects by calling the java.sql.Driver.connect() method implemented by the underlying JDBC driver. It returns a Connection , which can participate as a resource in local transactions. Besides using the UserTransaction object, transactions in this case can be started by invoking setAutoCommit(false) and completed by invoking commit() or rollback() methods on the Connection object.

  • XADataSource-based

    This type of DataSource supports distributed transactions and is useful if multiple Connection objects are participating in the same transaction. The Connection is obtained from the vendor's implementation of javax.sql.XADataSource . Explicit invocations of setAutoCommit() , commit() , or rollback() on the Connection object are prohibited.