Java Reference
In-Depth Information
Table 9-2 (continued)
Method
Description
getConnectionSpec()
Used to get the ConnectionSpec object if it is already
specified in the getConnection method. If it is not
specified, this method returns a newly created Con-
nectionSpec instance.
supportsCapability(ConnectionCapability)
Used to find the connection capabilities of the DME.
Returns true if the specified capability is supported.
Table 9-3
javax.datamining.resource.ConnectionSpec interface
Method
Description
set/getURI(String)
Used to set and get the location of the DME with which the API will
interact.
set/getUsername(String)
Used to set and get the user name used to connect to the DME.
set/getPassword(String)
Used to set and get the password used to connect to the DME.
set/getLocale(Locale)
Used to get the locale information of the client so that the DME can use
language-specific settings and error messages.
Listing 9-3
Get the Connection using ConnectionSpec
1. //If getConnection(ConnectionSpec) supported by the DME
2. if(connFactory.supportsCapability(ConnectionCapability.connectionSpec)) {
3. //Get the empty connection spec from the factory
4. ConnectionSpec connSpec = connFactory.getConnectionSpec();
5. //Specify the connection details
6. connSpec.setURI("DMELocation");
7. connSpec.setUsername("user");
8. connSpec.setPassword("passwd");
9. //Get the DME Connection
10. Connection dmeConn = connFactory.getConnection(connSpec);
11. }
9.1.2
Using the Connection Interface
The JDM resource.Connection interface provides methods to create
and manage mining objects, execute mining tasks, and explore the
capabilities of the DME. Table 9-4 lists all the methods in the
Connection interface. In this table, the Connection interface methods
Search WWH ::




Custom Search