RE: Select a random row?

2002-06-03 Thread Stephen Keller
The PerlDoc version works with a DB by treating it as a file, but you still have the overhead of selecting and returning all that data over a relatively slow network. An even better approach is to randomly calculate the id to select. If your IDs are integers and contiguous, this is relatively

RE: DBI on Mac OSX?

2002-05-28 Thread Stephen Keller
Hi Patrick: You wrote: I've been looking around, and it appears as though you succeeded because of two factors in your favor, which are not in mine: 1) You probably know what you're doing already Man do I wish that were true! I just stumble around in the dark until I stub my toe on a

RE: DBI on Mac OSX?

2002-05-23 Thread Stephen Keller
Well, I just tried to install the latest DBI on a MacOSX machine using the following: sudo perl -MCPAN -e shell cpan install DBI It went without a flaw and passed all of its tests. The test system is running MacOSX 10.1.4 on a G4 Cube. The development tools are reasonably up to date and I've

RE: Storing arrays in a db?

2002-05-21 Thread Stephen Keller
Hi Philip, you wrote: This is a programming/algorithm question: How would you store an unordered list of unordered lists in an RDBMS? +-++ | pid | name | +-++ | 1 | Rei| | 1 | Minako | | 1 | Michiru|

RE: DBI works, but CGI + DBI bombs?

2002-05-16 Thread Stephen Keller
I've intermixed DBI.pm (connecting to DB2) and CGI.pm a lot, so I'm pretty sure there is no name conflict between the two. One problem, I've run into frequently, however, is that the configuration of the account when running from the web server is sometimes deliberately limited. One way that

RE: How to call stored procedure?

2002-04-29 Thread Stephen Keller
:[EMAIL PROTECTED]] Sent: Monday, April 29, 2002 8:39 AM To: [EMAIL PROTECTED] Subject: RE: How to call stored procedure? -- Stephen Keller [EMAIL PROTECTED] Ed, you asked about stored procedures in DBD::DB2 land... According to the IBM CLI documentation, you can only call

RE: Help: how many rows were returned?

