MFConnection command

Syntax

{MFConnection32_v2 | MFConnection32_v4 | MFConnection64_v2 | MFConnection64_v4} 
   DSNTYPE={SYSTEM | USER | AZURE}; 
   CLRVER={2 | 4}; 
   CTYPE={ODBC | ADONET}; 
   STYPE={DB2 | SQL}; 
   MODE={ADD | UPDATE | REMOVE | CHECK | EXIST}; 
   DSN=connectionName; 
   PROVIDER=providerName; 
   ADOSAVEP={TRUE | FALSE}; 
  [SERVER=serverName;] 
  [DATABASE=databaseName;] 
  [TC={YES | NO};] 
  [IC=initialCatalog;] 
  [NA=networkAddress;] 
  [NP=networkPort;] 
  [PC=packageCollection;] 
  [CCSID=HostCCSID;] 
  [USERID=userId;] 
  [PASSWORD=password;] 
  [CREPOS={TRUE | FALSE};] 
   TYPELOG={CONSOLE | FILE | BOTH}; 
  [CTIMEOUT=timeOutInSeconds;] 
  [LOGFILE=logFileName;] 
  [FORCE={TRUE | FALSE};] 
  [FMODE={TRUE | FALSE};]

Parameters:

DSNTYPE
Specifies the type of connection to associate with the DSN.
SYSTEM Connection information is specific to the system configuration found in the machine.config file and other relevant system configuration files.
Note: When using a SYSTEM connection and UAC, you must run MFConnection as an administrator.
USER Connection information is specific to the user logged onto Windows.
AZURE Connection information is specific to AZURE.
CLRVER
The Common Language Runtime (CLR) version of an ADO.NET connection. Valid values are 2 or 4. Value required but ignored if CTYPE=ODBC.
CTYPE
Specifies the type of connection. Valid values are ODBC or ADONET.
STYPE
Specifies the server type. Valid values are DB2 or SQL.
MODE
Specifies the action to perform on the connection.
ADD Establish and catalog the connection.
UPDATE Update the existing connection. Must also specify the FORCE parameter.
DELETE Delete the connection.
CHECK Check the status of the connection.
EXIST Determine if the connection exists.
DSN
Specifies a name for the connection.
PROVIDER
The name of the provider.
Connection Value
SQL Server ODBC The full provider name, for example, ODBC Driver 17 for SQL Server.
SQL Server ADO.NET System.Data.SqlClient
DB2 DB2OLEDB
Note: Do not enclose the value in quotes.
ADOSAVEP
Save the ADO.NET connection password. Valid values are TRUE or FALSE. Value required but ignored if CTYPE=ODBC.
SERVER
Server name for the connection. Default is no value.
DATABASE
Database name for the connection. Default is no value.
TC
Trusted connection setting for the connection.
YES Use Windows Authentication. Default.
NO Connect by passing login credentials via the USERID and PASSWORD (if required by USERID) parameters.
IC
Initial catalog setting for the connection. Default is no value.
NA
Network address setting for the connection. Default is no value.
NP
Network port setting for the connection. Default is no value.
PC
Package collection setting for the connection. Default is no value.
CCSID
The host CCSID setting for the connection. Default is no value.
USERID
Specifies a user ID to pass to the database. Required for SQL Server connections when TC=NO. Otherwise optional, depending on your database requirements.
PASSWORD
Specifies the password for the user ID specified with the USERID parameter. Required for SQL Server connections when TC=NO and the specified user ID requires a password. Otherwise optional, depending on your database requirements.
CREPOS
Specifies whether or not to validate the connection.
TRUE Validates the connection as follows:
  • The parameters provided on the command line are sufficient to establish a valid connection
  • The parameters provided on the command line are cross referenced with connection details stored in the Windows registry (ODBC connections) and configuration files (ADO.NET connections)
FALSE Validates that the parameters provided on the command line are sufficient to establish a valid connection. Default.
TYPELOG
Sets the type of logging to perform. Valid values are:
  • CONSOLE
  • FILE
  • BOTH (Default)
CTIMEOUT
Sets a timeout value, in seconds, when testing a connection. Default is 5.
LOGFILE
When TYPELOG=FILE or TYPELOG=BOTH, specifies the log file name. The default value is HCOSS-log-file-path\Connections\CONMANtimestamp.log.
FORCE
Force overwrite of existing connection settings. Valid values are TRUE or FALSE. Default is FALSE.

Examples:

To add a system 32-bit ODBC SQL Server connection (CLRVER, ADOSAVEP values are ignored for ODBC connections):

 mfconnection32_v4 DSNTYPE=SYSTEM; CLRVER=2;
CTYPE=ODBC; STYPE=SQL; MODE=ADD; DSN=APP_DSN; PROVIDER=ODBC Driver
17 for SQL Server; ADOSAVEP=FALSE; SERVER=YOURSERVER;
DATABASE=YOURDB; TC=YES; TYPELOG=BOTH;

To add a system 32-bit ADO.NET SQL Server CLR 4 connection:

 mfconnection32_v4 DSNTYPE=SYSTEM; CLRVER=4;
CTYPE=ADONET; STYPE=SQL; MODE=ADD; DSN=APP_DSN;
PROVIDER=System.Data.SqlClient; ADOSAVEP=TRUE; SERVER=YOURSERVER;
DATABASE=YOURDB; TC=YES; TYPELOG=BOTH;

To add a system 32-bit ADO.NET DB2 CLR 4 connection:

 mfconnection32_v4 DSNTYPE=SYSTEM; CLRVER=4;
CTYPE=ADONET; STYPE=DB2; MODE=ADD; DSN=APP_DSN; PROVIDER=DB2OLEDB;
ADOSAVEP=TRUE; USERID=YOURUSERID; PASSWORD=YOURPASSWORD;
NA=YOURIPADDRESS; NP=YOURPORTNUMBER; IC=YOURINITIALCATALOG;
PC=YOURPACKAGECOLLECTION; CCSID=YOURHOSTCCSID;
TYPELOG=BOTH;