Frequently Asked Questions about IBM GBasedbt Database Driver for Perl DBI
==========================================================================

GBasedbt Database Driver for Perl DBI Version 2018.1031 (2018-10-31)

--------------------------------------------------------------------------

WHAT IS THE DIFFERENCE BETWEEN IBM GBASEDBT DATABASE DRIVER FOR PERL DBI
AND DBD::GBASEDBT?

Spelling.

The official product name had to be changed from DBD::GBasedbt to IBM
GBasedbt Database Driver for Perl because the acronym DBD is a contested
trademark of two other companies in the USA, so GBasedbt could not release
the product as DBD::GBasedbt without potentially infringing on this
trademark, and when IBM bought GBasedbt (2001-07-01), the IBM name was
prefixed to GBasedbt products.  Internally, Perl and DBI still uses the
name DBD::GBasedbt to access the driver, and much of the documentation
still references DBD::GBasedbt because that is how Perl references it, and
because it is less of a mouthful than IBM GBasedbt Database Driver for
Perl DBI.

--------------------------------------------------------------------------

HOW DO I REPORT TECHNICAL PROBLEMS WITH DBD::GBASEDBT?

See the information available via "perldoc DBD::GBasedbt::TechSupport" and
in the README file.

--------------------------------------------------------------------------

WHY IS IBM GBASEDBT ESQL/C A PRODUCT PREREQUISITE FOR DBD::GBASEDBT?

DBD::GBasedbt is freely available software that is licensed on the same
terms as Perl, under the GNU General Public License or the Perl Artistic
License.

However, to compile or use DBD::GBasedbt, you need some IBM GBasedbt
software on your computer -- specifically, you need either IBM GBasedbt
ESQL/C or IBM GBasedbt Client SDK.  This provides a compiler and the
supporting libraries necessary to connect to GBasedbt databases.  This
software must be licenced from IBM.

