Adapter for JDBC 10.3 | webMethods Adapter for JDBC Documentation | webMethods Adapter for JDBC Installation and User’s Documentation | Adapter Services | Configuring ExecuteService Services | Considerations When Creating a Java or Flow Service that Uses a Connection from the Connection Pool
 
Considerations When Creating a Java or Flow Service that Uses a Connection from the Connection Pool
*Use the value in the $db_service_connection from the pipeline to obtain the connection. You can also use the following Java String constant variable in your Java or flow service code, provided that the package in which you create the service is dependent on the WmJDBCAdapter package:
com.wm.adapter.wmjdbc.services.ExecuteService.PIPELINE_CONNECTION
For information about setting the package dependencies, see the webMethods Service Development Help for your release.
*Do not use the forbidden methods like close(), setAutoCommit(), and commit() in the service code. Doing so causes the adapter to throw an exception at run time.
*When using the ExecuteService in transactions, it is important for the WmART package to be aware about any exceptions generated in the service within the transaction SEQUENCE block. Only then will a roll back of the transaction happen. You can do this by throwing a ServiceException from the service. You can use the following sample code in the service code to do so.
java.sql.Connection conn =
(java.sql.Connection)IDataUtil.get(pipeline.getCursor(),
com.wm.adapter.wmjdbc.services.ExecuteService.PIPELINE_CONNECTION);
try
{
java.sql.PreparedStatement pstmt=conn.prepareStatement("insert into Person
values(1,'Chris')");
pstmt.execute();
}
catch(Throwable e)
{
e.printStackTrace();
throw new ServiceException(e);
}
Note:
If an error occurs when using the ExecuteService in a transaction for a Teradata database, the roll back of transactions does not happen.