Re: ActivePerl + PPM on HP-UX (DBD::Informix)?

2002-12-16 Thread Jonathan Leffler
Henry McGuinness wrote:

Does anybody have experience using DBI with
Activestate's Perl for HP-UX 11? Does the PPM work in
the same way as it does for the Windows version.



Not being aware that there was an ActiveState version of Perl for any 
platform other than MS Win32, there's no way I can answer that.

Specifically, a colleague of mine wants to use
DBD::Informix, and had given up on the re-compiling
perl + module with gcc. 


You only need to recompile if you don't have the compiler that created 
Perl.  If you have the original compiler, there should be no need to 
recompile.

What was the hold-up?  There's a file (Notes/hpux-gcc-build.sh) in the 
distribution of DBD::Informix which documents what was needed to build 
GCC on HP-UX 10.20 -- it should not be much different on HP-UX 11, 
though you can find newer versions of all the utilities.

PPM would make his life a lot easier, but I've
searched activestate, google and google groups in vain
for info.


Even if there's a PPM module for DBD::Informix out there (which I 
doubt), you will still need the I-Connect or ClientSDK on the machine, 
and preferably in the same place that the PPM expects.  Frankly, I 
think it should be easier to rebuild, but I've had more practice than 
most, so maybe my views aren't representative.

--
Jonathan Leffler ([EMAIL PROTECTED], [EMAIL PROTECTED]) 
#include 
Guardian of DBD::Informix 1.04.PC1 -- http://dbi.perl.org/



Re: mysql PPM for perl 5.8

2002-12-16 Thread Ron Savage
On Mon, 16 Dec 2002 21:30:46 -0600, Moritz von Schweinitz wrote:
>hi there (again)

Hi Moritz

>i was just wondering whether there's any ppm of dbd-mysql flying
>around
>for perl 5.8 somewhere for the rest of us stuck on win32 machines

Try:

http://theoryx5.uwinnipeg.ca/ppmpackages/

--
Ron Savage, [EMAIL PROTECTED] on 17/12/2002
Deakin University, 221 Burwood Highway, Burwood, VIC 3125, Australia
Phone: +61-3-9251 7441, Fax: +61-3-9251 7604
http://www.deakin.edu.au/~rons





mysql PPM for perl 5.8

2002-12-16 Thread Moritz von Schweinitz
hi there (again)

i was just wondering whether there's any ppm of dbd-mysql flying around 
for perl 5.8 somewhere for the rest of us stuck on win32 machines w/o a 
compiler.
i'd really like to updadate to 5.8, but i just can't live without mysql 
(and Tk, for that matter).

the ppm that ilya's kind enough to provide at xmplproj.com seems to be 
broken (with 5.6 and 5.8 [why?]), so that one wont do.

anybody?

besides, why is activestate that slow updateing their ppm's? i don't 
want to sound demanding, because i'm thankful for almost anything they 
do, but is packaging ppms that hard (never done it myself)?

i hope anybody can help,

M.



Re: DBI install under win2k

2002-12-16 Thread Ron Savage
On Mon, 16 Dec 2002 16:15:29 -0500, Kevin Diffily wrote:

Hi Kevin

>I am a newbie to Perl on Windows.  I have tried to do the ppm method

Just for the record, installation help is here:

http://savage.net.au/Perl-modules.html
--
Ron Savage, [EMAIL PROTECTED] on 17/12/2002
Deakin University, 221 Burwood Highway, Burwood, VIC 3125, Australia
Phone: +61-3-9251 7441, Fax: +61-3-9251 7604
http://www.deakin.edu.au/~rons





RE: unexpected results with perl and mysql

2002-12-16 Thread Fox, Michael

>From what I can see, you just have the print in the wrong place.  Each step
of the fetch loop, as it gets the names one by one, you push to the names
array, then print the array - so you see it each step of the way. Move the
print to outside the loop

