Easysoft ODBC-Salesforce Driver

How do I connect DB2 to Salesforce.com?

Article:
01097
Last Reviewed:
19th May 2015
Revision:
1

Use the Salesforce.com ODBC Driver with the IBM InfoSphere Federation Server to connect DB2 to Salesforce.com. You can then work with Salesforce data by using DB2 conformant SQL.

The Salesforce.com ODBC Driver is available to download from the Easysoft web site:

  1. Download the Windows Salesforce.com ODBC Driver. (Registration required.)
  2. Install and license the Salesforce.com ODBC Driver on the machine where DB2 is installed.

    For installation instructions, see the Salesforce.com ODBC Driver documentation.

Before you can use the Salesforce.com ODBC Driver to connect DB2 to Salesforce.com, you need to configure an ODBC data source. An ODBC data source stores the connection details for the target database (e.g. Salesforce.com) and the ODBC driver that is required to connect to it (e.g. the Salesforce.com ODBC driver).

You can configure a User ODBC data source, which is only available to the user who creates it, or a System ODBC data source, which is available to all users on the machine. You configure ODBC data sources in ODBC Administrator, which is included with Windows.

64-bit Windows There are two versions of ODBC Administrator on this platform. (If you are not sure whether your version of Windows is 32-bit or 64-bit, follow the instructions in this Microsoft Knowledge Base article to find out.) The version of ODBC Administrator that you need to run depends on whether you have a 32-bit or a 64-bit version of DB2. To find out, run the db2level command.

If you have the 64-bit version of DB2, you need to run 64-bit version of ODBC Administrator. To do this, open Administrative Tools in Control Panel, and then open Data Sources (ODBC). (On Windows Server 2003 and earlier, the Control Panel applet that launches ODBC Administrator is labelled Data Sources. On Windows 8 and later, the Control Panel applet is labelled ODBC Data Sources (64-bit).)

If you have the 32-bit version of DB2, you need to run the 32-bit version of ODBC Administrator. To do this, in the Windows Run dialog box, type:

%windir%\syswow64\odbcad32.exe

32-bit Windows To run ODBC Administrator on 32-bit Windows, open Administrative Tools in Control Panel, and then open Data Sources (ODBC). (On older versions of Windows, the Control Panel applet that launches ODBC Administrator is labelled Data Sources.)

Use ODBC Administrator to create your Salesforce.com ODBC Driver data source:

  1. Choose the System DSN tab, and then choose Add.
  2. In the Create New Data Source dialog box, choose Easysoft ODBC-Salesforce Driver, and then choose Finish.
  3. Complete the Easysoft ODBC-Salesforce Driver DSN Setup dialog box:
    SettingValue
    DSNSalesforce.com
    User NameThe name of your Salesforce.com user. For example, my_salesforce_user@my_domain.com.
    PasswordThe password for your Salesforce.com user.
    TokenThe security token for your Salesforce.com user, if required.

    To find out whether you need to supply a security token, choose the Test button. If the connection attempt fails with an error which contains LOGIN_MUST_USE_SECURITY_TOKEN, you need to supply one.

    Salesforce.com emails the security token to the email address associated with your Salesforce.com user account. If you have not received a security token, you can regenerate it. Salesforce.com will then email the new security token to you. To regenerate your security token, log in to Salesforce.com and then choose Setup from the user menu. Search for "security token" in the Quick Find box. Click Reset Security Token in the Reset Security Token page. When you receive the token in your email client, copy it and then paste it into the Token field.

  4. Use the Test button to verify that you can successfully connect to Salesforce.com.

You can now connect DB2 to Salesforce.com.

Connect DB2 to Salesforce.com by using a Federated Server

  1. Connect to your DB2 database.
  2. If necessary, enable federated support within DB2:
    db2 "UPDATE DBM CFG USING FEDERATED YES"

    You normally need to restart your DB2 instance before this change comes in to effect.

  3. Register an ODBC wrapper:
    db2 CREATE WRAPPER odbc
  4. Register an ODBC server:
    db2 CREATE SERVER compounds_workbook WRAPPER odbc 
         OPTIONS (NODE 'my_salesforce_dsn')

    Replace my_salesforce_dsn with the name of your Salesforce.com ODBC data source.

  5. Map your DB2 user to a Salesforce user:
    db2 "CREATE USER MAPPING FOR db2inst1 SERVER odbc  OPTIONS ( ADD REMOTE_AUTHID 'my_salesforce_user@my_domain.com',  
    ADD  REMOTE_PASSWORD 'my_salesforce_password')"

    In the example, if you connect to DB2 with the auth id db2inst1 all connections to Salesforce.com will be made as the user my_salesforce_user@my_domain.com.

  6. Create a nickname for each Salesforce.com object that you want to access. For example:
    CREATE NICKNAME salesforce_account FOR odbc."DBO"."Account"
  7. Use the nickname in your DB2 SQL statements to work with your Salesforce data:
    select * from salesforce_account
Applies To

Knowledge Base Feedback

* Did this content help you?
* Please select one option based on your first choice:

(* Required Fields)