X4 Produktdokumentation

JDBC Connector

The adapter connects to a JDBC-compliant database and executes one or more database statements passed as an input XML document with adapter-specific structures.

Note:

A prerequisite is a JDBC data source provided in the application server for which the connection URL, credentials, schema, transaction behavior, etc. have been defined. For more information about deploying JDBC data sources, see your application server documentation.

Properties

Operation

Describes which operation the adapter performs.

Possible values:

execute: Runs the adapter

Parameters

Adapter

Main class of the adapter (do not change!)

Possible values:

de.softproject.integration.adapter.jdbc.DB: Main class (default)

JndiName

JNDI name of the data source

Note:

If the connection is made using the JNDI name, the connectionURL parameter must not be filled in.

Possible values:

Valid JNDI name (e.g. java:/DefaultDS)

ColumnCase

Controls how the column names are transferred to the result. Since databases have different behavior regarding the case of column names, it is possible to make further processing of the result independent of the database behavior.

Possible values:

  • NO_CHANGE: Does not change the column names, i.e. the notation in the result is exactly as supplied by the database (default)

  • TO_LOWER: Changes the column names to lowercase

  • TO_UPPER: Changes the column names to uppercase characters

Column names that do not represent valid element names (NCNAME) are replaced by _<number> (e.g. _2 ), where <number> is the index of the column.

connectionURL

Connection URL for the JDBC database

Note:

If the connection is made using the connection URL, the JndiName parameter must not be filled in.

Possible values:

  • The type of setup depends on the database to which you want to connect.

  • Example of sqlite: jdbc:sqlite:C:/Temp/mydatabase.db

user

User name used for authenticatation when using the connectionURL parameter

password

Password used for authentication when using the connectionURL parameter

rootElementName

Name of the output root element.

Possible values:

String that is valid for XML element names. Standard: Data

CommitMode

Controls which variant is to be used for commits

Possible values:

  • NONE: Do not commit

  • AUTO: Automatic commit according to JDBC API (i.e. after each batch) (default)

  • STATEMENT: Explicit commit after each statement (i.e. after all batches for that statement)

  • DOCUMENT: At the end of the document (i.e. after all statements have been executed)

Note:

For DOCUMENT commit mode to run, the jta attribute must be set to true in the standalone.xml file in the configuration of the JDBC data source being used.

This transaction is not possible in the X4 Designer’s debug mode.

  • MANAGED: Use adapters in transactions (for externally managed transactions)

AddMetaDataForQueries

(As of X4 4.1 revision 32408) Controls whether database metadata, see JDBC Metadata Explorer, should be output for each Result Set in the adapter's result XML document when the adapter executes an SQL query (not the case with UPDATE, DELETE, etc.). This is also not possible in batch mode (StatementBatch, PreparedStatementBatch, and CallableStatementBatch).

Possible values:

  • yes: Add database metadata to the results document

  • no: Return a result document without database metadata (default)

Status values

1

The query has returned records or the instruction has changed records.

The status 1 is returned when several queries or instructions are contained in the document and at least one query has returned or changed a result.

0

The query did not return any results or the statement did not change any records.

The status 0 is returned when several queries or instructions are contained in the document and no query has returned or changed a result.

-1

Technical error: For more detailed information on the cause of the error, refer to the server log

Input

The JDBC Connector expects specific input XML structures that contain database statements. These input XML structures can be dynamically generated via XSL mappings depending on the data processed.

If you use characters that have a meaning in XML within the SQL statement or for the values or data of the table columns, mask the SQL statement with a surrounding CDATA block, for example, <![CDATA[ UPDATE PROCESS SET X4_VERSION=4 WHERE X4_DURATION=100 ]]> or <rowset> <row> <Name><!CDATA[ XML characters "<" in CDATA ELEMENT]></Name> </row> </rowset> .

This ensures that the characters in the CDATA element are not interpreted as XML, but as data for the adapter.