Creating a New Connection

You can create a new transaction in either the published business service or business service, depending on where control begins. Typically, the business service controls the transaction. The context object has exposure to all connections; so to create a new connection, you call a method from the context object. You create either a manual commit or an auto commit method. Both methods are illustrated in this code sample:

IConnection soConnection = context.getNewConnection(IConnection.MANUAL)
;);
//manual commit
IConnection soConnection = context.getNewConnection(IConnection.AUTO);
//auto commit

A manual commit method holds the record until commit or rollback is explicitly called. You create a manual commit method by using IConnection.MANUAL (false) as the parameter in the context object. An auto commit method commits the record immediately without an explicit call to commit the record. With auto commit, the record is committed when the Close method is called. You create an auto commit method by using IConnection.AUTO (true) as the parameter in the context object.

The default connection is available even when an explicit connection is created.