Explicit and Implicit Connections
SourcePro DB allows you to fully control how your application creates and uses connections. All methods of the DB Interface Module that actually hit a database have two forms:
an
implicit connection form, which does
not require an
RWDBConnection argument
an
explicit connection form, which requires an
RWDBConnection argument.
A method using an implicit connection has this form:
RWDBSelector selector = myDbase.selector();
...
selector.execute(); // RWDBConnection is assigned implicitly by
// the DB Interface Module to execute
// this statement
In contrast, the same method using an explicit connection has this form:
selector.execute( conn1 ); // User has explicitly provided
// an RWDBConnection, conn1, to be used
// for the execution of this statement
In the first
execute method above, an
RWDBConnection is obtained by the DB Interface Module behind the scenes. This
RWDBConnection is either retrieved from the
connection pool, which is explained in detail in the next section, or created dynamically if all available connections in the pool are in use. If for some reason an
RWDBConnection cannot be obtained, an error results. The error is reported through the
RWDBStatus object returned from the invocation or associated with the object returned from the method invocation.
In the second
execute method above, the user provides the
RWDBConnection directly; that is why the connection is called explicit.