-Original Message-
From: chad kellerman [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 17, 2002 3:37 AM
To: [EMAIL PROTECTED]
Subject: unexpected results with perl and mysql


Ney guys,

I am trying to fetch and array form a table and I am not getting the
results I thought I would get:

I thought it was quote simple but when I print them outwell you'll
see?




#!/usr/bin/perl
use strict;
use warnings;

use DBI;

my( $dbname ) = "BACKUP";
my( $mysqluser ) = "bob";
my( $mysqlpasswd ) = "bobspasswd";
my( $dbh, $sth, $rc, @failedCon, $var, $name, @names );

#these variables will be passed to subroutine in main program.
my( $hostId ) = "543";
my( $biggyFlag ) = "0";
my( $hostDirFlag ) = "0";


$dbh = DBI->connect( "DBI:mysql:database=".$dbname, $mysqluser,
$mysqlpasswd ) or die "Cannot connect to database: $!";

#first check for failed attempts

$sth = $dbh->prepare( qq{ SELECT failedConAttempt FROM tblControl WHERE
hostId="$hostId" } );
$sth->execute;
$sth->bind_columns( \$var );
while  ( $sth->fetch ) {

push @failedCon, $var;

}

print "backup failed to connect to $hostId: $failedCon[0] times.\n";


#grab information

if ($failedCon[0] != 0 ) {
$sth = $dbh->prepare( q{
SELECT name FROM tblProcess
WHERE biggy_flag="$biggyFlag" AND
hostId="$hostId" AND hostDirFlag="$hostDirFlag" AND status="In-Progress"
OR status="Queued"
} );
$sth->execute;
$sth->bind_columns( \$name );
while ( $sth->fetch ) {
push @names, $name;
print "@names\n";
}
}else{
$sth = $dbh->prepare( q{
SELECT name FROM tblProcess
WHERE biggy_flag="$biggyFlag" AND
hostId="$hostId" AND hostDirFlag="$hostDirFlag" } );
$sth->execute;
$sth->bind_columns( \$name );
while ( $sth->fetchrow_array ) {
push @names, $name;
print "@names\n";
}

}

$rc = $dbh->disconnect;





when I run this I get:


[root@widowmaker sbin]# perl mysql.pl 
backup failed to connect to 543: 5 times.
alan
alan alex
alan alex bob
alan alex bob cole
alan alex bob cole brian
alan alex bob cole brian coleman
alan alex bob cole brian coleman david
alan alex bob cole brian coleman david edward
alan alex bob cole brian coleman david edward evilyn

  THe first print statemnet I get I expect, it came out right. But I
just want to print the second array.. Why does it print
alan
alan alex
alan alex bob
alan alex bob cole
alan alex bob cole brian
alan alex bob cole brian coleman
alan alex bob cole brian coleman david
alan alex bob cole brian coleman david edward
alan alex bob cole brian coleman david edward evilyn

and not just:
alan alex bob cole brian coleman david edward evilyn

am I missing something???

Thanks,
Chad








-- 
Chad Kellerman
Jr. Systems Administrator
Alabanza Inc
410-234-3305



Australia Post is committed to providing our customers with excellent service. If we 
can assist you in any way please either telephone 13 13 18 or visit our website 
www.auspost.com.au.

CAUTION

This e-mail and any files transmitted with it are privileged and confidential 
information intended for the use of the addressee. The confidentiality and/or 
privilege in this e-mail is not waived, lost or destroyed if it has been transmitted 
to you in error. If you have received this e-mail in error you must (a) not 
disseminate, copy or take any action in reliance on it; (b) please notify Australia 
Post immediately by return e-mail to the sender; and (c) please delete the original 
e-mail.



Error trying to install DBI on Solaris8

2002-12-16 Thread Pauley, Alan

I tried to install DBI-1.32 on my system running Solaris 8. I read about the
compiler problem with perl on Solaris8.
I modified my PATH so I would use SUNWspro/bin/cc to compile DBI. I recieved
the following error.
Can someone help or point me to some other docs I can read about this.

Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
  Platform:
osname=solaris, osvers=2.8, archname=sun4-solaris
uname='sunos localhost 5.8 sun4u sparc sunw,ultra-1 '
hint=previous, useposix=true, d_sigaction=define
usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
cc='cc', optimize='-xO3 -xdepend', gccversion=
cppflags=''
ccflags =''
stdchar='char', d_stdstdio=define, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
alignbytes=8, usemymalloc=n, prototype=define
  Linker and Libraries:
ld='cc', ldflags =''
libpth=/lib /usr/lib /usr/ccs/lib
libs=-lsocket -lnsl -ldl -lm -lc -lcrypt
libc=/lib/libc.so, so=so, useshrplib=true, libperl=libperl.so
  Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-R
/usr/perl5/5.00503/sun4-solaris/CORE'
cccdlflags='-KPIC', lddlflags='-G'


Characteristics of this binary (from libperl): 
  Built under solaris
  Compiled at Dec 22 1999 00:00:57
  @INC:
/usr/perl5/5.00503/sun4-solaris
/usr/perl5/5.00503
/usr/perl5/site_perl/5.005/sun4-solaris
/usr/perl5/site_perl/5.005
.
tuc-e420-01:/admin/DBI-1.32:799$perl Makefile.PL

*** Note:
The optional PlRPC-modules (RPC::PlServer etc) are not installed.
If you want to use the DBD::Proxy driver and DBI::ProxyServer
modules, then you'll need to install the RPC::PlServer, RPC::PlClient,
Storable and Net::Daemon modules. The CPAN Bundle::DBI may help you.
You can install them any time after installing the DBI.
You do *not* need these modules for typical DBI usage.

Optional modules are available from any CPAN mirror, in particular
http://www.perl.com/CPAN/modules/by-module
http://www.perl.org/CPAN/modules/by-module
ftp://ftp.funet.fi/pub/languages/perl/CPAN/modules/by-module

Creating extra DBI::PurePerl test: t/zz_01basics_pp.t 
Creating extra DBI::PurePerl test: t/zz_02dbidrv_pp.t 
Creating extra DBI::PurePerl test: t/zz_03hleak_pp.t 
Creating extra DBI::PurePerl test: t/zz_04mods_pp.t 
Creating extra DBI::PurePerl test: t/zz_05thrclone_pp.t 
Creating extra DBI::PurePerl test: t/zz_06attrs_pp.t 
Creating extra DBI::PurePerl test: t/zz_07kids_pp.t 
Creating extra DBI::PurePerl test: t/zz_10examp_pp.t 
Creating extra DBI::PurePerl test: t/zz_15array_pp.t 
Creating extra DBI::PurePerl test: t/zz_20meta_pp.t 
Creating extra DBI::PurePerl test: t/zz_30subclass_pp.t 
Creating extra DBI::PurePerl test: t/zz_40profile_pp.t 
Creating extra DBI::PurePerl test: t/zz_41prof_dump_pp.t 
Creating extra DBI::PurePerl test: t/zz_42prof_data_pp.t 
Creating extra DBI::PurePerl test: t/zz_60preparse_pp.t 
Creating extra DBI::PurePerl test: t/zz_70shell_pp.t 
Creating extra DBI::PurePerl test: t/zz_80proxy_pp.t 
Checking if your kit is complete...
Looks good
Writing Makefile for DBI

Remember to actually *read* the README file!
Use  'make' to build the software (dmake or nmake on Windows).
Then 'make test' to execute self tests.
Then 'make install' to install the DBI and then delete this working
directory before unpacking and building any DBD::* drivers.

tuc-e420-01:/admin/DBI-1.32:802$make

make: Warning: Can't find `make.rules': No such file or directory
/usr/bin/perl -I/usr/perl5/5.00503/sun4-solaris -I/usr/perl5/5.00503
-MExtUtils::Command -e mkpath blib/lib/DBI
mkdir blib
mkdir blib/lib
mkdir blib/lib/DBI
rm -f blib/lib/DBI/Changes.pm
cp Changes blib/lib/DBI/Changes.pm
mkdir blib/arch
mkdir blib/arch/auto
mkdir blib/arch/auto/DBI
mkdir blib/lib/auto
mkdir blib/lib/auto/DBI
mkdir blib/man1
mkdir blib/man3
cp lib/DBI/Profile.pm blib/lib/DBI/Profile.pm
cp Driver_xst.h blib/arch/auto/DBI/Driver_xst.h
cp lib/DBI/W32ODBC.pm blib/lib/DBI/W32ODBC.pm
cp lib/DBD/ExampleP.pm blib/lib/DBD/ExampleP.pm
cp lib/DBI/FAQ.pm blib/lib/DBI/FAQ.pm
cp lib/DBI/Shell.pm blib/lib/DBI/Shell.pm
cp lib/DBI/ProxyServer.pm blib/lib/DBI/ProxyServer.pm
cp lib/Bundle/DBI.pm blib/lib/Bundle/DBI.pm
cp lib/DBI/Const/GetInfo/ANSI.pm blib/lib/DBI/Const/GetInfo/ANSI.pm
cp lib/DBD/Proxy.pm blib/lib/DBD/Proxy.pm
cp lib/DBI/ProfileDumper.pm blib/lib/DBI/ProfileDumper.pm
cp DBIXS.h blib/arch/auto/DBI/DBIXS.h
cp lib/DBI/Const/GetInfoReturn.pm blib/lib/DBI/Const/GetInfoReturn.pm
cp dbd_xsh.h blib/arch/auto/DBI/dbd_xsh.h
cp lib/DBI/Const/GetInfoType.pm blib/lib/DBI/Const/GetInfoType.pm
cp dbi_sql.h blib/arch/auto/DBI/dbi_sql.h
cp lib/DBD/NullP.pm blib/lib/DBD/NullP.pm
cp lib/DBD/Sponge.pm blib/lib/DBD/Sponge.pm
cp lib/DBI/Format.pm blib/lib/DBI/Format.pm
cp lib/DBI/Const/GetInfo/ODBC.pm blib/lib/DBI/Const/GetInfo/ODBC.pm
cp lib/DBI/DBD.pm blib/lib/DB

Re: ORA 3113 EOF on channel w/ DBD-1.12, Oracle 9i, Redhat 7.3

2002-12-16 Thread Stephen Clouse
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Mon, Dec 16, 2002 at 03:43:29PM -0800, Kimball, Conrad wrote:
> my perl script pauses for 5 seconds or so and then I get this error:
> 
> ORA-03113: end-of-file on communication channel (DBD ERROR:
> OCIStmtExecute)

Check Oracle's alert log, you'll likely find an ORA-600 that you'll need to
handle with Oracle support.  ORA-3113 is Oracle's generic "I screwed up" client
error, and it usually goes along with a crash or segfault on the server side.

- -- 
Stephen Clouse <[EMAIL PROTECTED]>
Senior Programmer, IQ Coordinator Project Lead
The IQ Group, Inc. 
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.0.7 (GNU/Linux)

iD8DBQE9/md3A4aoazQ9p2cRAimEAKDPtH3kNtwJrAhu91Z2eOxd9Pux3QCfYfOc
hVsf641QT+2OOx8FPviswCA=
=VA4r
-END PGP SIGNATURE-



ORA 3113 EOF on channel w/ DBD-1.12, Oracle 9i, Redhat 7.3

2002-12-16 Thread Kimball, Conrad
Hello.  I'm a newbie with respect to Oracle and DBI/DBD, so please bear with
me...

I'm trying to use DBD::Oracle to retrieve info from a read-only database.  I
am successful on an HP-UX 11.0 machine when using the Oracle 8i sqlplus
command and when using perl 5.6.1 / DBI-1.20 / DBD::Oracle-1.06 (built by
somebody else).  But I wish to run my work on a Redhat 7.3 Linux system,
which already has perl 5.6.1 and DBI-1.21 installed.  So I installed Oracle
9i, then built and installed DBD::Oracle-1.12.

On the Redhat 7.3 system I am successful when using the Oracle 9i sqlplus
command, but when I use the DBD::Oracle that I built I run into problems.
The connect seems to succeed, but I get ORA-03113 errors on virtually all of
the SELECT statements I try.  I can successfully execute this statement:

SELECT column_name, char_col_decl_length FROM all_tab_columns WHERE
table_name = 'BLDG_BUILDINGS'

But when I try to SELECT something out of the BLDG_BUILDINGS view (or for
that matter, seemingly any SELECT that retrieves from a real table or view):

SELECT * FROM bldg_buildings WHERE short_bldg = '33-12'

my perl script pauses for 5 seconds or so and then I get this error:

ORA-03113: end-of-file on communication channel (DBD ERROR:
OCIStmtExecute)

The perl script is identical in both cases - works on the HP-UX 11 system
but not on the Redhat 7.3 system.

I spent a couple of hours searching the web and the archives of this list to
no avail.  Any advice?

Thanks,

Conrad Kimball
Associate Technical Fellow
Client Server Technical Management, Shared Services Group
[EMAIL PROTECTED]
P.O.Box 24346, MS 7M-HC
Seattle, WA  98124-0346
Bellevue 33-12 bldg, cube 37C3
Phone: (425) 865-6410
Pager:  (206) 797-3112
Cell:  (425) 591-7802




Patch for DBD::ODBC 1.01 for using Informix CLI, etc.

2002-12-16 Thread Jonathan Leffler
Dear Jeff and Tim,

Here's a patch which more or less got DBD::ODBC 1.01 up and running
using Informix CLI as the ODBC driver (and driver manager) on Solaris.

What did I have to fix?

First of all, for some reason I don't understand fully, my system was
initially diagnosed as being a udbc system.  So, I had to hack
Makefile.PL to avoid that mis-diagnosis.  In doing so, I cleaned up the
testing for other drivers and made it all more consistent.  Then I added
a test which heads off trouble when no valid ODBC system is detected.
There's now a list of the ODBC drivers which are supported; this is
printed when no valid system is detected.

Then I had to fiddle the definitions for use with Informix CLI, which
was no worse than any other driver.  I made sure that the detailed
version and platform information for Informix is in the file.  It will
gently get out of date, but can be brought up to date again as
necessary.  It at least tells people where it was originally thought to
work.

I'm using a butchered DBI 1.32 that is masquerading as 1.33, and it
showed up a couple of minor problems in dbdimp.h -- no #define for
dbd_discon_all and a stray #define for dbd_db_do.  Tim may yet decide
those changes are too radical for DBI 1.33, but this change will allow
your driver to work with both existing DBI versions and the future
version where all the functions in Driver.xst are guarded with #ifdef's.
Note that DBI 1.32 and earlier does not ever call dbd_db_do.

I modified one (of three) calls to SQLDescribeCols() so that GCC didn't
witter at me about incompatible pointer types.  I used an effective but
crude technique; I declared a local variable of the correct type and
passed that to the function, and then assigned the variable to the
original source of trouble.  It was the ColumnSize parameter (7), which
was being given a U32 pointer but the ODBC specs say it should be an
SQLUINTEGER pointer.

I ran into a problem with t/02simple.t; there was no newline at the end
of the output from test 9, so the 'not ok 9' was getting lost.  That was
easy to fix.  With that fix in place, I was getting two test failures,
numbers 6 and 9 in t/02simple.t.  I wondered if it was my slightly
unusual setting of the (Informix-specific) DBDATE variable that was
throwing things for a wobbly, but it does not appear to be that.  I'm
not sure how much time to spend debugging that - get back to me on it.
The verbose output from the test that is failing (with the extra newline
in place) is in the second attachment.

I wrote README.informix with much of the same information in it.  Feel
free to remove the first paragraph if you accept the patches I'm
sending.  Amongst other things, it documents that DBD::ODBC does not
manage to handle Informix's non-transactional databases -- I got many
more failures until I used a logged database.

I also hacked the README (carefully preserving the DOS line endings) to
update the rather archaic URLs and instructions for joining the mailing
lists.

With luck, I can now generate a GetInfo module for DBD::Informix!

-- 
Jonathan Leffler   #include 
STSM, Informix Database Engineering, IBM Data Management
Phone: +1 650-926-6921   Fax: +1 650-926-6971   Tie-line: 630-6921
Email: [EMAIL PROTECTED]
Guardian of DBD::Informix v1.04.PC1 -- http://dbi.perl.org
--- dbdimp.h.old2002-12-07 23:10:41.0 -0800
+++ dbdimp.h2002-12-16 14:40:25.051675000 -0800
@@ -147,9 +147,11 @@
 /* These defines avoid name clashes for multiple statically linked DBD's*/
 
 #define dbd_init   odbc_init
+#define dbd_discon_all odbc_dr_disconnect_all
+
 #define dbd_db_login   odbc_db_login
 #define dbd_db_login6  odbc_db_login6
-#define dbd_db_do  odbc_db_do
+/*#define dbd_db_doodbc_db_do*/
 #define dbd_db_commit  odbc_db_commit
 #define dbd_db_rollbackodbc_db_rollback
 #define dbd_db_disconnect  odbc_db_disconnect
--- dbdimp.c.old2002-12-08 20:01:06.0 -0800
+++ dbdimp.c2002-12-16 14:45:23.197921000 -0800
@@ -3635,14 +3635,16 @@
 I16 *Nullable;
 {
 D_imp_sth(sth);
+   SQLUINTEGER ColSize;
 RETCODE rc;
 rc = SQLDescribeCol(imp_sth->hstmt, colno,
ColumnName, BufferLength, NameLength,
-   DataType, ColumnSize, DecimalDigits, Nullable);
+   DataType, &ColSize, DecimalDigits, Nullable);
 if (!SQL_ok(rc)) {
dbd_error(sth, rc, "DescribeCol/SQLDescribeCol");
return 0;
 }
+   *ColumnSize = ColSize;
 return 1;
 }
 