To purchase any IBM GBasedbt software, look in the the IBM GBasedbt Web
site (http://www.ibm.com/software/data/gbasedbt), or contact your local
IBM Sales Office.

IBM GBasedbt ClientSDK may be downloaded for some platforms from:
	http://www.ibm.com/software/data/gbasedbt/downloads.html

--------------------------------------------------------------------------

WHERE CAN I FIND DOCUMENTATION FOR IBM GBASEDBT PRODUCTS?

You can download PDF files for most IBM GBasedbt product manuals at the
IBM GBasedbt web-site:

	http://www.ibm.com/software/data/gbasedbt/pubs

Electronic manuals are not available for some of the older product
versions (but they are truly obsolete and should not be in use).

---------------------------------------------------------------------------

WHICH VERSIONS OF ESQL/C AND CLIENT SDK ARE SUPPORTED?

For details on which versions of ESQL/C and Client SDK are supported,
consult the documentation:

	perldoc DBD::GBasedbt::TechSupport

--------------------------------------------------------------------------

WHICH OTHER VERSIONS OF IBM GBASEDBT ESQL/C EXIST?

GBasedbt ESQL/C exists in obsolete versions 2.x, 4.x, 5.x, 6.x, 7.x,
8.x, and 9.x.  It also exists in the currently supported versions as
part of ClientSDK 3.00, 3.50, 3.70, 4.10.

Any of the really old GBasedbt (pre-IBM) versions earlier than version
5.00 from 1990 (such as ESQL/C 2.x, 4.x) is very obsolete and cannot be
used to build DBD::GBasedbt.

NB: IBM (re)released ESQL/C 4.x as part of a CSDK 4.x; such versions are
supported by the version checking.  The original versions 4.00 and 4.1x
date back to 1988 or 1989.  GBasedbt happened to skip versions 3.x back
in the 80s.

    Former Name       Current Name
    -----------       ----------------------
    ESQL/C 9.11     - ESQL/C 9.11 (obsolete)
    ESQL/C 9.12     - DevSDK 9.12 (obsolete)
    ESQL/C 9.13     - Client SDK 2.00 (obsolete)
    ESQL/C 9.14     - Client SDK 2.01 (obsolete)
    ESQL/C 9.15     - Client SDK 2.02 (obsolete)
    ESQL/C 9.16     - Client SDK 2.10 (obsolete)
    ESQL/C 9.20     - Client SDK 2.20 (obsolete)
    ESQL/C 9.21     - Client SDK 2.30 (obsolete)
    ESQL/C 9.30     - Client SDK 2.40 (obsolete)
    ESQL/C 9.40     - Client SDK 2.50 (obsolete)
    ESQL/C 9.50     - Client SDK 2.60 (obsolete)
    ESQL/C 9.51     - Client SDK 2.70 (obsolete)
    ESQL/C 9.52     - Client SDK 2.80 (obsolete)
    ESQL/C 9.53     - Client SDK 2.81 (obsolete)
    ESQL/C 2.90     - Client SDK 2.90 (obsolete)
    ESQL/C 3.00     - Client SDK 3.00 (Jul 2007)
    ESQL/C 3.50     - Client SDK 3.50 (May 2008)
    ESQL/C 3.70     - Client SDK 3.70 (Oct 2010)
    ESQL/C 4.10     - Client SDK 4.10 (Mar 2013)

For IDS 11.10, you should use Client SDK 3.00; for IDS 11.50, you should
use Client SDK 3.50; for IDS 11.70, you should use ClientSDK 3.70; for
IDS 12.10, you should use ClientSDK 4.10.  Finally, note that Client SDK
is available free of charge, so you should use it if at all possible.

DBD::GBasedbt no longer supports ClientSKD 2.x, and doesn't strictly
support CSDK 3.00 because IBM and HCL no elonger support the GBasedbt
11.10 server.  Indeed, CSDK 3.50 and GBasedbt 1h1.50 went out of service
at the end of April 2018 and are not really supported either - but there
is nothing known to stop DBD::GBasedbt from working with CSDK 3.00 or
3.50.

---------------------------------------------------------------------------

WILL DBD::GBASEDBT WORK WITH ANY OF THESE OTHER VERSIONS?

It is believed that DBD::GBasedbt will work with any version of ESQL/C
from version 9.20 upwards.  However, it has not been tested with every
such version, and many of these versions are obsolete.  It has also not
been tested on every platform.

Note that there is some code in Makefile.PL which enforces 'this version
is obsolete' rules on ESQL/C.  You may need to remove that code - but it
would be better to upgrade.

---------------------------------------------------------------------------

DO I NEED AN IBM GBASEDBT DATABASE SERVER ON MY DEVELOPMENT MACHINE?

You do not need an IBM GBasedbt database server on the computer where you
build or use DBD::GBasedbt.  However, to compile DBD::GBasedbt, or to make
any meaningful use of it after it is compiled, you must have access to a
computer with an IBM GBasedbt database server installed and running on it.
One step of the configuration process for DBD::GBasedbt validates your IBM
GBasedbt ESQL/C and database environments and checks that you have access
to at least one database.  If this step fails, the makefile is not
generated, so DBD::GBasedbt cannot be compiled.

If you do not have the IBM GBasedbt database system set up already, you
need to do so before you try to compile DBD::GBasedbt.  If you do not know
how to do the setup, you must obtain the necessary training.  IBM does
provide training courses in such matters; consult the Web site or your
local sales office as mentioned above.

--------------------------------------------------------------------------

WHICH IBM GBASEDBT DATABASE SERVERS ARE AVAILABLE?

IBM GBasedbt provides a large family of products, many of which are
available in a number of versions.  Database storage is managed by a
program separate from user applications (such as Perl + DBI +
DBD::GBasedbt).  Such a database management program is called the database
server.  The main GBasedbt database servers are listed below.

Refer to http://www.ibm.com/software/data/gbasedbt for additional
product information.

    GBasedbt Standard Engine (SE)                   5.x and up
    GBasedbt OnLine                                 5.x
    GBasedbt OnLine Dynamic Server (ODS)            6.x or 7.x OnLine
    GBasedbt OnLine Workgroup Server (WGS)          7.x versions, UNIX and NT
    GBasedbt OnLine Workstation (OWS)               7.x versions, NT
    GBasedbt OnLine Extended Parallel Server (XPS)  8.x OnLine
    GBasedbt Universal Server (IUS)                 9.x

In 1998, GBasedbt renamed the following products:
    GBasedbt Dynamic Server (IDS)  7.3
    GBasedbt Dynamic Server with Universal Data Option (IDS/UDO) 9.1x
    GBasedbt Dynamic Server with Advanced Decision Support Option 
      (IDS/ADSO) 8.x
    GBasedbt Dynamic Server with Extended Parallel Option (IDS/XPO) 8.x

In July 1999, the new GBasedbt Internet Foundation.2000 products were 
released and included:
    GBasedbt Dynamic Server.2000 (IDS.2000) 9.2x
    GBasedbt Internet Foundation.2000 (IIF.2000) 9.2x

In 2001, the 2000 appellation was dropped.

In 2004, the current version of IDS was  9.40.
In 2005, the current version of IDS was 10.00.
In 2007, the current version of IDS was 11.10.
In 2008, the current version of IDS was 11.50.
In 2010, the current version of IDS was 11.70.
In 2013, the current version of IDS was 12.10 (and that is current in May 2018).

Thus, IDS 11.70 or later are the only fully supported GBasedbt data
servers.

To use DBD::GBasedbt, you need to have access to an GBasedbt database
server, which means that you need GBasedbt on one of the
computers in your network.  DBD::GBasedbt will probably be of no use to you
unless you have access to a database.  You must know the version number of
the database server to ensure that you compile DBD::GBasedbt with a
compatible version of GBasedbt ESQL/C and run it in a compatible runtime
environment.

--------------------------------------------------------------------------

CAN DBD::GBASEDBT BE COMPILED WITHOUT IBM GBASEDBT ESQL/C?

To compile DBD::GBasedbt, you need an IBM GBasedbt ESQL/C compiler.
Once upon a long time ago, it was possible to build using GBasedbt 4GL
instead of ESQL/C; that is no longer supported.

--------------------------------------------------------------------------

CAN DBD::GBASEDBT RUN ON A COMPUTER DIFFERENT FROM WHERE IT WAS COMPILED?

To run DBD::GBasedbt only on the computer where you compiled it, you do not
need any extra software, and you can skip the rest of this subsection.

To run DBD::GBasedbt on a different computer from where you compiled it,
the other computer must have the same architecture as the computer used for
compiling.  However, the computers need not be identical; for example, code
compiled on a Sun Sparc 20 can be run on a Sun Sparc 10.

Every computer where you will use DBD::GBasedbt must have either an IBM
GBasedbt ESQL/C development license, or an IBM GBasedbt runtime license.
Otherwise, you violate the terms of your license agreement with IBM
(GBasedbt).  Either way, the license on the other computer should be the
same version as the development license used to compile the software.
(If you know enough about the compatability requirements for different
versions of GBasedbt products to argue about the finer points ignored by
the "same version" criterion, you probably do not need to read this.)

Further, both the DBI and DBD::GBasedbt modules will need to be installed
on the second machine, and should go into the same directory on both
machines.  That means that Perl must be installed in the same location on
both machines.  And unless you compiled DBD::GBasedbt with the environment
variable DBD_GBASEDBT_RELOCATABLE_GBASEDBTDIR set, you will need to have
the GBasedbt software installed in the same place on both machines.

--------------------------------------------------------------------------

MY PROGRAM WORKS OK WHEN I RUN IT FROM THE COMMAND LINE BUT FAILS WHEN I
RUN IT VIA A WEB SERVER (CGI, MOD_PERL, ETC), OR FROM A CRON JOB?

The answer is the environment - almost invariably.

You should establish exactly what the environment is when your script is
run, using some surrogate for your real script that uses DBI and
DBD::GBasedbt.  Then you will have to work out how to set the GBASEDBTDIR,
GBASEDBTSERVER and LD_LIBRARY_PATH environment variables properly.  With
Apache, this is usually the SetEnv directive (possibly PassEnv instead).
Other web servers will have equivalents.  You could also consider trying to
set the environment in a BEGIN block, but it may well set the environment
too late to be useful.

Note that DBD::GBasedbt version 1.00 and later normally build the
DBD::GBasedbt shared library so that it references the GBasedbt shared
libraries with absolute pathnames.  This should mean that the web server
does not need to set LD_LIBRARY_PATH or the local equivalent environment
variable.  The configuration process records a default value for
GBASEDBTDIR and GBASEDBTSERVER; these may be adequate for your production
environment.

Similar comments apply to jobs run by cron.  Unlike jobs run with the
'at' command, cron jobs get only the most minimal environment set.  You
should ensure that the environment is set correctly by a script before
it attempts to access DBD::GBasedbt.

--------------------------------------------------------------------------

IN THE FOLLOWING CODE, I GET ERROR -280 (A QUOTED STRING EXCEEDS 256 BYTES)
WHEN THE VALUE OF $LONGCHARSTRING CONTAINS MORE THAN 256 CHARACTERS.  THIS
IS ODD BECAUSE LONGCHARCOL IS DEFINED TO CONTAIN MANY MORE THAN 256
CHARACTERS (EG CHAR(2500)).

Please note that IDS version 9.30 and later and corresponding versions
of ESQL/C do not impose this limitation.  It could be time to upgrade.

	$sql = "INSERT INTO SomeTable(LongCharCol) VALUES('$longcharstring')";
	my $sth = $dbh->prepare($sql) or die($DBI::errstr);
	$sth->execute() or dir($DBI::errstr)

ESQL/C has an irritating limitation that the longest character string
literal that it allows is 256 characters long.  Furthermore, in most
versions, you cannot embed newlines in string literals.  There's a simple
workaround which always works; use a place-holder in place of the string.
This has the additional advantage of not breaking when the $longcharstring
variable itself contains quote characters, whereas the example code will
break.

	$sql = "INSERT INTO SomeTable(LongCharCol) VALUES(?)";
	my $sth = $dbh->prepare($sql) or die($DBI::errstr);
	$sth->execute($longcharstring) or dir($DBI::errstr)

Using placeholders is also the most reliable way to enter user defined data
into the database (eg from a web page).  If you take arbitrary data typed
by the user, even using the $dbh->quote method, it may be possible for the
user to break your system.  In the original example, if $longcharstring
contains:

	'); DELETE FROM SomeTable; DROP TABLE OtherTable; COMMIT WORK;

and you run the command as written, then your database might be missing two
(presumably important) tables.  Ensure that the web user has the minimum
possible privileges (CONNECT for the database, and no more than the minimum
necessary table-level privileges on any table).

--------------------------------------------------------------------------

WHEN I TRY TO BUILD THE SHARED LIBRARY, I GET AN ERROR MESSAGE ABOUT
LOTS OF MISSING SYMBOLS LIKE PERL_NEWAV (REFERENCED IN DBDATTR.O)
AND PERL_NEWSV (REFERENCED IN GBASEDBT.O) AND MAIN.  WHAT'S UP?

This most frequently occurs when you need to modify the esql script to
change the default compiler from cc to (typically) gcc, and you don't
respect the GBASEDBTC environment variable.  At the start of the original
esql script is a line that reads:

        CC=${GBASEDBTC=cc}                  # Original version

If you need to change that to use gcc by default, then modify it to keep
the option of overriding the C compiler with the GBASEDBTC environment
variable, because DBD::GBasedbt uses GBASEDBTC to ensure that it can build
the shared library on many systems (specifically, this is necessary on
Solaris 2.6, Solaris 7 and Linux; it will be necessary on many SVR4-derived
systems).

	CC=${GBASEDBTC=gcc}                 # Correct change
	CC=${GBASEDBTC=/usr/local/bin/gcc}  # Correct change

	CC=gcc                              # Incorrect change
	CC=/usr/local/bin/gcc               # Incorrect change

Why?  On these platforms, the -G option needs to be relayed to the C
compiler or loader, but the esql script thinks that -G is an option
intended for its own benefit.  So, to get the -G option to the C compiler,
it is set in the ESQLLD environment variable, and GBASEDBTC is set to run
the esqlld Perl script.  If you modify esql to ignore GBASEDBTC, you make
it ignore a lot of hard work -- and cause the build to fail.

--------------------------------------------------------------------------

HOW CAN I UPDATE BLOBS

You cannot update BYTE and TEXT blobs fully automatically with
DBD::GBasedbt.  You can insert them; you can delete them; you can select
them; all without paying very much attention to the issues.  You cannot
update them without using special measures.

Technically, the DESCRIBE request must give DBD::GBasedbt information
about the types of the paramaters on the RHS of the SET clause in an
UPDATE statement.  Without that type information, DBD::GBasedbt does not
know that it needs to treat the parameter specially.  [This should
change in 2003 when IBM releases IBM GBasedbt ClientSDK 2.81 - ESQL/C
9.53 - and IBM IDS 9.40, but the feature won't be available on older
versions of the servers.]

On the other hand, starting with version 1.03.PC1, you can update them.
See the code in test file t/t73blobupd.t for an illustration of how to
do it using the GBasedbt type support with bind_param (and, one day,
bind_param_inout).  See also 'perldoc DBD::GBasedbt'.

--------------------------------------------------------------------------

WHEN I DO "perl makefile.PL" IT FAILS WITH ERROR -369.  IT ALSO FAILS
WITH THAT ERROR IF I TRY TO RUN esqlbasic.  WHAT DOES IT MEAN AND WHAT
MUST I DO TO FIX IT?

Error -369 always means that the ESQL/C you are using is not installed
correctly.  Usually it means that: 1) although you copied off the
distribution media, you did not run the installesql script.  You need to
provide a serial number (eg AAA#A123456) and an activation key (eg
ABCDEF).  Until you do this, the software will not let you use the
libraries at runtime, even if you can compile with it.  Or, 2) if you
installed ESQL/C correctly, something else was subsequently installed
incorrectly and wrote over one of the ESQL/C libraries.  Either way, the
corrective action is to reinstall either the ESQL/C product or the other
product which overwrote the ESQL/C libraries.

