Welcome!

PowerBuilder Authors: Chris Pollach, Yeshim Deniz, Jayaram Krishnaswamy, Kevin Benedict, Avi Rosenthal

Related Topics: PowerBuilder

PowerBuilder: Article

PowerBuilder & Informix

Connectivity options

In this article we'll discuss connectivity requirements, Informix-specific data type processing, and the use of Informix stored procedures within the PowerBuilder environment.

PowerBuilder offers developers four specific connectivity options for IBM Informix databases:

  • Third-party Open Database Connectivity (ODBC) drivers
  • Third-party Java Database Connectivity (JDBC) drivers
  • Third-party OLE-DB providers
  • The "native" driver available in the PowerBuilder Enterprise version

In this article we'll focus on the last option by discussing connectivity requirements, Informix-specific data type processing, and the use of Informix stored procedures within the PowerBuilder environment.

Connecting to Informix
Supported Versions
The PowerBuilder native driver for Informix connectivity (IN9) is linked with the IBM Informix ESQL C product to provide connectivity to the following IBM Informix databases

  • IBM Informix Dynamic Server (IDS)
  • IBM Informix Standard Engine (SE)
  • IBM Informix OnLine 5

PowerBuilder application developers and end users wishing to connect to an IBM Informix database server must install the IBM Informix Connect product containing the necessary files for runtime client use. IBM Informix Connect is also included as a component within the Informix Client SDK (Software Development Kit). The SDK offers additional development tools including JDBC and ODBC drivers, an OLE-DB provider, and libraries for including embedded SQL within C, C++, and Java programs.

As there is a wide range of features supported on the various IBM Informix products, not all of the topics in this article will apply to all database servers. This article is generally focused on the features provided in IBM Informix Dynamic Server, which IBM considers their offering for mission-critical applications.

Setnet32 Configuration
Included in IBM Informix Connect is a client utility called Setnet32 (see Figure 1). This program is used to specify default values for the connectivity parameters required to establish a connection with the Informix database from that client machine. Many of the parameters that can be entered within the Setnet32 interface are also, optionally, supplied via the PowerBuilder database profile or within script by assigning values to the properties of the PowerBuilder transaction object.

Setnet32 records the configuration information within the Windows registry on the client machine, and those values are used when the analogous connection parameters are not supplied via PowerBuilder. Within Setnet32, you can actually specify all of the default parameters, including the user name and password of the client account, such that the Connect Information in the PowerBuilder Database Profile Setup (see Figure 2) can be completely empty and your connection will still succeed!

PowerBuilder Database Profile Setup for IBM Informix
By comparing the values supplied in the fields shown in Figure 1 with those in Figures 2 and 3, you can easily correlate many of the parameters supplied via Setnet32 with the PowerBuilder profile counterparts. In addition to these options, you can also use Setnet32, and specifically its Environment tab, to set a number of optional environment variables. Among those, the two most critical are:

  • INFORMIXSERVER: the name of the default server (dyn2000, above)
  • INFORMIXDIR: The path to the Informix Connect software

For each item entered via the PowerBuilder Database Profile painter to support a connection to an IBM Informix database server, Table 1 provides:

  • A description of that item
  • The corresponding property setting in the PowerBuilder transaction object (using SQLCA as the representative transaction object)
  • The analogous setting within the Setnet32 interface (which is also used as the default value if not explicitly provided by your PowerBuilder database profile or script)
  • The Windows registry setting where Setnet32 stores and retrieves this information (HKLM and HKCU indicate the \\HKEY_LOCAL_MACHINE and the \\HKEY_CURRENT_USER registry hives, respectively)

The specifications of protocol and service are interdependent and have a specific set of ranges and values. Consult the Administrator's Guide accompanying your IBM Informix server for details.

Data Types
Database vendors often provide data types that have the same name but have different semantics from those available in PowerBuilder. Table 2 presents the IBM Informix data types and the corresponding PowerBuilder data types. Not all of the IBM Informix data types are available on all IBM Informix database products. Also, please note the PowerBuilder equivalents for each of the native database data types may or may not support the same range of values or precision.

DATETIME and TIME Data Types
IBM Informix's DATETIME type makes use of a field qualifier segment to specify the precision of the date and time values that can be stored within that field. By default, the qualifier used when creating columns using PowerBuilder's Database painter is:

DATETIME YEAR TO FRACTION(5)

which can store any date from 1/1/0001 00:00:00000 to 12/31/9999 23:59:59.99999. PowerBuilder's year range limits this span to the years 1000 to 3000; however, since PowerBuilder can support microseconds, the precision of the time is retained.

More Stories By Jim O'Neil

Jim is a Technology Evangelist for Microsoft who covers the Northeast District, namely, New England and upstate New York. He is focused on engaging with the development community in the area through user groups, code camps, BarCamps, Microsoft-sponsored events, etc., and just in general serve as ambassador for Microsoft. Since 2009, Jim has been focusing on software development scenarios using cloud computing and Windows Azure. You can follow Jim on Twitter at @jimoneil

Comments (0)

Share your thoughts on this story.

Add your comment
You must be signed in to add a comment. Sign-in | Register

In accordance with our Comment Policy, we encourage comments that are on topic, relevant and to-the-point. We will remove comments that include profanity, personal attacks, racial slurs, threats of violence, or other inappropriate material that violates our Terms and Conditions, and will block users who make repeated violations. We ask all readers to expect diversity of opinion and to treat one another with dignity and respect.