DB2 Version 9.7 for Linux, UNIX, and Windows

Attach CLI/ODBC configuration keyword

Specifies whether to attach to the server instance. You can specify this keyword in the connection string or set it in the db2cli.ini or db2dsdriver.cfg file.

db2cli.ini keyword syntax:
ATTACH = TRUE | FALSE
Default setting:
The SQLDriverConnect() function connects to the specified database.
Equivalent environment or connection attribute:
N/A
Usage notes:

When you set the keyword to TRUE, the SQLDriverConnect() function does not connect to a database but instead connects to the specified server instance.

To establish a connection with a DB2 server instance for Linux, UNIX, and Windows remote server, the CLI application must specify values for the Hostname, Port, UID, PWD, and Protocol along with setting the keyword to TRUE.

Any value other than TRUE that you assign to the ATTACH keyword is treated as FALSE.

Examples:
The following example shows a specification of the keyword in the db2cli.ini file:
ATTACH=TRUE
The following example shows specifications of the keyword in the db2dsdriver.cfg file:
<configuration> 
   <dsncollection>
        <dsn 
alias="db2dsn01",name="db2db01",host="server1.mynet.com", 
port="50001"> 			
           <parameter name="ATTACH" value="TRUE"/> 		
        </dsn> 	 
    </dsncollection>
    <databases> 		
        <database name="sample", host="serv1.mynet.com", 
port="50001"> 			
          <parameter name="ATTACH" value="TRUE"/> 		
      </database> 	 
   </databases> 
</configuration>                                    

Version information

Last update
This topic was last updated for IBM DB2 Version 9.7, Fix Pack 3.
IBM Data Server Client
Supported in IBM DB2® for Linux, UNIX, and Windows