The other circumstance under which this can occur with ClientSDK 2.80 or
later is if there is an internal error in the installation process.  The
licence number for such versions should be supplied automatically; if
you get this error, then there is probably a bug in the installation
code.

--------------------------------------------------------------------------

HOW DO I CONFIGURE DBD::GBASEDBT TO CONNECT TO A REMOTE DATABASE?

How do you connect using DB-Access across the network?  That's how you
connect using DBD::GBasedbt, too.  For example, you will create an entry
in your local sqlhosts file that references the remote system:

    remote_tcp  oltlitcp    remote  service_name

You will then simply do:

    $dbh = DBI->connect("dbi:GBasedbt:dbase\@remote_tcp", "", "")
                or die "A horrible death!";

Note that if you also had a local database, you'd have an entry in the
sqlhosts file such as:

    local_shm   olipcshm    local   service_name

And your connect statement will be:

    $dbh = DBI->connect("dbi:GBasedbt:dbase\@local_shm", "", "")
                or die "A horrible death!";

Or, in other words, there is essentially no difference between the local
and remote connections.  If you need to specify username and password,
do so in place of the empty strings.  If you want to omit the '\@server'
part, you can set $GBASEDBTSERVER to the correct value.

NB: The default value of $GBASEDBTSQLHOSTS is $GBASEDBTDIR/etc/sqlhosts.

NB: On Linux in particular, you often need the FQDN (fully qualified
domain name) of the server in place of 'local' or 'remote'.  Usually,
what 'uname -n' gives is what you need for the local machine.

===========================================================================

Jonathan Leffler
GBasedbt Database Engineering, HCL.

@(#)$Id: FAQ,v 2018.1 2018/05/11 22:06:21 jleffler Exp $
