Front page | perl.dbi.users |
Postings from July 2006
DBD::Informix on Solaris
From:
Govinda.Pfister
Date:
July 4, 2006 04:11
Subject:
DBD::Informix on Solaris
Message ID:
CC1D21009A31C04992DFDB990247610F014CBBF3@S4DE8DSAAFR.sued.t-com.de
Hello List,
I have a working informix environment with DBI and DBD::Informix. (see details for version, configuration below).
I do have the problem that I cannot get the serial after a insert statement is executed.
I always get '0' back. In the database each inserted record gets a unique number assigned.
Why?
The code is as follows:
----------------------------------------------------------
# Vorbereiten des DBI/DBD::Informix Einfüge-Statements für das Importieren der Daten in die Informix-Datenbank
(my $sth = $dbh->prepare("INSERT INTO stammdatenkundeninfo (uid, firstname, lastname, formofaddress, title, email, phone, mobile, fax, company, orgshort, orglong, costcenter, type, nameaffix, room, building, street, postalcode, country, status) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"))
or die "${spacer_two}\nFehler: Vorbereiten des DBI/DBD::Informix Einfüge-Statements gescheitert -". $dbh->errstr() ."\n${spacer_two}\n";
(my $sth_upd = $dbh->prepare("Update stammdatenkundeninfo SET requestid = ? WHERE id = ?"))
or die "${spacer_two}\nFehler: Vorbereiten des DBI/DBD::Informix Update-Statements gescheitert -". $dbh->errstr() ."\n${spacer_two}\n";
# Durchlaufen der einzelnen Zeilen der CSV-Datei bis keine mehr da ist
my $anzahl=0;
while ($csv->get_row()) {
# Zuweisen der einzelnen Inhalte der aktuellen Zeile zu Variablen
(my $user_id, $first_name, $lastname, $form_of_adress, $title, $email, $phone, $mobile, $fax, $company, $orgshort, $orglong, $costcenter, $type, $nameaffix, $room, $building, $street, $postalcode, $country) = $csv->extract("User ID","First Name","Last Name","Form of Address","Title","E-Mail","Telephone","Mobile","Fax","Company","OrgShort","OrgLong","Cost Center","Type of Employement", "Name affix", "Room", "Building", "Street", "Postal Code", "Country")
or warn "${spacer_two}\nWarnung: Probleme beim Zuweisen der Spalten des CSV-Datensatz zu Variablen - ${!}\n${spacer_two}\n";
# Ausführen des DBI/DBD::Informix Einfüge-Statements mit den vorbereitenen Variablen
$@ ='';
eval{
$sth->execute($user_id, $first_name, $lastname, $form_of_adress, $title, $email, $phone, $mobile, $fax, $company, $orgshort, $orglong, $costcenter, $type, $nameaffix, $room, $building, $street, $postalcode, $country, "imported");
};
# Fehlerbehandlung
if ($@){
die "${spacer_two}\nFehler: Import des Datensatzes mit der User-ID \"${user_id}\" ist gescheitert -". $dbh->errstr() ."\n${spacer_two}\n";
}
else{
my $id = $sth->{ix_sqlerrd}[1];
printf ILOG "<%6s> %s (DB-ID: %10s)\n", $anzahl, "Import des Datensatzes mit der User-ID \"${user_id}\" war erfolgreich.", $id;
$anzahl++;
$sth_upd->execute($id, $id) or die "Update: $!";
}
}
----------------------------------------------------------
Bugreport-Info:
perl -V
---------------------------------------
Summary of my perl5 (revision 5 version 8 subversion 7) configuration:
Platform:
osname=solaris, osvers=2.8, archname=sun4-solaris
uname='sunos solaris 5.8 generic_108528-11 sun4u sparc sunw,ultra-5_10 '
config_args='-Dcc=gcc -B/usr/ccs/bin/'
hint=recommended, useposix=true, d_sigaction=define
usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef
useperlio=define d_sfio=undef uselargefiles=define usesocks=undef
use64bitint=undef use64bitall=undef uselongdouble=undef
usemymalloc=n, bincompat5005=undef
Compiler:
cc='gcc -B/usr/ccs/bin/', ccflags ='-fno-strict-aliasing -pipe -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64',
optimize='-O',
cppflags='-fno-strict-aliasing -pipe -I/usr/local/include'
ccversion='', gccversion='3.3.2', gccosandvers='solaris2.8'
intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=4321
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8
alignbytes=8, prototype=define
Linker and Libraries:
ld='gcc -B/usr/ccs/bin/', ldflags =' -L/usr/local/lib '
libpth=/usr/local/lib /usr/lib /usr/ccs/lib
libs=-lsocket -lnsl -ldl -lm -lc
perllibs=-lsocket -lnsl -ldl -lm -lc
libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
gnulibc_version=''
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
cccdlflags='-fPIC', lddlflags='-G -L/usr/local/lib'
Characteristics of this binary (from libperl):
Compile-time options: USE_LARGE_FILES
Built under solaris
Compiled at Dec 2 2005 01:34:16
@INC:
/usr/local/lib/perl5/5.8.7/sun4-solaris
/usr/local/lib/perl5/5.8.7
/usr/local/lib/perl5/site_perl/5.8.7/sun4-solaris
/usr/local/lib/perl5/site_perl/5.8.7
/usr/local/lib/perl5/site_perl/5.6.1
/usr/local/lib/perl5/site_perl
esql -v
---------------------------------------
IBM Informix CSDK Version 2.90, IBM Informix-ESQL Version 2.90.FC4
Software Serial Number AAA#B000000
dbaccess -V
----------------------------------------
DB-Access Version 9.21.UC6
Software Serial Number AAD#J179567
Govinda Pfister
Remedy Approved Consultant, Clarify Certified Consultant, ITIL-Certified
Projectcenter Business Process Solutions
Solution & Service Center Business Enabling Solutions
Global Competence Center
T-Systems Enterprise Services GmbH
Memmelsdorfer Str. 209a, 96052 Bamberg
+49 951 4097-161 (Tel)
+49 951 4097-200 (Fax)
E-Mail: Govinda.Pfister <mailto:Govinda.Pfister@t-systems.com> @t-systems.com
Internet: <http://www.t-systems.com/> http://www.t-systems.com