Skip to main content

By clicking Submit, you agree to the developerWorks terms of use.

The first time you sign into developerWorks, a profile is created for you. Select information in your developerWorks profile is displayed to the public, but you may edit the information at any time. Your first name, last name (unless you choose to hide them), and display name will accompany the content that you post.

All information submitted is secure.

  • Close [x]

The first time you sign in to developerWorks, a profile is created for you, so you need to choose a display name. Your display name accompanies the content you post on developerworks.

Please choose a display name between 3-31 characters. Your display name must be unique in the developerWorks community and should not be your email address for privacy reasons.

By clicking Submit, you agree to the developerWorks terms of use.

All information submitted is secure.

  • Close [x]

Take a beginner's tour of the Informix virtual table interface with shared libraries

Write extensions to access external data sources and applications

Daniel Hebert (dhebert@us.ibm.com), Staff Software Engineer, IBM
Daniel Hebert has his B.S. and graduate level experience in Computer Science from Rensselaer Polytechnic Institute. He has been an engineer in the IBM Informix organization since 2006.
Carla Wilcox (cwilcox@us.ibm.com), Software Engineer, IBM
Carla Wilcox has B.S. degrees in Computer Science and Electrical Engineering from the University of Washington, Seattle. She has been a software engineer in the IBM Informix organization since 2006.

Summary:  IBM® Informix® provides access to external data sources through the virtual table interface (VTI). The VTI provides a set of hooks called purpose functions. As a developer, your task is to create an access method that implements VTI purpose functions and as many additional user-defined routines (UDRs) as necessary to access your external data source. This tutorial shows you how to compile and run your VTI UDR as a shared library.

Date:  17 Mar 2011
Level:  Intermediate PDF:  A4 and Letter (47 KB | 16 pages)Get Adobe® Reader®

Activity:  13345 views
Comments:  

Before you start

About this tutorial

Informix provides access to external data sources through the virtual table interface (VTI). External data sources include flat files, other databases, internet feeds, and other sources.

The VTI provides a set of hooks called purpose functions. As a developer, your task is to create an access method that implements VTI purpose functions and as many additional user-defined routines (UDRs) as necessary to access your external data source.

This tutorial shows you how to compile and run your VTI UDR as a shared library. For clarity in the examples, the VTI purpose functions reside in one source file and the auxiliary C functions reside in a separate source file. The VTI purpose functions are compiled and linked into a datablade library called tutorial.bld. The auxiliary C functions are compiled and linked into a separate shared library called libtutorial. One advantage of compiling the VTI purpose functions and the auxiliary C functions into separate libraries is that the auxiliary C functions can be used by multiple VTI libraries.

Prerequisites

You must have the Informix server installed. This tutorial was validated with Informix versions 11.50 and 11.70. Later versions are expected to behave similarly.

You need intermediate programming skills, as well as some background with the C programming language. You need a working knowledge of how to install and configure Informix. The Informix virtual appliance is used in this tutorial to provide a common environment. You can download the Informix virtual appliance from the IBM Informix free downloads site, which is listed in the Resources section. You can also find the Informix virtual appliance by searching for IBM virtual appliances on the IBM web site. Or you can go to the IBM free downloads web page and search for Informix virtual appliance.

You can find documentation for the Informix virtual appliance in the Informix Information Center and on the appliance itself once the image is booted.

System requirements

This tutorial assumes you are using Linux, but the basic concepts apply and the demo code can be ported to any system that supports Informix.


Overview

This tutorial demonstrates how to use a shared library in conjunction with the VTI. Shared libraries have the advantage that they are loaded dynamically and only when necessary. This limits your process to grow only when needed.

This tutorial also shows you how to debug UDR code that resides in a shared library. Note that the symbols in the shared library are not visible until the shared library is loaded.

The shared library in this demonstration implements a print method. This method is used to implement a trace facility for the VTI purpose functions invoked during a simple select SQL statement. You can build on this demonstration to create your own custom C library. Your customized library is available for use by VTI purpose functions and can perform any general task.

This demonstration VTI UDR shows only four of the complete set of purpose functions. The server calls a purpose function to perform well-defined tasks to access and manage your external data sources. You will need to implement all of the remaining purpose functions for a complete VTI UDR. Refer to Resources for larger, more advanced examples.

1 of 8 | Next

Comments



Help: Update or add to My dW interests

What's this?

This little timesaver lets you update your My developerWorks profile with just one click! The general subject of this content (AIX and UNIX, Information Management, Lotus, Rational, Tivoli, WebSphere, Java, Linux, Open source, SOA and Web services, Web development, or XML) will be added to the interests section of your profile, if it's not there already. You only need to be logged in to My developerWorks.

And what's the point of adding your interests to your profile? That's how you find other users with the same interests as yours, and see what they're reading and contributing to the community. Your interests also help us recommend relevant developerWorks content to you.

View your My developerWorks profile

Return from help

Help: Remove from My dW interests

What's this?

Removing this interest does not alter your profile, but rather removes this piece of content from a list of all content for which you've indicated interest. In a future enhancement to My developerWorks, you'll be able to see a record of that content.

View your My developerWorks profile

Return from help

static.content.url=http://www.ibm.com/developerworks/js/artrating/
SITE_ID=1
Zone=Information Management
ArticleID=632765
TutorialTitle=Take a beginner's tour of the Informix virtual table interface with shared libraries
publish-date=03172011
author1-email=dhebert@us.ibm.com
author1-email-cc=
author2-email=cwilcox@us.ibm.com
author2-email-cc=

Tags

Help
Use the search field to find all types of content in My developerWorks with that tag.

Use the slider bar to see more or fewer tags.

Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere).

My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Use the search field to find all types of content in My developerWorks with that tag. Popular tags shows the top tags for this particular content zone (for example, Java technology, Linux, WebSphere). My tags shows your tags for this particular content zone (for example, Java technology, Linux, WebSphere).

Try IBM PureSystems. No charge.