2002-04-26 Thread Stephen Keller
Jayce writes: how many rows are returned, so I can set up my x, y axis right. my $number_rows = $csr-rows; easy ;D Not so easy: I cite from the DBI perldoc: Generally, you can only rely on a row count after a non-SELECT execute (for some specific operations like UPDATE and

RE: :DB2 pod2man

2002-04-19 Thread Stephen Keller
Lee, you asked about pod2man: Well, pod2man is part of the standard Perl installation (but I think it can be turned off, if you don't want to install the documentation). It is used to read the POD documentation from a Perl source module and convert it into man page format. The program is

RE: So far..

2002-04-19 Thread Stephen Keller
Hi Lee: You must have the DB2 client environment installed on any machine where you expect to run DBD::DB2 perl applications. That driver is dependent on the client libraries. You will also get this error when the client is installed, but you have failed to set the DB2INSTANCE environment

RE: DBI and Date formatting?

2002-04-15 Thread Stephen Keller
Bill McClintock asks about different date formats, I need to find a way to get date fields in a database to be returned in the same formatting. I have an MSSQL database but the end clients are linux w/ DBD::Sybase (FreeTDS build) and WinNT w/ DBD::ODBC. DBD::Sybase returns dates

RE: question about DBI

2002-04-14 Thread Stephen Keller
Hi Xu, Yilin, you asked about a script that complained: Undefined subroutine DBI::dr::connect called at /usr/lib/perl5/site_perl/5.6.0/i386-linux/DBI.pm line 471. I think the explicit use of DBD::mysql is causing the problem. I don't have a mysql installed, but try commenting out that use

RE: Error installing DBD::DB2 perl module on i586 linux system.

2002-04-05 Thread Stephen Keller
and link DB2 executables, then it is possible that the development libraries were not installed, so the compiler can't see the necessary .h files because they are in fact not there. If that proves to be the case, see your friendly system admin to correct that omission. Hope this is helpful. Stephen

RE: as_string

2002-04-04 Thread Stephen Keller
Do you mean the $sth-{Statement} attribute? -Original Message- From: Ido Trivizki [mailto:[EMAIL PROTECTED]] Sent: Wednesday, April 03, 2002 5:53 PM To: [EMAIL PROTECTED] Subject: as_string I would like to suggest an as_string function that would work like:

RE: Fork, DBI and DBD-Mysql ...

2002-04-03 Thread Stephen Keller
Hello Bogdan Badiu, you asked about database connects and forks. Well, I tried both your scripts out on a Linux machine and got no errors at all. I was also able to get the fork to work on a Windows 2000 machine, but I don't have the DBI installed on that box to try the combination. Is it

RE: Should DBI be part of standard Perl distribution (was RE: Pure-pe rl DBI emulation - what use?)

2002-03-25 Thread Stephen Keller
Simon Oliver wrote: Most DBMS's have ODBC and/or JDBC drivers. Couldn't these two drivers could be included to provide almost universal access without the need for compilation of vendor specific DBD's. But isn't ODBC a C library that must be installed on the client to work? And

RE: Should DBI be part of standard Perl distribution (was RE: Pure-Perl DBI emulation - what use?)

2002-03-22 Thread Stephen Keller
Hello All: I wrote: the version of DBI for a given version of the DBD driver. When these don't match up, the driver doesn't always work correctly. Tim asked: Why not, exactly? Most of the problems we had were compile failures. Features in the DBI that weren't present in the DBD::DB2

RE: Shorter way to define placeholders...

2002-03-15 Thread Stephen Keller
John suggests: My first thought is to string multiply by the number of elements: JB1: perl -e print('?',',?'x (ARGV-1)); a b c d e f ?,?,?,?,?,? or JB1: perl -e print('?',',?'x (split(',',$ARGV[0])-1)); a,b,c,d,e,f ?,?,?,?,?,? P.S. I get this on the latter... I often do the

RE: need some newbie logic help on Insert/Update

2002-03-12 Thread Stephen Keller
Tom Price wrote: Catching errors on Oracle is really, really slow. How about a BEGIN block that attempts to select the record and does this logic in SQL? Well, it's my DB2 experience/Oracle ignorance that was showing. It's true though, that you will pay a price for attempting the insert

RE: SELECT \$moid FROM xyz.abc

2002-02-28 Thread Stephen Keller
. Stph -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]] Sent: Thursday, February 28, 2002 6:16 AM To: Stephen Keller Cc: [EMAIL PROTECTED] Subject: RE: SELECT \$moid FROM xyz.abc Stephen, Using DB2 V7.1 : DBI : 1.21 DBD::DB2 0.76 db2 describe table

RE: SELECT \$moid FROM xyz.abc

2002-02-27 Thread Stephen Keller
Hi Sachin, Hopefully, I've not completely misunderstood your question. I'm stuggling with how to interpret what you mean by the char data value: that looks like C notation for a pointer. If by char is being stored in that you column you mean it is a CLOB or other type of large object, you

RE: SELECT \$moid FROM xyz.abc

2002-02-27 Thread Stephen Keller
, February 27, 2002 10:27 AM To: Stephen Keller Cc: [EMAIL PROTECTED] Subject: RE: SELECT \$moid FROM xyz.abc Hi Stephen, I am assuming it is a pointer. The column definition says $MOID stores CHAR(8). The actual data I am trying to get is a string like 413567EAFFCXXX 16 characters. I would think

RE: DBD::DB2 problem

2002-02-26 Thread Stephen Keller
Hello all: Justin's approach to use db2profile works great if you are setting up a user account. But for programs that run as cron (say on the DB host as user db2inst1), it may not work. The program won't always inherit the proper environment because cron doesn't invoke the user's startup

RE: :DB2 problem

2002-02-25 Thread Stephen Keller
Hi Brad, You asked about getting the DB2 environment set up inside a Perl program. As far as I know, you must have the DB2INSTANCE variable set for the DB2 connection to work, and I generally set up the DB2 environment with a BEGIN block in the perl code that's going to use DBI. Here's a