executeSQL()

Executes a SQL query in the relationship database by specifying a CALL statement.

Syntax

void executeSQL(String query)
 void executeSQL(String query, Vector queryParameters)
 

Parameters

query
The SQL query to run in the relationship database.

queryParameters
A Vector object of arguments to pass to parameters in the SQL query.

Return values

None.

Exceptions

DtpConnectionException - If a database error occurs.

Notes

Before executing a query with executeSQL(), you must create a DtpConnection object with the getRelConnection() method from the BaseDLM class.

The SQL statements you can execute include INSERT, SELECT, DELETE, and UPDATE. You can also execute stored procedures with the limitation that this stored procedure cannot use any OUT parameters. To execute stored procedures with OUT parameters, use the execStoredProcedure() method.

Examples

The following example executes a query for inserting rows into a table in the SapCust relationship.

DtpConnection connection = getRelConnection("SapCust");
  
 // begin a transaction
 connection.beginTran();
  
 // insert a row
 connection.executeSQL("insert...");
  
 // commit the transaction
 connection.commit();
  
 // release the database connection
 releaseRelConnection(true);
 

See also

execStoredProcedure(), getRelConnection(), hasMoreRows(), nextRow()

Copyright IBM Corp. 1997, 2003