Importing mining models from files

With the import functions of Intelligent Miner®, you can import a PMML mining model from a file and return it as a value of the appropriate data type.

Table 1 shows the relationship between the import function, the returned data type, and the sample table.

A PMML model is an XML document. Therefore the XML encoding specification in the XML header is respected. You can override this encoding specification. For example, specifying a different XML encoding might be required if the encoding that is specified in the file is an unsupported name for a supported code page, or if the encoding of the file was changed without changing the encoding that is written in the file.

If an encoding specification does not exist, UTF8 is assumed.

In the table below, the import functions for files that use a specific XML encoding are designated with the character E at the end of their names, for example, DM_impClusFileE.

Table 1. Import functions and related data types and tables
Import function Data type Table
DM_impClasFile, DM_impClasFileE DM_ClasModel IDMMX.CLASSIFMODELS
DM_impClusFile, DM_impClusFileE DM_ClusteringModel IDMMX.CLUSTERMODELS
DM_impRegFile, DM_impRegFileE DM_RegressionModel IDMMX.REGRESSIONMODELS
DM_impRuleFile, DM_impRuleFileE DM_RuleModel IDMMX.RULEMODELS
DM_impTsFile, DM_impTsFileE DM_TimeseriesModel IDMMX.TIMESERIESMODELS
You can use the following command from the command line to import the file myclusters.xml and insert it into the CLUSTERMODELS table in your schema. The name of a file must be passed to the import functions as absolute path name.
db2 insert into IDMMX.CLUSTERMODELS (MODELNAME, MODEL) 
           values( 'CustomerSegments',
           IDMMX.DM_impClusFileE('/tmp/myclusters.xml', 'iso-8859-1' )

Read permissions

If DB2® cannot read a file, the following error message is displayed:
SQL0443N Routine ... has returned an error SQLSTATE with diagnostic text "E 8906: File ...". SQLSTATE=38M01 

If an existing file cannot be read, a read permission might be missing. The file might be accessible for the current user account, but not for the database because the database process that tries to access the file might be run by another user account that does not have the permission to read the file.

To fix the problem, you can provide the missing read permission for the user account or you can start the database process with a different user account that already has the required read permission.

Providing read permission for the user account

Typically, the following user accounts run database processes:
On Windows
Typically, user db2admin is used.

On Windows, the database is running as a Windows service. You can display the Windows services by selecting Settings > Control Panel > Administrative Tools > Services.

On UNIX
The instance owner. Typically, the user account of the instance owner is called db2inst1.
On UNIX, you can list the database processes by entering the following command:
ps -fu <instance owner> | grep " db2"
To make the file accessible for the database, change the file permission to allow the database user account to read the file.


Feedback | Information roadmap