Connecting To IBM I IBM I Access Client Solutions: Linux Application Package
Connecting To IBM I IBM I Access Client Solutions: Linux Application Package
Version 7.2
Connecting to IBM i
IBM i Access Client Solutions: Linux
Application Package
IBM
IBM i
Version 7.2
Connecting to IBM i
IBM i Access Client Solutions: Linux
Application Package
IBM
Note
Before using this information and the product it supports, read the information in “Notices” on page 13.
This edition applies to version 6, release 1, modification 0 of System i Access for Linux (product number 5761-XL1)
and to all subsequent releases and modifications until otherwise indicated in new editions. This version does not
run on all reduced instruction set computer (RISC) models nor does it run on CISC models.
This document may contain references to Licensed Internal Code. Licensed Internal Code is Machine Code and is
licensed to you under the terms of the IBM License Agreement for Machine Code.
© Copyright IBM Corporation 2004, 2013.
US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract
with IBM Corp.
Contents
Linux Application Package . . . . . . 1 Error messages . . . . . . . . . . . 8
PDF file for Linux Application Package . . . . . 1 IBM i Access Client Solutions - Linux Application
Prerequisites for using the Linux Application Package 2 Package utilities . . . . . . . . . . . . . 9
Getting started with Linux Application Package . . 2 CWBMEDIC - Service information collection tool 9
Security . . . . . . . . . . . . . . . . 3 CWBNLTBL - Download conversion tables . . . . 10
IBM i Access ODBC . . . . . . . . . . . . 3 CWBPING - Test the connection to the server . . . 10
ODBC language considerations . . . . . . . 3 CWBTRC - Trace Linux Application Package . . . 11
Restrictions when using ODBC with the Linux
Application Package . . . . . . . . . . . 5 Notices . . . . . . . . . . . . . . 13
Configure an ODBC data source . . . . . . . 5 Programming interface information . . . . . . 15
Use GUI to configure an ODBC data source . . 5 Trademarks . . . . . . . . . . . . . . 15
Manually configure an ODBC data source . . 6 Terms and conditions . . . . . . . . . . . 15
Troubleshoot ODBC . . . . . . . . . . . 7
ODBC problem isolation . . . . . . . . 7
The Linux Application Package can use business information, applications, and resources across an
enterprise by extending the system's resources to the Linux client. The product provides access to the Db2
for IBM i database, by using an ODBC driver, all from a Linux client.
Note: By using the code examples, you agree to the terms of the Code license and disclaimer
information.
To view or download the PDF version of this document, select IBM i Access Client Solutions - Linux
Application Package .
Web sites
v IBM i Access Client Solutions - Linux Application Package Visit this site to learn more about IBM i
Access Client Solutions - Linux Application Package.
v IBM i Access This site has online IBM i Access product information.
v Linux on IBM Power Systems Visit this site to learn more about Linux on Power Systems.
v ODBC and the unixODBC project This site provides information on the unixODBC Driver
Manager. Among other things, there are links here to see what is fixed in a particular release and a
spot to download the latest version of the unixODBC Driver Manager.
v Microsoft Data Developer Center This site gets you to information about the ODBC specification
and examples on how to use it.
You need Adobe Reader installed on your system to view or print these PDFs. You can download a free
copy from the Adobe Web site .
Note: If you recompile the unixODBC driver manager, the ./configure --prefix default is /usr/local. If
you use this default, update your shared library (/etc/ld.so.conf) and executable paths to include it.
See the IBM i Access Client Solutions web site for additional details.
Related information:
Entitled Software Support
IBM i Access Client Solutions web site
Kerberos
The Linux Application Package supports IBM i authentication using Kerberos. To install and configure
the IBM i platform for Kerberos, see the Single signon topic, in the Security topic collection in the IBM i
Information Center.
Note: Most Linux distributions include at least one version of Kerberos 5, either Heimdal or MIT.
However, some distributions do not create a symbolic link for the Kerberos shared library for Heimdal
(/usr/lib/libgssapi.so) or MIT (/usr/lib/libgssapi_krb5.so). The Linux Application Package dynamically
loads the Kerberos shared library, using the associated .so name. If a symbolic link is not available, you
get the following error: CWBSY1015 - Kerberos not available on this version of the operating
system.
To use Kerberos with the Linux Application Package, you must first authenticate to your Kerberos
domain using the kinit command or by setting up your initial Linux login to authenticate with the
pluggable authentication module (PAM) Kerberos plugin. After successful authentication, you should be
able to do a klist -f to see the status of your Kerberos tickets.
For any IBM i Access function, you can use *kerberos in place of the IBM i user profile to use your
Kerberos tickets. Any password is ignored in this case.
The Kerberos principle name is based upon the fully qualified TCP/IP name received from the reverse
lookup of the TCP/IP address. If you use a host file to resolve TCP/IP addresses, be sure to include the
fully qualified TCP/IP system name. For example: 1.2.3.4 mysystem.example.com mysystem.
For enabling the Linux Application Package to use secure sockets layer (SSL) support, OpenSSL and
stunnel can be used. An example stunnel configuration file is provided: /opt/ibm/iaccess/doc/
iaccess.stunnel.config.
The character code page conversions involve using conversion tables and the iconv interfaces. Some of
the conversion tables are shipped with the driver, others are downloaded from the server when needed.
iconv is a library shipped with Linux that also handles character data conversions.
The ODBC Driver included with the Linux Application Package product uses a pair (to and from) of
Coded Character Set Identifiers (CCSID) to convert character data. The conversion uses a conversion table
or the iconv interfaces.
Conversion Tables
Conversion tables are stored in /opt/ibm/iaccess/conv_tables and use the following naming convention:
<4 byte hex number of FROM CCSID><4 byte hex number of TO CCSID>.tbl
Many conversion tables are shipped with the IBM i Access ODBC Driver. Additional conversion tables
are downloaded from the server when they are needed. You can also download conversion tables using
the cwbnltbl utility.
To find out the current mapping between the current locale's character set and the CCSID that is used,
use the following command:
/opt/ibm/iaccess/bin/cwbnltbl
To change or the add character set CCSID mapping, add the following lines to the $HOME/
.iSeriesAccess/cwb_userprefs.ini configuration file.
The above example creates mappings for CCSID 939 to character set "IBM939" and for CCSID 819 to
character set "IBM819".
Most conversion problems are logged in the History Log. To turn on history logging, use the following
command:
/opt/ibm/iaccess/bin/cwbtrc /hl:1
The following table describes the Linux Application Package restrictions when using ODBC.
Table 1. ODBC restrictions.
Restriction Reason
MTS is not supported. This depends on Microsoft Windows-specific components which
are not available on Linux.
Note: Open XA Transaction API's are supported.
APIs that display a graphical user interface are The API call completes but displaying the GUI fails.
not supported.
Translation DLLs Translation DLLs are not currently supported. Attempts to use
them are ignored.
DSN connection option for user ID /password Graphical user interfaces are not ported to Linux.
prompting via a sign-on dialog is not supported.
DSN option for customizing package settings for Only the simple implementation of package settings is ported to
an application is not supported. Linux.
See Unsupported Connection String Keywords These keywords correspond with options that are not supported.
for other DSN options that are not supported in
Linux.
Secure Sockets Layer (SSL) component The SSL component is not included with the Linux Application
Package. You can use a common SSL tunnel or Socks server.
Connection Timeout The connection timeout option is not supported with the Linux
driver.
The following instructions describe how to set required and frequently used options to create and
configure your ODBC data source, using the ODBC data source graphical user interface(GUI).
1. Open the Data Source Administrator that comes with the unixODBC driver manager by typing the
following at the command prompt:
v ODBCConfig
2. Decide the type of data source name (DSN) to create.
v A user data source is only accessible by the user who creates it.
v A system data source is created using root authority but is accessible by any user on server.
3. Choose one of the following:
v Click Add... to create a new data source, then continue with the next step.
v Click Configure... to configure a data source that already exists, then go to step 5.
The ODBC data source graphical user interface(GUI) contains a subset of the most commonly used
connection options. Additional connection options are specified by the connecting application or by
editing the odbc.ini file.
It is strongly recommended that you reference the Connection string keywords topic before manually
configuring connection options.
Use the following steps to add connection options to the odbc.ini file:
1. Open the odbc.ini file on your workstation using a text editor.
v For user data sources, this file is in the root directory of the user who created the data source. For
example, the file for user "exampleUser" is /home/exampleUser/.odbc.ini.
v For system data sources, odbc.ini is located in /etc/odbc.ini or /usr/local/etc/odbc.ini depending
on how you installed the unixODBC driver manager.
2. If there are multiple ODBC data sources in the odbc.ini file, locate the section in the file that
contains the data source, that is the target for the additional connection options you are configuring.
3. Add a new line after the last entry in the data source and enter the new connection option and its
value.
v The syntax is keyword = value.
v For example, if you want to change the date format from its default of 5 (yyyy-mm-dd or *ISO), to
1 (mm/dd/yy or *MDY), you would add DFT = 1 in the new line.
4. Repeat step 3 to add additional connection options to the data source.
5. Save the odbc.ini file.
Note:
1. Do not add multiple entries for the same connection option to the same section for a specific data
source. This can lead to unpredictable behavior.
2. After manually editing the registry you can use ODBCConfig to configure your data source.
3. Options specified by the application in the connection string override any options specified in the
odbc.ini file.
Related information:
Connection string keywords
Troubleshoot ODBC
Use this information to help you understand, isolate, and resolve problems with ODBC.
Communications
Use the cwbping program to verify the IBM i connection with the Linux workstations, and to verify the
host servers are started.
Once you verify your connection to the server, there see the following trace files for problem isolation:
v SQL log. The unixODBC sql.log will show the input and output parameters for ODBC API calls made.
The sql.log is activated using the unixODBC ODBCConfig program. From the Advanced tab, you can
enable sql tracing and configure the location of the log file.
v History log. The history log will show high-level communication, security and data conversion error
messages. The History log is activated using the cwbtrc program.
v Detail trace. The detail trace will show low-level driver information and is intended for use in
reporting problems to IBM. Detail trace is activated using the cwbtrc program.
v Service information collection tool. The service information collection tool is intended for use in
reporting problems to IBM. The service information collection tool is activated using the cwbmedic
program.
Related reference:
Error messages
When an error occurs, the ODBC Driver included with the Linux Application Package returns the
SQLSTATE (an ODBC error code) and an error message. The driver obtains this information both from
errors that are detected by the driver and from IBM i errors that are returned.
For errors that occur in the data source, the ODBC Driver maps the returned native error to the
appropriate SQLSTATE. When both the driver and the driver manager detect an error, they generate the
appropriate SQLSTATE. The ODBC Driver returns an error message based on the IBM i returned
message.
For errors that are detected within the ODBC Driver, the driver returns an error message based on the
text associated with the SQLSTATE. These error messages are translated messages. Error message files
and the help text for error messages found in the underlying components of the IBM i Access product are
shipped in the /opt/ibm/iSeriesAccess/doc directory.
error-message
The prefixes in brackets ([ ]) identify the source of the error. When the error occurs in the data source, the
[vendor] and [ODBC-component] prefixes identify the vendor and name of the ODBC component that
received the error from the data source. The following table shows the values of these prefixes returned
by the IBM i ODBC Driver for Linux:
See the message prefix table below to find second level help text.
Communication and Security unixODBC] [IBM] [IBM i Access ODBC Driver] Communications link failure.
comm rc=xxxx - (message text)
xxxx is the error number in decimal, not hexadecimal, format. Message text
describing the nature of your error appears with the error number. See the
message prefix table below to find second level help text.
For other prefixes that may be seen through the ODBC Driver included with the IBM i Access Client
SolutionsLinux Application Package, see the following table:
Use the following links for more information on the Linux Application Package utilities:
Syntax
cwbmedic
Parameters
This command creates a .tgz file in the user's home directory. If requested, please send this file to IBM
Service for analysis.
Examples
v To run the command, enter cwbmedic .
v To view the contents of this file, enter the following commands:
tar xvzf /home/username/cwbmedic.tgz
cat cwbmedic.out
Syntax
Parameters
v source-code-page = source code page for the table
v target-code-page = target code page for the table
v system = IBM i name, from which tables are downloaded.
Note: If a IBM i connection is necessary, the user ID and password must also be specified.
v userid = IBM i user ID
v password = IBM i password
Examples
v To download the 819 to 13488 conversion table from the system if necessary, run cwbnltbl 819 13488
myiSeriesSystem myiSeriesuserid myiSeriesPwd
v To show the current locale charset and its code-page mapping, run cwbnltbl
CWBPING checks of the status of the IBM i host servers. The name of the communications provider is
shown, as well as the result of connecting to each of the host socket servers. To see detailed messages,
use the (/v) verbose option.
Syntax
Parameters
v system = name of the server
v /v = verbose output
v /pl:# = port mode (0 = Server services file, 1 = Local services file, 2 = Standard port )
Note: Any TCP/IP service name can be used. For example, see CWBCO1003 or you local services file.
v /port:# = port number to connect to in decimal (i.e. /port:23 or /port:21)
Note: Any TCP/IP port number can be used. For example, see CWBCO1003 or your local services file
.
v /user:userid = IBM i user ID to use only if the server requires security on startup
v /password:password = IBM i password to use only if the server requires security on startup
v /all = verify all possible servers, by default only common servers are verified.
Examples
To check the status of the IBM i host servers named System1 with address 9.12.103.14:
cwbping System1
Syntax
cwbtrc [/DT:0-1] [/DPATH:path] [/DWRAP:0-4000] [/DFLTR:0-1] [/DTICK:0-1] [/DFRMT:0-1] [/HL:0-1]
[/HPATH:path] [/HWRAP:0-4000] [/HFLTR:0-1] [/HTICK:0-1]
Parameters
Running CWBTRC without any parameters will show the command syntax and the current status of each
parameter.
cwbhistory-<process name>-<pid>.csv
The output files will be in semicolon separated record format, suitable for input into spreadsheets for
viewing.
Examples
The following command will turn on detail trace and allow it to grow to a 10 megabyte file before
wrapping. It will also turn on history logging.
cwbtrc /dt:1 /dwrap:10 /hl:1
The following command will turn on history log and change the path to /usr/traces
cwbtrc /hl:1 /hpath:/usr/traces
IBM may not offer the products, services, or features discussed in this document in other countries.
Consult your local IBM representative for information on the products and services currently available in
your area. Any reference to an IBM product, program, or service is not intended to state or imply that
only that IBM product, program, or service may be used. Any functionally equivalent product, program,
or service that does not infringe any IBM intellectual property right may be used instead. However, it is
the user's responsibility to evaluate and verify the operation of any non-IBM product, program, or
service.
IBM may have patents or pending patent applications covering subject matter described in this
document. The furnishing of this document does not grant you any license to these patents. You can send
license inquiries, in writing, to:
For license inquiries regarding double-byte (DBCS) information, contact the IBM Intellectual Property
Department in your country or send inquiries, in writing, to:
The following paragraph does not apply to the United Kingdom or any other country where such
provisions are inconsistent with local law: INTERNATIONAL BUSINESS MACHINES CORPORATION
PROVIDES THIS PUBLICATION "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR
IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Some
states do not allow disclaimer of express or implied warranties in certain transactions, therefore, this
statement may not apply to you.
This information could include technical inaccuracies or typographical errors. Changes are periodically
made to the information herein; these changes will be incorporated in new editions of the publication.
IBM may make improvements and/or changes in the product(s) and/or the program(s) described in this
publication at any time without notice.
Any references in this information to non-IBM Web sites are provided for convenience only and do not in
any manner serve as an endorsement of those Web sites. The materials at those Web sites are not part of
the materials for this IBM product and use of those Web sites is at your own risk.
IBM may use or distribute any of the information you supply in any way it believes appropriate without
incurring any obligation to you.
IBM Corporation
Software Interoperability Coordinator, Department YBWA
3605 Highway 52 N
Rochester, MN 55901
U.S.A.
Such information may be available, subject to appropriate terms and conditions, including in some cases,
payment of a fee.
The licensed program described in this document and all licensed material available for it are provided
by IBM under terms of the IBM Customer Agreement, IBM International Program License Agreement or
any equivalent agreement between us.
Any performance data contained herein was determined in a controlled environment. Therefore, the
results obtained in other operating environments may vary significantly. Some measurements may have
been made on development-level systems and there is no guarantee that these measurements will be the
same on generally available systems. Furthermore, some measurements may have been estimated through
extrapolation. Actual results may vary. Users of this document should verify the applicable data for their
specific environment.
Information concerning non-IBM products was obtained from the suppliers of those products, their
published announcements or other publicly available sources. IBM has not tested those products and
cannot confirm the accuracy of performance, compatibility or any other claims related to non-IBM
products. Questions on the capabilities of non-IBM products should be addressed to the suppliers of
those products.
All statements regarding IBM's future direction or intent are subject to change or withdrawal without
notice, and represent goals and objectives only.
This information is for planning purposes only. The information herein is subject to change before the
products described become available.
This information contains examples of data and reports used in daily business operations. To illustrate
them as completely as possible, the examples include the names of individuals, companies, brands, and
products. All of these names are fictitious and any similarity to the names and addresses used by an
actual business enterprise is entirely coincidental.
COPYRIGHT LICENSE:
This information contains sample application programs in source language, which illustrate programming
techniques on various operating platforms. You may copy, modify, and distribute these sample programs
in any form without payment to IBM, for the purposes of developing, using, marketing or distributing
application programs conforming to the application programming interface for the operating platform for
which the sample programs are written. These examples have not been thoroughly tested under all
conditions. IBM, therefore, cannot guarantee or imply reliability, serviceability, or function of these
programs. The sample programs are provided "AS IS", without warranty of any kind. IBM shall not be
liable for any damages arising out of your use of the sample programs.
Each copy or any portion of these sample programs or any derivative work, must include a copyright
notice as follows:
© (your company name) (year). Portions of this code are derived from IBM Corp. Sample Programs.
Trademarks
IBM, the IBM logo, and ibm.com are trademarks or registered trademarks of International Business
Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be
trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at
“Copyright and trademark information” at www.ibm.com/legal/copytrade.shtml.
Adobe, the Adobe logo, PostScript, and the PostScript logo are either registered trademarks or trademarks
of Adobe Systems Incorporated in the United States, and/or other countries.
Intel, Intel logo, Intel Inside, Intel Inside logo, Intel Centrino, Intel Centrino logo, Celeron, Intel Xeon,
Intel SpeedStep, Itanium, and Pentium are trademarks or registered trademarks of Intel Corporation or its
subsidiaries in the United States and other countries.
Linux is a registered trademark of Linus Torvalds in the United States, other countries, or both.
Microsoft, Windows, Windows NT, and the Windows logo are trademarks of Microsoft Corporation in the
United States, other countries, or both.
ITIL is a registered trademark, and a registered community trademark of the Office of Government
Commerce, and is registered in the U.S. Patent and Trademark Office.
UNIX is a registered trademark of The Open Group in the United States and other countries.
Cell Broadband Engine is a trademark of Sony Computer Entertainment, Inc. in the United States, other
countries, or both and is used under license therefrom.
Java™ and all Java-based trademarks and logos are trademarks of Oracle, Inc. in the United States, other
countries, or both.
Other product and service names might be trademarks of IBM or other companies.
Personal Use: You may reproduce these publications for your personal, noncommercial use provided that
all proprietary notices are preserved. You may not distribute, display or make derivative works of these
publications, or any portion thereof, without the express consent of IBM.
Commercial Use: You may reproduce, distribute and display these publications solely within your
enterprise provided that all proprietary notices are preserved. You may not make derivative works of
these publications, or reproduce, distribute or display these publications or any portion thereof outside
your enterprise, without the express consent of IBM.
Notices 15
Except as expressly granted in this permission, no other permissions, licenses or rights are granted, either
express or implied, to the publications or any information, data, software or other intellectual property
contained therein.
IBM reserves the right to withdraw the permissions granted herein whenever, in its discretion, the use of
the publications is detrimental to its interest or, as determined by IBM, the above instructions are not
being properly followed.
You may not download, export or re-export this information except in full compliance with all applicable
laws and regulations, including all United States export laws and regulations.
Printed in USA