Use the Salesforce ODBC driver with the IBM InfoSphere Federation Server to connect DB2 to Salesforce. You can then work with Salesforce data by using DB2 conformant SQL.
The Salesforce ODBC driver is available to download from the Easysoft web site:
For installation instructions, refer to the Salesforce ODBC driver documentation.
Before you can use the Salesforce ODBC driver to connect DB2 to Salesforce, you need to configure an ODBC data source. An ODBC data source stores the connection details for the target database (in this case, Salesforce) and the ODBC driver that's required to connect to it (in this case, the Salesforce 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 Data Source Administrator, which is included with Windows.
There are two versions of ODBC Data Source Administrator. The version of ODBC Data Source 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 the 64-bit version of ODBC Data Source Administrator. To do this, in the Windows Run dialog box, enter:
%windir%\system32\odbcad32.exe
If you have the 32-bit version of DB2, you need to run the 32-bit version of ODBC Data Source Administrator. To do this, in the Windows Run dialog box, enter:
%windir%\syswow64\odbcad32.exe
Use ODBC Data Source Administrator to create your Salesforce ODBC driver data source:
Setting | Value |
---|---|
DSN | Salesforce |
User Name | The name of your Salesforce user. For example, myuser@mydomain.com . |
Password | The password for your Salesforce user. |
Token |
The security token for your Salesforce 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 Salesforce emails the security token to the email address associated with your Salesforce user account. If you have not received a security token, you can regenerate it. Salesforce will then email the new security token to you. To regenerate your security token, log in to Salesforce and then choose Setup from the user menu. Search for "security token" in the Quick Find box. Choose 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. |
You can now connect DB2 to Salesforce.
db2 "UPDATE DBM CFG USING FEDERATED YES"
You normally need to restart your DB2 instance before this change comes in to effect.
db2 CREATE WRAPPER odbc
db2 CREATE SERVER compounds_workbook WRAPPER odbc OPTIONS (NODE 'my_salesforce_dsn')
Replace my_salesforce_dsn
with the name of your Salesforce ODBC data source.
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 will be made as the user my_salesforce_user@my_domain.com
.
CREATE NICKNAME salesforce_account FOR odbc."DBO"."Account"
select * from salesforce_account