Java Reference
In-Depth Information
After getting the ConnectionFactory object, the DME Connection
can be created using one of the getConnection methods. Table 9-2
lists all the methods in the ConnectionFactory interface. The getCon-
nection() method that takes no arguments is used when the Connec-
tionFactory maintains the DME location and authentication details.
In this case, no connection specification is required to get the DME
Connection from the ConnectionFactory . The ConnectionSpec interface
is used to specify the connection details, such as the location of the
DME, user name, password, and client locale information. Table 9-3
lists all the methods declared in the ConnectionSpec interface.
Method getConnectionSpec() in the ConnectionFactory is used to get
the ConnectionSpec of the DME. If ConnectionSpec is not pre-specified
in the ConnectionFactory , the method getConnectionSpec returns an
empty ConnectionSpec object and the application can set appropriate
DME details using its set methods, as shown in Table 9-3. In this
example, the method getConnection(ConnectionSpec) is used to get a
Connection . Listing 9-3 shows the code example for this case. In line 2,
method supportsCapability is used to ensure that the JDM implemen-
tation supports the ConnectionSpec approach to get a connection
before using this method. JDM-compliant implementations can sup-
port one or more of the getConnection methods.
Method getConnection(javax.connector.cci.Connection) is used to
create a DME connection using the J2EE Connector Architecture (JCA)
JSR-16. The JCA is generally used by J2EE tools vendors and system
integrators to create resource adapters that support access to
enterprise information systems (EISs). These EISs can then be plugged
into any J2EE product [J2EE Tutorial 2006]. If a DME vendor sup-
ports a JCA-compliant connection interface, it can use the getConnec-
tion method that creates a wrapper JDM-compliant connection using
the specified javax.resource.cci.Connection.
Table 9-2
javax.datamining.resource.ConnectionFactory interface
Used to get the connection in container managed
Used to get the connection with the caller specified
connection details.
Used to get the connection using the J2EE Connector
API client connection.
Search WWH ::

Custom Search