Accessing databases from ESQL

You can create and configure ESQL in message flows to access user databases.

Before you start:

To complete this task, you must have completed the following tasks:

You can use a number of ESQL statements and functions to access databases:

INSERT statement
The INSERT statement adds a row to a database table
UPDATE statement
The UPDATE statement changes one or more values stored in zero or more rows
DELETE FROM statement
The DELETE FROM statement removes zero or more rows
SELECT function
The SELECT function retrieves data from a table
CALL statement
The CALL statement invokes a stored procedure
PASSTHRU statement
The PASSTHRU statement can be used to invoke administrative operations, such as creating a table
PASSTHRU function
The PASSTHRU function can be used to invoke complex selects

You can access user databases from Compute, Database, and Filter nodes. There is no difference between the database access capabilities of these nodes, but the following restrictions apply.

To access databases, you must ensure that suitable ODBC data sources have been created on the system on which the broker is running. If you have used the mqsisetdbparms command to set a user ID and password for a particular database, the broker uses these values to connect to the database. If you have not set values for a particular database, the broker uses the default database user ID and password that you supplied on the mqsicreatebroker command, or the user ID and password details that you specified if you have modfied them using the mqsichangebroker command.

On z/OS systems, the broker uses the broker started-task ID to connect to the database. You must also ensure that the database user IDs have sufficient privileges to perform the operations your flow requires. If they do not have the required privileges then errors will occur at runtime.

For a description of database transactional issues, see The Transactional model.

You are recommended to set the "throw exception on database error" and "treat warnings as errors" attributes to 'yes' and the "transaction" attribute to "automatic" as this gives the maximum flexibility. You then use the COMMIT and ROLLBACK statements for transaction control and handlers for dealing with errors.

Related concepts
Message flows overview
Related tasks
Creating the databases
Connecting to the databases
Configuring coordinated message flows
Configuring databases for coordinated message flows
Configuring WebSphere MQ and RRS for coordinated message flows
Editing configurable properties
Related reference
Supported databases
mqsicreatebroker command
mqsisetdbparms command
Built-in nodes
User database connections
User database DBCS restrictions and UNICODE support