Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
TIBCO Spotfire: A Comprehensive Primer

You're reading from   TIBCO Spotfire: A Comprehensive Primer Create innovative enterprise-class informatics solutions using TIBCO Spotfire

Arrow left icon
Product type Paperback
Published in Feb 2015
Publisher Packt
ISBN-13 9781782176404
Length 348 pages
Edition 1st Edition
Arrow right icon
Author (1):
Arrow left icon
Michael Phillips Michael Phillips
Author Profile Icon Michael Phillips
Michael Phillips
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Show Me the Data FREE CHAPTER 2. Visualize This! 3. Analyze That! 4. The Big Wide World of Spotfire 5. Source Data is Never Enough 6. The World is Your Visualization 7. What's Your Location? 8. The Secret Life of Python 9. It's All About Self-service These Days 10. Beyond the Horizon Index

Connecting to a database

Working with text files and spreadsheets can be very convenient but, sooner or later you are going to want to work with databases, which offer many advantages such as scale and centralization. If you want to build scalable, enterprise analytical solutions, you will have to maintain your source data in a database or even distributed across multiple databases. Spotfire provides many ways to connect to databases, and you can retrieve data simultaneously from multiple databases and files.

Up to Version 3 of Spotfire, we had the option to connect to databases such as Oracle, Microsoft SQL Server, and Microsoft Access using standard data connectors such as ODBC, OleDB, Oracle client, and SqlClient. Explaining how these types of connectors work is beyond the scope of this book. You will find detailed explanations on the Internet.

They all require database-specific drivers, which you can think of as like an operating system plugin. Many of these drivers come bundled with operating systems; some you will have to download and install. Again, you will find lots of help on the Internet. The best place to look is on the websites of the various database vendors.

They all require some form of connection string, which is just a way to tell the driver the address of your database and the credentials you are using to connect. Most databases will require authentication before you can connect and access their data. The website http://www.connectionstrings.com is a good starting place. Sometimes the entire connection string is pasted as a literal string into a single configuration box; sometimes the individual elements of the connection string are entered into fields in configuration form; it just depends on the connector.

Using ODBC

Open Database Connectivity (ODBC) is one of the easiest drivers to use. It might not be perfect for all applications, but it's usually a reliable way to get started. As you gain experience, you will use other options. It might also depend on the database(s) you wish to connect to.

There are three important prerequisites before you start:

  • The relevant ODBC driver must be installed on your machine.
  • You must have local administrator rights to set up the ODBC connection.
  • You must have connection details for the target database, including a username and password to authenticate.

How to set up an ODBC connection in Microsoft Windows 7

  1. Open Control Panel and then Administrative Tools. If your control panel is organized by theme, you'll have to go into System and Security and then into Administrative Tools.
  2. In Administrative Tools, open Data Sources (ODBC) and click on the System DSN tab.
    How to set up an ODBC connection in Microsoft Windows 7
  3. Click on the Add button to configure the connector, scrolling down the list of drivers until you find the one you need. For this example, we're interested in the Oracle driver.
    How to set up an ODBC connection in Microsoft Windows 7
  4. Click on Finish to get to the business end of the configuration.
    How to set up an ODBC connection in Microsoft Windows 7
  5. Data Source Name is entirely arbitrary; it is the reference you will use in Spotfire. The Server configuration includes a hostname, which is simply the name of the server hosting the database; a port, usually 1521; and a DB service name, which you can get from the database administrator. Click on OK to finish and return to the System DSN tab, where you will see your entry. Make sure you click on OK to exit the ODBC administration tool.

Now you are ready to use this ODBC connection to retrieve data into Spotfire.

Using an ODBC connection in Spotfire

Use the File menu or the Add Data Table icon to navigate to the add data table dialog just as you did to add data from a file, except this time you are going to select Database rather than File.

Using an ODBC connection in Spotfire
  1. Click on Database to get the Open Database dialog. We're interested in Odbc Data Provider, so select it and click on the Configure button.
    Using an ODBC connection in Spotfire
  2. Select the connection name you configured in the ODBC administrator. You'll notice that a number of connectors are defined in the next screenshot, including one called SpotfireDev. You will need to create one of your own for a database to which you have access.
    Using an ODBC connection in Spotfire
  3. Click on OK to get back to the Open Database window; notice that Spotfire has created a connection string. Click on OK to open the database. The database will eventually open; it may take a little time if your network connection is slow or the database is complex. You will see a hierarchical organization of high-level containers, in each of which you should see data tables and their constituent columns. It's not unlike navigating a folder system on your computer.
    Using an ODBC connection in Spotfire
  4. You will need to have some knowledge of the database and some idea of the data you are looking for, but Spotfire will allow you to navigate the database objects and select whole or partial tables to import. Spotfire will also generate the SQL automatically, but you can customize and fine-tune the SQL, adding a where clause, for example.
  5. If you click on + next to one of the main objects, such as SPOTFIRE in the example, the entry will expand to list all the tables in that schema. You can then scroll down to a table of interest and expand further to view the individual columns in the table.
    Using an ODBC connection in Spotfire
  6. When you are happy with the selections, give the import a name. This will be the name of the table in Spotfire. The data will load just as the files did, except the structure of the data (column headers and data types) will be determined by the source database.

Tip

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you. You can also download code from http://www.insidespotfire.com.

You have been reading a chapter from
TIBCO Spotfire: A Comprehensive Primer
Published in: Feb 2015
Publisher: Packt
ISBN-13: 9781782176404
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image