Easysoft Blog

Mon, 29 Feb 2016

Analysing ODBC Data in IBM SPSS

IBM SPSS (which originally stood for Statistical Package for the Social Sciences) is an analytics package that can take data from multiple sources and use it to generate reports, charts and plots of distributions and trends. One of the ways of getting data into SPSS is from a database, and primarily, SPSS relies on ODBC to do this. ODBC is data access interface which uses database-specific components called ODBC drivers to connect to and work with data.

To illustrate the process, the following steps show how to work with Salesforce.com and MongoDB data in IBM SPSS by using an Easysoft ODBC driver for these products.

Example: How to connect IBM SPSS to Salesforce.com

The components necessary to connect IBM SPSS to Salesforce.com are:

IBM SPSS <-> Salesforce.com ODBC Driver <-> Salesforce.com

Example: How to connect IBM SPSS to MongoDB

The components necessary to connect IBM SPSS to MongoDB are:

IBM SPSS <-> MongoDB ODBC Driver <-> MongoDB

The Salesforce.com ODBC Driver and MongoDB ODBC driver are available to download from the Easysoft web site.

Installing, Licensing and Testing the Easysoft ODBC Driver

  1. Download the Windows Salesforce.com ODBC Driver or Windows MongoDB ODBC Driver as required. (Registration required.)
  2. Install and license the Easysoft ODBC Driver on a Windows machine.

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

Before you can use the Easysoft ODBC Driver to connect IBM SPSS to Salesforce.com or MongoDB, you need to configure a System 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).

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.)

To run ODBC Administrator on 64-bit Windows, in the Windows Run dialog box, type this command:

%windir%\system32\odbcad32.exe

Note This command runs the 64-bit version of ODBC Administrator. As IBM SPSS is a 64-bit application on 64-bit Windows, this is the version you need to use.

Use ODBC Administrator to create your ODBC Driver data source.

Creating a Salesforce.com ODBC 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, myuser@mydomain.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.

Creating a MongoDB ODBC Data Source

  1. Choose the System DSN tab, and then choose Add.
  2. In the Create New Data Source dialog box, choose Easysoft ODBC-MongoDB Driver, and then choose Finish.
  3. Complete these fields Easysoft ODBC-MongoDB Driver DSN Setup dialog box:
    SettingValue
    DSNMongoDB
    DescriptionEasysoft MongoDB ODBC Driver
    ServerThe name or IP address of the host where your MongoDB instance is running.
    User NameIf you need to supply a user name to access your MongoDB database, enter it here.
    PasswordThe password for your MongoDB user name.
  4. Use the Test button to verify that you can successfully connect to your MongoDB database.

Connecting IBM SPSS to your ODBC Database

You can now connect IBM SPSS to your ODBC database.

  1. In IBM SPSS, choose File > New Stream.
  2. Choose Insert > Sources > Database .
  3. Right-click the database. From the pop-up menu, choose Edit.
  4. In the resultant dialog box, from the Data source list, choose your ODBC data source.
  5. Choose the Select button, to the right of the Table name box.
  6. In the Tables/Views. list, choose the table that contains the data you want to work with in SPSS. Choose OK.
  7. Right-click the database. From the pop-up menu, choose Preview to display the data.

    The ODBC data is now available to use in your SPSS stream.