--- Makefile.PL.old 2002-12-10 06:11:30.0 -0800
+++ Makefile.PL 2002-12-16 14:40:16.782601000 -0800
@@ -16,7 +16,7 @@
 use DBI::DBD;
 use strict;
 
-my %opts = 
+my %opts =
 (
 NAME   => 'DBD::ODBC',
 VERSION_FROM => 'ODBC.pm',
@@ -109,7 +109,7 @@
 
 # cygwin patch
 $opts{INC}  .= " -I/usr/include/w32api" if $^O 

Re: DBI::Proxy configuration help

2002-12-16 Thread Hardy Merrill
Kevin Diffily [[EMAIL PROTECTED]] wrote:
> Can anyone elaborate on the specifics of how to do this?

I can't be much more help now than I was almost a year ago
when I wrote that message, since I haven't used dbiproxy
since then, but the one thing that comes to mind is that the
"Programming the Perl DBI" book does contain a good explanation
of how to setup and use dbiproxy.

When we set it up at my previous company(probably over 3 years
ago now when we set that up), we didn't have the book to go by,
and we got it working.  As I remember, the perldocs are very
helpful.

-- 
Hardy Merrill
Senior Software Engineer
Red Hat, Inc.

> 
> Thanks,
> Kevin
> 
> 
> On 1/14/02 5:34 PM, "Hardy Merrill" <[EMAIL PROTECTED]>
> wrote:
> 
> > If I remember right, to use DBI Proxy you'll need to
> > install Bundle::DBI - it contains the RPC::P1Server.pm and
> > everything else that's necessary.  I haven't used this in
> > quite a while - can enyone else chime in and confirm this?
> > 
> > We have DBI 1.20 installed, and here's what
> > 
> > perldoc DBI
> > 
> > says about Proxy:
> > 
> > Remote Proxy DBD support
> >  As of DBI 1.02, a complete implementation of a
> >  DBD::Proxy driver and the DBI::ProxyServer are part of
> >  the DBI distribution.
> > 
> > There are also perldocs for "DBD::Proxy" that might help.
> > 
> > HTH.
> 
> -- 
> Kevin Diffily
> InterNetWorkingSolutions
> Enterprise Class Solutions for All Enterprises
> 
> 46 Webster Street, Apt 2 Barre, VT 05641 USA
> VOICE: 1.866.inetwsnet (Toll Free)
> FAX:   1.888.726.9030   (Toll Free)
> 
> Sales: 
> [EMAIL PROTECTED]
> General Information:[EMAIL PROTECTED]
> Website Hosting:[EMAIL PROTECTED]
> Systems Administration Services:   [EMAIL PROTECTED]
> Technical Support & Training Services:  [EMAIL PROTECTED]
> Shop For it On Amazon:
> http://kevin.inetws.net/amazon
> AIM, Jabber, MSN, Yahoo:inetwsnet
> GPG Key:5AF85391 at
> wwwkeys.us.pgp.net



RE: Connection troubles on HP-UX

2002-12-16 Thread LBaxter
I assume therefore the tnsping does not work.  Talk to your DBA/system
admins.  

Perl DBI can not possibly work if the underlying database does not work.

Lincoln


-Original Message-
From: Powell, Bruce [mailto:[EMAIL PROTECTED]] 
Sent: Monday, December 16, 2002 3:05 PM
To: '[EMAIL PROTECTED]'
Subject: Connection troubles on HP-UX

I am using dbi to connect to an Oracle database on a HP-UX (HP-UX 11.0)
database.  When I attempt to connect to the database I receive the following
error:

DBI->connect(prd1) failed: ORA-12154: TNS: could not resolve service name
(DBD Error: OCIServerAttach) at ./tryDBI.pl

This happens when we use a service name as the connect string.  But is we
fully qualify the connect string we get a connection.  The problem comes
about in an application we use, it does not like the fully qualified connect
string.

Can some one help me out here?

-Bruce
 
 
 
___
CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is 
for the sole use of the intended recipient(s) and may contain confidential 
and privileged information.  Any unauthorized review, use, disclosure or 
distribution is prohibited.  If you are not the intended recipient, please 
contact the sender by reply e-mail and destroy all copies of the original 
message.



Re: How to Install dbiproxy on WIN2000

2002-12-16 Thread Kevin Diffily
Unfortunately ppm cannot find plrpc.

On 6/27/02 12:36 AM, "Thomas A. Lowery" <[EMAIL PROTECTED]> wrote:

> Roger,
> The simplest method is to use ActiveStates PPM or PPM3.  Install
> DBI, Net-Daemon, and PlRPC (use the query/search feature to
> confirm the names).
> 
> c:>ppm
> ppm>install DBI ...
> It's rather easy.
> 
> On Thu, Jun 27, 2002 at 04:53:02AM -0400, Roger Patrick wrote:
>> How do I install dbiproxy on Win2000. I'm running Activate State
>> Perl and I'm not familiar with the Activate State environment on
>> Windows; I'm more of a perl -MCPAN -e 'install something' type
>> person. Please advise.
> 
> Tom

-- 
Kevin Diffily
InterNetWorkingSolutions
Enterprise Class Solutions for All Enterprises

46 Webster Street, Apt 2 Barre, VT 05641 USA
VOICE: 1.866.inetwsnet (Toll Free)
FAX:   1.888.726.9030   (Toll Free)

Sales: 
[EMAIL PROTECTED]
General Information:[EMAIL PROTECTED]
Website Hosting:[EMAIL PROTECTED]
Systems Administration Services:   [EMAIL PROTECTED]
Technical Support & Training Services:  [EMAIL PROTECTED]
Shop For it On Amazon:
http://kevin.inetws.net/amazon
AIM, Jabber, MSN, Yahoo:inetwsnet
GPG Key:5AF85391 at
wwwkeys.us.pgp.net







Re: DBI::Proxy configuration help

2002-12-16 Thread Kevin Diffily
Can anyone elaborate on the specifics of how to do this?

Thanks,
Kevin


On 1/14/02 5:34 PM, "Hardy Merrill" <[EMAIL PROTECTED]>
wrote:

> If I remember right, to use DBI Proxy you'll need to
> install Bundle::DBI - it contains the RPC::P1Server.pm and
> everything else that's necessary.  I haven't used this in
> quite a while - can enyone else chime in and confirm this?
> 
> We have DBI 1.20 installed, and here's what
> 
> perldoc DBI
> 
> says about Proxy:
> 
> Remote Proxy DBD support
>  As of DBI 1.02, a complete implementation of a
>  DBD::Proxy driver and the DBI::ProxyServer are part of
>  the DBI distribution.
> 
> There are also perldocs for "DBD::Proxy" that might help.
> 
> HTH.

-- 
Kevin Diffily
InterNetWorkingSolutions
Enterprise Class Solutions for All Enterprises

46 Webster Street, Apt 2 Barre, VT 05641 USA
VOICE: 1.866.inetwsnet (Toll Free)
FAX:   1.888.726.9030   (Toll Free)

Sales: 
[EMAIL PROTECTED]
General Information:[EMAIL PROTECTED]
Website Hosting:[EMAIL PROTECTED]
Systems Administration Services:   [EMAIL PROTECTED]
Technical Support & Training Services:  [EMAIL PROTECTED]
Shop For it On Amazon:
http://kevin.inetws.net/amazon
AIM, Jabber, MSN, Yahoo:inetwsnet
GPG Key:5AF85391 at
wwwkeys.us.pgp.net







Re: DBD::Pg Authentication

2002-12-16 Thread Jason E. Stewart
"Roderick A. Anderson" <[EMAIL PROTECTED]> writes:

> I can't seem to find it in the Cheetah book and it isn't mentioned in The
> man page so I ask.  Does the DBD understand the different types of
> authentication that PostgreSQL can do?  IE, if I've sent up my database to
> allow access using md5 password authentication will DBI/DBD do the
> negotiations etc. so I only have to enter the plain-text password in my
> program?  I've typically used trust because the program ran on the same 
> system as the database but now have a need to access from remote systems 
> and want to, at least, obfuscate the login.

When you use DBI->connect(), you must pass in a username and a
password.

jas.



Re: DBI install under win2k

2002-12-16 Thread Kevin Diffily
I am a newbie to Perl on Windows.  I have tried to do the ppm method but
cannot run dbiproxy due to a module not being installed with that method.

Could anyone be so kind as to explain how to compile modules on Windows or
better yet how to run the cpan utility on Windows?

Thanks,
Kevin


On 12/3/02 5:31 AM, "Kris Wolff" <[EMAIL PROTECTED]> wrote:

> But some modules they are always on cpan or privat sites and not as ppm
> thingavailabl. So lern to work with nmake and you will never had any
> problems on an other system like unix, too.
> 
> 
> On 03.12.2002 11:07 Uhr, "Timothy Johnson" <[EMAIL PROTECTED]> wrote:
> 
>> 
>> I would go with the PPM approach unless you are really familiar with nmake.
>> 
>> C:\> PPM
>> PPM> install DBI
>> Install package DBI (y/n)? y
>> 
>> However, this should already be included in the default distribution if I'm
>> not mistaken.  If you're not using ActiveState's ActivePerl, then I suggest
>> you go download it, because it really does work the best with NT/2000/XP,
>> and they have some decent support tools as well.
>> 
>> -Original Message-
>> From: Kris Wolff [mailto:[EMAIL PROTECTED]]
>> Sent: Tuesday, December 03, 2002 12:48 AM
>> To: Julien Perriard; DBI mailing
>> Subject: Re: DBI install under win2k
>> 
>> 
>> On 03.12.2002 9:27 Uhr, "Julien Perriard" <[EMAIL PROTECTED]> wrote:
>> 
>>> Hi !
>>> 
>>> How may I install DBI under windows 2000 ?
>>> 
>>> 
>>> Thank a lot !
>>> 
>>> 
>>> Julien
>> 
>> I used the way over nmake. Woks fine if nmake works ( I remember I need a
>> few ours to find the right nmake but than --just grate with all kind of
>> modules. )
>> I prefere nmake !!!
>> But there is an easy way: using ppm from activestate !
> 

-- 
Kevin Diffily
InterNetWorkingSolutions
Enterprise Class Solutions for All Enterprises

46 Webster Street, Apt 2 Barre, VT 05641 USA
VOICE: 1.866.inetwsnet (Toll Free)
FAX:   1.888.726.9030   (Toll Free)

Sales: 
[EMAIL PROTECTED]
General Information:[EMAIL PROTECTED]
Website Hosting:[EMAIL PROTECTED]
Systems Administration Services:   [EMAIL PROTECTED]
Technical Support & Training Services:  [EMAIL PROTECTED]
Shop For it On Amazon:
http://kevin.inetws.net/amazon
AIM, Jabber, MSN, Yahoo:inetwsnet
GPG Key:5AF85391 at
wwwkeys.us.pgp.net







Problem testing DBI

2002-12-16 Thread Daniel Olson
Has anyone build the newest DBI (1.32) on Perl 5.00503? I'm putting it on a
Sun Solaris 8 box, and it makes fine, but fails 2 tests. The main error I get
is this:

t/10examp...Insecure dependency in parameter 1 of 
DBI::st=HASH(0x19dd70)->FETCH method call while running with -T switch at t/10examp.t 
line 320.
DBI handle cleared whilst still active.
dbih_clearcom (sth 0x1c24b8 0xd88a0, com 0x1c4208, imp DBD::ExampleP::st):
   FLAGS 0x60011: COMSET Warn TaintIn TaintOut 
   PARENT DBI::db=HASH(0x19cb5c)
   KIDS 0 (0 Active)
   IMP_DATA ARRAY(0x1c265c)
   NUM_OF_FIELDS 3
   NUM_OF_PARAMS 1
dubious
Test returned status 20 (wstat 5120, 0x1400)
DIED. FAILED tests 104-245
Failed 142/245 tests, 42.04% okay

I'm really not sure what that means. I read the message today about DBI not
supporting 5.005 in the not-too-distant future. Have we arrived there
already?

The only other odd thing during install is that I needed to tweak the Makefile
a bit, making four substitutions:
CC = gcc  for CC = cc
CCCDLFLAGS =  for CCCDLFLAGS = -KPIC
LD = ld   for LD = cc
OPTIMIZE =for OPTIMIZE = =x03 -xdepend
I've installed several other modules using these same mods, and there hasn't
been a problem up to this point.

Support traces follow. Any help would be appreciated.

Dan Olson
Oregon Health & Science University

OUTPUT OF perl -V:
Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
  Platform:
osname=solaris, osvers=2.8, archname=sun4-solaris
uname='sunos localhost 5.8 sun4u sparc sunw,ultra-1 '
hint=previous, useposix=true, d_sigaction=define
usethreads=undef useperlio=undef d_sfio=undef
  Compiler:
cc='cc', optimize='-xO3 -xdepend', gccversion=
cppflags=''
ccflags =''
stdchar='char', d_stdstdio=define, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
alignbytes=8, usemymalloc=n, prototype=define
  Linker and Libraries:
ld='cc', ldflags =''
libpth=/lib /usr/lib /usr/ccs/lib
libs=-lsocket -lnsl -ldl -lm -lc -lcrypt
libc=/lib/libc.so, so=so, useshrplib=true, libperl=libperl.so
  Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags='-R 
/usr/perl5/5.00503/sun4-solaris/CORE'
cccdlflags='-KPIC', lddlflags='-G'


Characteristics of this binary (from libperl): 
  Built under solaris
  Compiled at Dec 22 1999 00:00:57
  @INC:
/usr/perl5/5.00503/sun4-solaris
/usr/perl5/5.00503
/usr/perl5/site_perl/5.005/sun4-solaris
/usr/perl5/site_perl/5.005
.


BUILD TRACE INCLUDING RETEST USING TEST_VERBOSE:
> perl Makefile.PL
*** Note:
The optional PlRPC-modules (RPC::PlServer etc) are not installed.
If you want to use the DBD::Proxy driver and DBI::ProxyServer
modules, then you'll need to install the RPC::PlServer, RPC::PlClient,
Storable and Net::Daemon modules. The CPAN Bundle::DBI may help you.
You can install them any time after installing the DBI.
You do *not* need these modules for typical DBI usage.

Optional modules are available from any CPAN mirror, in particular
http://www.perl.com/CPAN/modules/by-module
http://www.perl.org/CPAN/modules/by-module
ftp://ftp.funet.fi/pub/languages/perl/CPAN/modules/by-module

Creating extra DBI::PurePerl test: t/zz_01basics_pp.t 
Creating extra DBI::PurePerl test: t/zz_02dbidrv_pp.t 
Creating extra DBI::PurePerl test: t/zz_03hleak_pp.t 
Creating extra DBI::PurePerl test: t/zz_04mods_pp.t 
Creating extra DBI::PurePerl test: t/zz_05thrclone_pp.t 
Creating extra DBI::PurePerl test: t/zz_06attrs_pp.t 
Creating extra DBI::PurePerl test: t/zz_07kids_pp.t 
Creating extra DBI::PurePerl test: t/zz_10examp_pp.t 
Creating extra DBI::PurePerl test: t/zz_15array_pp.t 
Creating extra DBI::PurePerl test: t/zz_20meta_pp.t 
Creating extra DBI::PurePerl test: t/zz_30subclass_pp.t 
Creating extra DBI::PurePerl test: t/zz_40profile_pp.t 
Creating extra DBI::PurePerl test: t/zz_41prof_dump_pp.t 
Creating extra DBI::PurePerl test: t/zz_42prof_data_pp.t 
Creating extra DBI::PurePerl test: t/zz_60preparse_pp.t 
Creating extra DBI::PurePerl test: t/zz_70shell_pp.t 
Creating extra DBI::PurePerl test: t/zz_80proxy_pp.t 
Checking if your kit is complete...
Looks good
Writing Makefile for DBI

Remember to actually *read* the README file!
Use  'make' to build the software (dmake or nmake on Windows).
Then 'make test' to execute self tests.
Then 'make install' to install the DBI and then delete this working
directory before unpacking and building any DBD::* drivers.

> make
/bin/perl -I/usr/perl5/5.00503/sun4-solaris -I/usr/perl5/5.00503 -MExtUtils::Command 
-e mkpath blib/lib/DBI
mkdir blib
mkdir blib/lib
mkdir blib/lib/DBI
rm -f blib/lib/DBI/Changes.pm
cp Changes blib/lib/DBI/Changes.pm
mkdir blib/arch
mkdir blib/arch/auto
mkdir blib/arch/auto/DBI
mkdir blib/lib/auto
mkdir blib/lib/auto/DBI
mkdir blib/man1
mkdir bli

Connection troubles on HP-UX

2002-12-16 Thread Powell, Bruce
I am using dbi to connect to an Oracle database on a HP-UX (HP-UX 11.0)
database.  When I attempt to connect to the database I receive the following
error:

DBI->connect(prd1) failed: ORA-12154: TNS: could not resolve service name
(DBD Error: OCIServerAttach) at ./tryDBI.pl

This happens when we use a service name as the connect string.  But is we
fully qualify the connect string we get a connection.  The problem comes
about in an application we use, it does not like the fully qualified connect
string.

Can some one help me out here?

-Bruce
 
 
 
___
CONFIDENTIALITY NOTICE: This e-mail message, including any attachments, is 
for the sole use of the intended recipient(s) and may contain confidential 
and privileged information.  Any unauthorized review, use, disclosure or 
distribution is prohibited.  If you are not the intended recipient, please 
contact the sender by reply e-mail and destroy all copies of the original 
message.



RE: DBD on HPUX

2002-12-16 Thread Brian D. Silverio
The answer to the problem was supplied by Lincoln Baxter.
His suggestion was to use the 64bit Oracle client.  

THANK YOU VERY MUCH Lincoln!  It is really appreciated.

And thank you to all who tried to help.

So for the record, the DBD does not work on HPUX with the 64bit OS and
the 32bit Oracle client.  I expect someone else will be running into
this.

And thanks to all who tried to help out with suggestions on what I could
try.

Brian

> -Original Message-
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, December 12, 2002 4:44 PM
> To: [EMAIL PROTECTED]
> Subject: RE: DBD on HPUX
> 
> Here is a makefile the builds a working DBD-Oracle on:
> 
>   $ uname -a
>   HP-UX hostname B.11.11 U 9000/800 612309363 unlimited-user
license
>   $
> 
> Using the /opt/softbench compiler.
> 
> 
> AH... I think I see what might be a problem... have you thought about
asking
> your DBA's to put up atleast the binaries for the 64 bit oracle.
> 
> You can still run your databases in the 32 bit version if you insist,
but
> connect with perl through the 64bit client.
> 
> Lincoln
> 
> 
> -Original Message-
> From: Brian D. Silverio [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, December 12, 2002 4:35 PM
> To: [EMAIL PROTECTED]
> Subject: DBD on HPUX
> 
> Greetings,
> I have spent about two weeks going over the archives and reading
> everything I can find out the DBD on hpux.  I still can't get it to
work
> 
> Short form:
> HPUX 11.11 64 bit
> Oracle 8.1.7 32 bit
> HP extra cost compiler
> Perl 5.8.0 and 5.6.1 used
> DBI 1.18, 1,25 and 1.30 all tried
> DBD 1.07 and 1.12 tried.
> Non threading, -lcl and lpthreads added,  +z added,
> +Z also tried alone and in combo with +z
> perl Makefile.PL -l tried
> 
> Can not shl_load()etc
> 
> Static builds also tried they will not link properly
> used the symbol finder script to find the missing symbols, add the
> libraries and they are still not found.
> 
> At this point I have tried each and every thing I can find on google.
I
> still can't make it work.
> 
> Can anyone offer additional suggestions?
> 
> I am new to HPUX but have been working with unix since 1985.
> 
> Thanks
> Brian





Maintaining database session in a web application

2002-12-16 Thread G S
Hi.  First time poster here. I am using DBI in a web application.  The web 
application consists of several perl scripts.  Once a user signs on, I would 
like to use that database handle in subsequent perl scripts.  So the first 
script signs the user on with something like:

my($fulldsn) = 'DBI:Sybase:' . $ENV{'DBI_DSN'};
my $dbh = DBI->connect($fulldsn, "$username", "$password");


Then, the user can run various perl scripts that interact with the database. 
What is a good way to pass the database handle ("$dbh" in my example) to 
those scripts in a web application?  Can anyone point me in the right 
direction? Thanks.






_
STOP MORE SPAM with the new MSN 8 and get 2 months FREE* 
http://join.msn.com/?page=features/junkmail



Re: Creating database triggers w/perl

2002-12-16 Thread Waldemar Zurowski
W liście z pon, 16-12-2002, godz. 10:32, Brien Pirkle pisze: 


> my $st_create_trigger = $dbh->do(qq{
> });

Are there any reasons, you are using 'qq' instead of 'q'?
BTW - escaping can be done using '\' (backslash) character, as qq(some
string) is equivalent to "some string".

Waldemar




Re: unexpected results with perl and mysql

2002-12-16 Thread Tim Bunce
Use trace! (see the docs)

Tim.

On Mon, Dec 16, 2002 at 11:37:18AM -0500, chad kellerman wrote:
> Ney guys,
> 
> I am trying to fetch and array form a table and I am not getting the
> results I thought I would get:
> 
> I thought it was quote simple but when I print them outwell you'll
> see?
> 
> 
> 
> 
> #!/usr/bin/perl
> use strict;
> use warnings;
> 
> use DBI;
> 
> my( $dbname ) = "BACKUP";
> my( $mysqluser ) = "bob";
> my( $mysqlpasswd ) = "bobspasswd";
> my( $dbh, $sth, $rc, @failedCon, $var, $name, @names );
> 
> #these variables will be passed to subroutine in main program.
> my( $hostId ) = "543";
> my( $biggyFlag ) = "0";
> my( $hostDirFlag ) = "0";
> 
> 
> $dbh = DBI->connect( "DBI:mysql:database=".$dbname, $mysqluser,
> $mysqlpasswd ) or die "Cannot connect to database: $!";
> 
> #first check for failed attempts
> 
> $sth = $dbh->prepare( qq{ SELECT failedConAttempt FROM tblControl WHERE
> hostId="$hostId" } );
> $sth->execute;
> $sth->bind_columns( \$var );
> while  ( $sth->fetch ) {
> 
> push @failedCon, $var;
> 
> }
> 
> print "backup failed to connect to $hostId: $failedCon[0] times.\n";
> 
> 
> #grab information
> 
> if ($failedCon[0] != 0 ) {
> $sth = $dbh->prepare( q{
> SELECT name FROM tblProcess
> WHERE biggy_flag="$biggyFlag" AND
> hostId="$hostId" AND hostDirFlag="$hostDirFlag" AND status="In-Progress"
> OR status="Queued"
> } );
> $sth->execute;
> $sth->bind_columns( \$name );
> while ( $sth->fetch ) {
> push @names, $name;
> print "@names\n";
> }
> }else{
> $sth = $dbh->prepare( q{
> SELECT name FROM tblProcess
> WHERE biggy_flag="$biggyFlag" AND
> hostId="$hostId" AND hostDirFlag="$hostDirFlag" } );
> $sth->execute;
> $sth->bind_columns( \$name );
> while ( $sth->fetchrow_array ) {
> push @names, $name;
> print "@names\n";
> }
> 
> }
> 
> $rc = $dbh->disconnect;
> 
> 
> 
> 
> 
> when I run this I get:
> 
> 
> [root@widowmaker sbin]# perl mysql.pl 
> backup failed to connect to 543: 5 times.
> alan
> alan alex
> alan alex bob
> alan alex bob cole
> alan alex bob cole brian
> alan alex bob cole brian coleman
> alan alex bob cole brian coleman david
> alan alex bob cole brian coleman david edward
> alan alex bob cole brian coleman david edward evilyn
> 
>   THe first print statemnet I get I expect, it came out right. But I
> just want to print the second array.. Why does it print
> alan
> alan alex
> alan alex bob
> alan alex bob cole
> alan alex bob cole brian
> alan alex bob cole brian coleman
> alan alex bob cole brian coleman david
> alan alex bob cole brian coleman david edward
> alan alex bob cole brian coleman david edward evilyn
> 
> and not just:
> alan alex bob cole brian coleman david edward evilyn
> 
> am I missing something???
> 
> Thanks,
> Chad
> 
> 
> 
> 
> 
> 
> 
> 
> -- 
> Chad Kellerman
> Jr. Systems Administrator
> Alabanza Inc
> 410-234-3305





Re: unexpected results with perl and mysql

2002-12-16 Thread Hardy Merrill
I'm not sure I understand the problem, but I think(?) I see
one problem - see below.

Another thing I noticed was you are using the same "$sth"
statement handle for each prepare/execute/fetch you are
doing.  As long as each fetch fetches *ALL* the rows, I
don't think that's a problem, but a safer approach is to
either "finish" the statement handle before you use it
again, or name your statement handles differently.

Also, not sure if you know about this and chose not to use
them, but "placeholders" will save you LOTS of time and
aggrevation with proper quoting, not to mention the performance
improvements they give in certain situations.

One more thing - it doesn't look to me like you are error
checking any of your DBI statements.  Read the excellent
DBI perldocs by doing

  perldoc DBI

at a command prompt and read about using RaiseError and
"eval" to error check DBI statements.  Also read about
using "placeholders".

HTH.

-- 
Hardy Merrill
Senior Software Engineer
Red Hat, Inc.

chad kellerman [[EMAIL PROTECTED]] wrote:
> Ney guys,
> 
> I am trying to fetch and array form a table and I am not getting the
> results I thought I would get:
> 
> I thought it was quote simple but when I print them outwell you'll
> see?
> 
> 
> 
> 
> #!/usr/bin/perl
> use strict;
> use warnings;
> 
> use DBI;
> 
> my( $dbname ) = "BACKUP";
> my( $mysqluser ) = "bob";
> my( $mysqlpasswd ) = "bobspasswd";
> my( $dbh, $sth, $rc, @failedCon, $var, $name, @names );
> 
> #these variables will be passed to subroutine in main program.
> my( $hostId ) = "543";
> my( $biggyFlag ) = "0";
> my( $hostDirFlag ) = "0";
> 
> 
> $dbh = DBI->connect( "DBI:mysql:database=".$dbname, $mysqluser,
> $mysqlpasswd ) or die "Cannot connect to database: $!";
> 
> #first check for failed attempts
> 
> $sth = $dbh->prepare( qq{ SELECT failedConAttempt FROM tblControl WHERE
> hostId="$hostId" } );
> $sth->execute;
> $sth->bind_columns( \$var );
> while  ( $sth->fetch ) {
> 
> push @failedCon, $var;
> 
> }
> 
> print "backup failed to connect to $hostId: $failedCon[0] times.\n";
> 
> 
> #grab information
> 
> if ($failedCon[0] != 0 ) {
> $sth = $dbh->prepare( q{
^^

This will prevent the "$" variables within this string from
being interpolated - I don't think that's what you want.  You
should use "qq" here.

> SELECT name FROM tblProcess
> WHERE biggy_flag="$biggyFlag" AND
> hostId="$hostId" AND hostDirFlag="$hostDirFlag" AND status="In-Progress"
> OR status="Queued"
> } );
> $sth->execute;
> $sth->bind_columns( \$name );
> while ( $sth->fetch ) {
> push @names, $name;
> print "@names\n";
> }
> }else{
> $sth = $dbh->prepare( q{
> SELECT name FROM tblProcess
> WHERE biggy_flag="$biggyFlag" AND
> hostId="$hostId" AND hostDirFlag="$hostDirFlag" } );
> $sth->execute;
> $sth->bind_columns( \$name );
> while ( $sth->fetchrow_array ) {
> push @names, $name;
> print "@names\n";
  ^

For each fetch, you are 'push'ing the $name onto the @names
array, *AND* you are also printing the whole @names array.

You are doing this in this loop and the previous one.  Don't
you want to do this instead:

 while ( $sth->fetchrow_array ) {
 push @names, $name;
 }
 print "@names\n";

???

> }
> 
> }
> 
> $rc = $dbh->disconnect;
> 
> 
> 
> 
> 
> when I run this I get:
> 
> 
> [root@widowmaker sbin]# perl mysql.pl 
> backup failed to connect to 543: 5 times.
> alan
> alan alex
> alan alex bob
> alan alex bob cole
> alan alex bob cole brian
> alan alex bob cole brian coleman
> alan alex bob cole brian coleman david
> alan alex bob cole brian coleman david edward
> alan alex bob cole brian coleman david edward evilyn
> 
>   THe first print statemnet I get I expect, it came out right. But I
> just want to print the second array.. Why does it print
> alan
> alan alex
> alan alex bob
> alan alex bob cole
> alan alex bob cole brian
> alan alex bob cole brian coleman
> alan alex bob cole brian coleman david
> alan alex bob cole brian coleman david edward
> alan alex bob cole brian coleman david edward evilyn
> 
> and not just:
> alan alex bob cole brian coleman david edward evilyn
> 
> am I missing something???
> 
> Thanks,
> Chad
> 
> 
> 
> 
> 
> 
> 
> 
> -- 
> Chad Kellerman
> Jr. Systems Administrator
> Alabanza Inc
> 410-234-3305



-- 
Hardy Merrill
Senior Software Engineer
Red Hat, Inc.



ActivePerl + PPM on HP-UX (DBD::Informix)?

2002-12-16 Thread Henry McGuinness
Hi,

Does anybody have experience using DBI with
Activestate's Perl for HP-UX 11? Does the PPM work in
the same way as it does for the Windows version.

Specifically, a colleague of mine wants to use
DBD::Informix, and had given up on the re-compiling
perl + module with gcc. 

PPM would make his life a lot easier, but I've
searched activestate, google and google groups in vain
for info.

TIA,
Henry


__
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com



unexpected results with perl and mysql

2002-12-16 Thread chad kellerman
Ney guys,

I am trying to fetch and array form a table and I am not getting the
results I thought I would get:

I thought it was quote simple but when I print them outwell you'll
see?




#!/usr/bin/perl
use strict;
use warnings;

use DBI;

my( $dbname ) = "BACKUP";
my( $mysqluser ) = "bob";
my( $mysqlpasswd ) = "bobspasswd";
my( $dbh, $sth, $rc, @failedCon, $var, $name, @names );

#these variables will be passed to subroutine in main program.
my( $hostId ) = "543";
my( $biggyFlag ) = "0";
my( $hostDirFlag ) = "0";


$dbh = DBI->connect( "DBI:mysql:database=".$dbname, $mysqluser,
$mysqlpasswd ) or die "Cannot connect to database: $!";

#first check for failed attempts

$sth = $dbh->prepare( qq{ SELECT failedConAttempt FROM tblControl WHERE
hostId="$hostId" } );
$sth->execute;
$sth->bind_columns( \$var );
while  ( $sth->fetch ) {

push @failedCon, $var;

}

print "backup failed to connect to $hostId: $failedCon[0] times.\n";


#grab information

if ($failedCon[0] != 0 ) {
$sth = $dbh->prepare( q{
SELECT name FROM tblProcess
WHERE biggy_flag="$biggyFlag" AND
hostId="$hostId" AND hostDirFlag="$hostDirFlag" AND status="In-Progress"
OR status="Queued"
} );
$sth->execute;
$sth->bind_columns( \$name );
while ( $sth->fetch ) {
push @names, $name;
print "@names\n";
}
}else{
$sth = $dbh->prepare( q{
SELECT name FROM tblProcess
WHERE biggy_flag="$biggyFlag" AND
hostId="$hostId" AND hostDirFlag="$hostDirFlag" } );
$sth->execute;
$sth->bind_columns( \$name );
while ( $sth->fetchrow_array ) {
push @names, $name;
print "@names\n";
}

}

$rc = $dbh->disconnect;





when I run this I get:


[root@widowmaker sbin]# perl mysql.pl 
backup failed to connect to 543: 5 times.
alan
alan alex
alan alex bob
alan alex bob cole
alan alex bob cole brian
alan alex bob cole brian coleman
alan alex bob cole brian coleman david
alan alex bob cole brian coleman david edward
alan alex bob cole brian coleman david edward evilyn

  THe first print statemnet I get I expect, it came out right. But I
just want to print the second array.. Why does it print
alan
alan alex
alan alex bob
alan alex bob cole
alan alex bob cole brian
alan alex bob cole brian coleman
alan alex bob cole brian coleman david
alan alex bob cole brian coleman david edward
alan alex bob cole brian coleman david edward evilyn

and not just:
alan alex bob cole brian coleman david edward evilyn

am I missing something???

Thanks,
Chad








-- 
Chad Kellerman
Jr. Systems Administrator
Alabanza Inc
410-234-3305



signature.asc
Description: This is a digitally signed message part


Re: Creating database triggers w/perl

2002-12-16 Thread Waldemar Zurowski
W liście z pon, 16-12-2002, godz. 10:32, Brien Pirkle pisze: 


> my $st_create_trigger = $dbh->do(qq{
> });

Are there any reasons, you are using 'qq' instead of 'q'?
BTW - escaping can be done using '\' (backslash) character, as qq(some
string) is equivalent to "some string".

