Question & Answer
Question
Answer
2. Download the IBM DB2 ODBC Driver from the "IBM Data Server Driver" package within IBM Fix Central, for SPSS Modeler 18.0 FP1 this is "DSClients-macos-dsdriver-11.1.1.1-FP001" that can be downloaded from:
https://www-945.ibm.com/support/fixcentral/swg/selectFixes?parent=ibm~Information%2BManagement&product=ibm/Information+Management/IBM+Data+Server+Client+Packages&release=11.1.*&platform=Mac+OSX&function=fixId&fixids=*macos_dsdriver*FP001*&includeSupersedes=0&source=fc
NOTE: for up-to-date information on supported ODBC drivers refer to the footnotes of the DB2 entry in the IBM SPSS Modeler Related Software Reports on the IBM Software Compatibility Reports for the version of SPSS Modeler that you are using, http://www-969.ibm.com/software/reports/compatibility/clarity/index.jsp
3. Install the ODBC driver:
a. Create a folder ‘dsdriver’ under /Applications
b. Double click the downloaded v11.1.1fp1_macos_dsdriver.dmg file and a "dsdriver" window will open
c. Double click ‘installDSDriver’
4. Configure the ODBC Driver Manager and ODBC Driver
a. Open ODBC manager, and in Driver tab, add DB2 native driver. Specify ‘DB2 Native Driver’ in the 'Driver Name' slot and ‘/Applications/dsdriver/lib/libdb2.dylib’ in the 'Driver File' slot - no other information is required here.
b. In the 'System DSN' tab of ODBC Manager create a DB2 DSN
i. In the "Choose a Driver" slot specify the 'DB2 Native Driver' you defined in 4.a. above
ii. Specify a DSN in the 'Data Source Name (DSN) slot, eg. 'DB2v11' and click on 'Add' to create the system DSN.
c. Configure the DB2 Native Driver to connect to your DB2 instance:
Define the DB2 server information in the config file db2dsdriver.cfg under /Applications/dsdriver/cfg. An example of this is (using the example DSN "DB2v11" as specified in 4.b.ii. above):
<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
<configuration>
<dsncollection>
<dsn alias="DB2v11" host="<IP_or_HOST_NAME>" name="SAMPLE" port="50000">
</dsn>
</dsncollection>
<databases>
<database host="<IP_or_HOST_NAME>" name="SAMPLE" port="50000">
<parameter name="CommProtocol" value="TCPIP"/>
<parameter name="UID" value="<YOUR_DB2_USER_ID>"/>
<parameter name="EnableCharToWCharMapping" value="1"/>
<parameter name="XMLDefaultDescribeMapping" value="-98"/>
<parameter name="XMLDefaultCMapping" value="1"/>
<parameter name="LobAsLongDataMode" value="1"/>
</database>
</databases>
</configuration>
NOTE: Ensure the DSN in ODBC manager matches the one specified in the cfg file.
For more details of the configuration file, please refer to https://www.ibm.com/support/knowledgecenter/en/SSEPGG_11.1.0/com.ibm.swg.im.dbclient.config.doc/doc/c0054555.html
Also, if you need to use db2 commands to create or edit db2d2driver.cfg, or validate the contents of it, please add the profile file ‘db2profile’ under /Applications/dsdriver into your profile ($HOME/.profile).
You can validate the datasource you have defined outside of Modeler to ensure it is correctly defined by running the following from a terminal on the Mac, in the event of connections issues from within Modeler ensure this step succeeds and diagnose any issues with reference to the DB2 documentation:
db2cli validate -dsn <DSN> -connect -user <DB2USER> -passwd <DB2PASSWD>
substitute <DSN>, <DB2USER> and <DB2PASSWD> for the DSN you have created in db2dsdriver.cfg, and the DB2 username and password respectively.
Was this topic helpful?
Document Information
Modified date:
19 September 2019
UID
swg22001806