Waldemar

--r-e-k-l-a-m-a-

Masz dość płacenia prowizji bankowi ?
mBank - załóż konto
http://epieniadze.onet.pl/mbank 



Re: sql Problem

2002-12-16 Thread David N Murray
The argument for prepare is a SQL statement, not the name of a file.
Also, AFAIK, you can't prepare multiple statements at a time, only one at
a time (and including a ; may or may not work, depending on your platform;
I'm not DB2/DBI literate).

Have you gotten this to work?

$sth = $dbh->prepare("select * from foo");
$sth->execute();

For dump_results, you need to re-read the docs.  Your example isn't
anything close to what I see in 'perldoc DBI':

$rows = $sth->dump_results($maxlen, $lsep, $fsep, $fh);

Which, at a minimum, tells me you need to open and close 'genpak.sql'
yourself.

Finally, do() will do a prepare and execute on a single SQL statement.
So, if your goal is to generate a script and execute it, you need to write
your own wrapper to read, parse, and execute each statement.  Another
alternative is to create a stored procedure, and execute it, but I don't
think that's an option with DB2, is it?

HTH,
Dave


>
> Hi eveyone;
>
> Can someone help me with this: I am trying to do a prepare and execute a .sql when 
>connected to a DB2 database using DBI.  The foo.sql is the ($sqlfilename)has to 
>($genpak.sql)  here is the code:
>
> my $sth = $dbh->prepare($sqlfilename);
> $sth->execute();
> $rows = DBI::dump_results($sth,genpak.sql);
> $sth = $dbh->do($genpak);
>
>
> any help would be cool.Thanks
>
> Steve
>
>
>
> -
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now




sql Problem

2002-12-16 Thread steve hatfield

Hi eveyone;

Can someone help me with this: I am trying to do a prepare and execute a .sql when 
connected to a DB2 database using DBI.  The foo.sql is the ($sqlfilename)has to 
($genpak.sql)  here is the code:

my $sth = $dbh->prepare($sqlfilename);
$sth->execute();
$rows = DBI::dump_results($sth,genpak.sql);
$sth = $dbh->do($genpak); 


any help would be cool.Thanks

Steve



-
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now


Re: Test failure with DBI 1.32 on MacOS X

2002-12-16 Thread Tim Bunce
On Mon, Dec 16, 2002 at 08:56:26AM +0100, Christian Schaffner wrote:
> Hi Tim
> 
> I am the fink (http://fink.sf.net) package maintainer of the DBI perl 
> module for MacOS X. I tried to update the package to version 1.32 and 
> got the following test error:
> 
> ...
> t/10examp...1..245
> ok 1 at line 33
> 
> ... (all ok)
> 
> ok 102 at line 316
> fetchrow_hashref('NAME_uc')
> ok 103 at line 319
> Insecure dependency in parameter 1 of DBI::st=HASH(0x203388)->FETCH 
> method call while running with -T switch at t/10examp.t line 320.
> DBI handle cleared whilst still active.
> dbih_clearcom (sth 0x204f58 0x10cd30, com 0x1f6510, imp 
> DBD::ExampleP::st):
>FLAGS 0x60011: COMSET Warn TaintIn TaintOut
>PARENT DBI::db=HASH(0x1cbb34)
>KIDS 0 (0 Active)
>IMP_DATA ARRAY(0x205e54)
>NUM_OF_FIELDS 3
>NUM_OF_PARAMS 1
> dubious
> Test returned status 20 (wstat 5120, 0x1400)
> DIED. FAILED tests 104-245
> Failed 142/245 tests, 42.04% okay
> ...
> 
> Could you imagine what the problem here might be?

Off-hand... no. You'll have to dig into it some more yourself.

Something is causing the perl internal PL_tainted variable to
get set before the fetchrow_hashref code in DBI.xs reaches the line:
ka_rv = newSVsv(ka_rv); /* copy to invoke FETCH magic */

If you're handy with a C debugger then run the t/10examp.t script
under bother the perl debugger and C debugger. Stop before that
test using the perl debugger and put a watchpoint on the perl
internal PL_tainted variable using the C debugger. Then continue
to see where PL_tainted gets set.

Alternatively sprinkle a few warn("PL_tainted=%d",PL_tainted);
into the fetchrow_hashref code in DBI.xs.

> PS: Version 1.31 work fine.

I think those tests we're accidentally left disabled in that version.
Try earlier versions (diff the t/10examp.t file to check).

Tim.



Re: DBI 1.30 make test problem

2002-12-16 Thread Tim Bunce
On Sun, Dec 15, 2002 at 09:48:47PM -0500, Matthew O. Persico wrote:
> On Sun, 15 Dec 2002 22:12:43 +, "Tim Bunce" <[EMAIL PROTECTED]>said:
> >I wasn't able to test with 5.005 prior to release.
> >
> >[Note that I've given notice that the DBI won't support 5.005 much longer.
> >You should give serious consideration to upgrading your perl soon.
> >Both 5.6.1 and 5.8.0 are excellent releases of perl.]
> 
> Can you post a link to this statement so I can have some ammo when the upcoming 
>Sybase upgrade at my job morphs into a Sybase and Perl upgrade?

http://search.cpan.org/author/TIMB/DBI-1.32/Changes#Changes_in_DBI_1_29_15th_July_2002

Tim.



Creating database triggers w/perl

2002-12-16 Thread Brien Pirkle
I'm toying with the idea of using a perl script to generate triggers in my
SQLserver database.

First, is this a reasonable idea?

If it's reasonable to build triggers this way, what escaping do I need to do
to get the following create trigger statement to work?  It currently fails
complaining about declaring the variable @ and I can't figure out  how to
escape it

My platform is NT, ActivePerl 633,DBD-ODBC...database is SQLServer2000. 

TIA,

Brien


use DBI;
my $dbh = DBI->connect('DBI:ODBC:DEV_OST', 'user', 'pass',
{PrintError => 1});
  

my $st_create_trigger = $dbh->do(qq{
create TRIGGER trg_CDSAP_2_1_0_central_err
ON CDSAP_2_1_0
FOR update AS
if @@rowcount=1

DECLARE @badid NUMERIC(12,0)
DECLARE @status NUMERIC(3,0)
DECLARE @message varchar(255)
DECLARE @errorid NUMERIC(12,0)


if update(status)
BEGIN
SELECT  @badid=seq_no, 
@status=status,
@message=error_str
FROM inserted

if @status in (0,1,2)

return

select @errorid = max(ID) + 1 from WASP_Support.dbo.tblErrors
where ID > 5000

if @errorid is null

select @errorid=5001

insert into WASP_Support.dbo.tblErrors
(   ID,
ErrRowID,
SourceID,
Attribute,
AttributeValue,
MappingName,
ConstraintName,
SessionID,
ErrorCode,
ErrorDescription,
ErrorDate)
values(
@errorid,
@badid,
@badid,
'OST EBE Table: CDSAP_2_1_0',
'OST Rule: WASP_Expense_Daily_STP',
'OST EBE',
'OST EBE',
@badid,
'E',
@message,
getdate()
)
end
});

CONFIDENTIALITY AND DISCLAIMER NOTICE 

The information contained in this e-mail and any attachments 
is confidential and intended for the addressee only and may 
be protected by copyright.  Copying or forwarding any part of 
this e-mail is prohibited. If you have received this e-mail in 
error please delete it and notify us by telephone or return 
e-mail immediately. Any views or opinions contained in 
this message are solely those of the sender and do not 
necessarily represent those of Microgen-OST Limited. 
We advise you to carry out your own virus check before 
opening any attachments as we do not accept liability for 
any damage sustained as a result of any software viruses.

Microgen-OST Limited registered address: 
11, Park Street, 
Windsor, 
Berkshire 
SL4 1LU 

Company Registration No 3475849 




Test failure with DBI 1.32 on MacOS X

2002-12-16 Thread Christian Schaffner
Hi Tim

I am the fink (http://fink.sf.net) package maintainer of the DBI perl 
module for MacOS X. I tried to update the package to version 1.32 and 
got the following test error:

...
t/10examp...1..245
ok 1 at line 33

... (all ok)

ok 102 at line 316
fetchrow_hashref('NAME_uc')
ok 103 at line 319
Insecure dependency in parameter 1 of DBI::st=HASH(0x203388)->FETCH 
method call while running with -T switch at t/10examp.t line 320.
DBI handle cleared whilst still active.
dbih_clearcom (sth 0x204f58 0x10cd30, com 0x1f6510, imp 
DBD::ExampleP::st):
   FLAGS 0x60011: COMSET Warn TaintIn TaintOut
   PARENT DBI::db=HASH(0x1cbb34)
   KIDS 0 (0 Active)
   IMP_DATA ARRAY(0x205e54)
   NUM_OF_FIELDS 3
   NUM_OF_PARAMS 1
dubious
Test returned status 20 (wstat 5120, 0x1400)
DIED. FAILED tests 104-245
Failed 142/245 tests, 42.04% okay
...

Could you imagine what the problem here might be? Thanks a lot for your 
help.
chris.

PS: Version 1.31 work fine.
PS2: I use MacOS X 10.2.2



RE: Problem building DBI >1.30

2002-12-16 Thread Brian Nelson
Hmm. Maybe just a dependency bug? Oh well, I just put in a perl 5.8 package, 
which has Time:HiRes allready in it, and DBI built just fine. Of course, now I'm 
having trouble with DBD-Pg-131 :-( 

Thanks for the help!

-Brian


>Envelope-to: [EMAIL PROTECTED]
>Delivery-date: Fri, 13 Dec 2002 13:36:05 -0500
>From: [EMAIL PROTECTED]
>To: [EMAIL PROTECTED], [EMAIL PROTECTED]
>Subject: RE: Problem building DBI >1.30
>Date: Fri, 13 Dec 2002 13:35:14 -0500
>MIME-Version: 1.0
>
>It looks like Time::HiRes is now a dependent package for the test suite.
>
>Go get this from CPAN, install it, and rerun your tests
>
>-Original Message-
>From: Brian Nelson [mailto:[EMAIL PROTECTED]] 
>Sent: Friday, December 13, 2002 12:30 PM
>To: [EMAIL PROTECTED]
>Subject: Problem building DBI >1.30
>
>I cant build DBI 1.31 or 1.32 properly. 1.30 works fine.
>
>I am building on solaris 8, with gcc 2.95.3 (solaris ld and such).
>
>Perl is 5.6.1 sun freeware package (perl -V is below, and complete build
>log)
>
>It compiles ok, but when running 'make test' this part is failing:
>
>
>t/40profile.Can't locate Time/HiRes.pm in @INC (@INC contains: 
>blib/arch blib/lib /usr/local/lib/perl5/5.6.1/sun4-solaris 
>/usr/local/lib/perl5/5.6.1/sun4-solaris
>/usr/local/lib/perl5/5.6.1/sun4-solaris 
>/usr/local/lib/perl5/5.6.1 /usr/local/lib/perl5/5.6.1/sun4-solaris 
>/usr/local/lib/perl5/5.6.1/sun4-solaris /usr/local/lib/perl5/5.6.1 
>/usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris 
>/usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris 
>/usr/local/lib/perl5/site_perl/5.6.1 
>/usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris 
>/usr/local/lib/perl5/site_perl/5.6.1 /usr/local/lib/perl5/site_perl . 
>/usr/local/lib/perl5/5.6.1/sun4-solaris /usr/local/lib/perl5/5.6.1 
>/usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris 
>/usr/local/lib/perl5/site_perl/5.6.1 /usr/local/lib/perl5/site_perl .) at 
>t/40profile.t line 181.
>BEGIN failed--compilation aborted at t/40profile.t line 181.
>t/40profile.dubious
>
>Test returned status 2 (wstat 512, 0x200)
>DIED. FAILED tests 1-54
>Failed 54/54 tests, 0.00% okay
>
>It appears to can't find the file, but I dont know why. I don't see any 
>aditional required packages for DBI. Again, >=1.30 works fine.
>
>Thanks!
>
>-Brian
>
>




DBD::Oracle and Oracle 8i

2002-12-16 Thread Arun P. Nambissan
It appears that DBD::Oracle when compiled with Oracle 8i, has serious 
performance issues when talking -- across the WAN -- to databases running 
Oracle 7.3.4. Queries that used to return in a couple of seconds are now 
taking several minutes.

Some tests have revealed that we are unable to set RowCacheSize and as a 
result, the "fetch" time is drastically increased as data is getting 
returned one row at a time. The problem is masked when the databases are 
co-located to the server initiating the query. Since we are a global 
company, we have quite a few DB instances (especially developement), that 
are at remote sites.

Wonder if you are aware of the problem, and of the possible fix.

We have DBI v1.18, DBD::Oracle 1.07, perl v5.6.1 and Oracle 8.1.7. Oracle 
was of no help, and washed their hands off the problem, claiming that they 
don't support perl modules.

Any help, pointers would be highly appreciated.

--
arun.