ADO Select Problem

2007-02-02 Thread David N Murray
Greetings, For years, I've used the following construct for indexed, single-row retrievals: $sh = $dbh-prepare(select col from tbl where key = ?); $sh-execute(); @ar = $sh-fetchrow_array(); if ($#ar -1) {... I got bit today by a problem either in ADO.pm (2.96) or ADO itself. Very small sample

Re: How to bind to a LARGE array

2006-05-02 Thread David N Murray
On May 1, Bealach Na Bo scribed: Hi folks, Apologies if this has been asked and resolved - I've spent half a day searching various archive, but have not found anything. My problem is the following: I have a very large postgresql table (ca. 3 mil records) and need to replace a nested sql

Re: Describe table

2005-04-18 Thread David N Murray
DESCribe is a SQL*Plus command. You can probably find what you are looking for by selecting from sys.all_tab_columns. There may be a DBA view that does the same thing, but I'm not up on them. HTH, Dave On Apr 18, Mike Scott scribed: I'm using DBI and DBD::Oracle. I'd like to be able to

Re: How many lines deleted?

2005-03-27 Thread David N Murray
$ perldoc DBI do $rows = $dbh-do($statement) or die $dbh-errstr; $rows = $dbh-do($statement, \%attr) or die $dbh-errstr; $rows = $dbh-do($statement, \%attr, @bind_values) or die ... Prepare and execute a single statement.

Re: Unable to connect to Oracle on another Unix host in a perl programming using DBI

2005-03-23 Thread David N Murray
Does 'tnsping Mycad4prod' work from host(A)? I created a service called test.xyz.com. 'tnsping test' fails (TNS-03505: Failed to resolve name), but 'tnsping test.xyz.com' works. This doesn't sound like a DBI issue at this point. On Mar 23, Kairam, Raj scribed: To those who could help me with

Re:[dbi] YA Stored Procedure Question

2005-03-02 Thread David N Murray
Thanks for the feedback everyone. I need to add that I tried another test. In this one, I pulled out the insert and update statement from the SP (just to confirm that what I wanted to do really would work) and the result set was returned and the fetchrow_array call did succeed and returned my

RE: [dbi] YA Stored Procedure Question

2005-03-02 Thread David N Murray
On Mar 2, Jenda Krynicky scribed: Try to add SET NOCOUNT ON on top of the stored procedure. That should prevent the select into and update statements from getting in the way. Thanks! That's it. I forgot about that. Dave

YA Stored Procedure Question

2005-03-01 Thread David N Murray
Hi all, Since we seem to be on the subject of Stored Procedures, I thought I'd throw my problem out there, since I can't figure out what I'm doing wrong. The SP builds a temp table, updates the source table from the temp table and then returns a recordset with the contents of the temp table.

RE: YA Stored Procedure Question

2005-03-01 Thread David N Murray
not. Thanks anyway. Dave On Mar 1, Moosmann, James scribed: see if dropping the go works GO is not going to be recognized by SQL Server ;-) , I use @statements = split /\bgo\b/, $sql when I want to use a go in my sql -Original Message- From: David N Murray [mailto:[EMAIL PROTECTED] Sent

Re: Connect to Oracle 8.1.7

2005-01-24 Thread David N Murray
What happens if you try the statement in sqlplus user/[EMAIL PROTECTED] This doesn't look like a connectivity issue, except where user may not own the table you are selecting from, i.e. try select ... from owner.table if you are connecting as 'user' rather than 'owner'. Of course, 'user' needs

Re: Please Help..Getting an error

2005-01-24 Thread David N Murray
DESCribe is a SQLPlus command (which Toad is emulating), not valid SQL. There are other DBI functions to do the same thing that DESC does. See table_info and column_info in the DBI docs. HTH, Dave On Jan 25, [EMAIL PROTECTED] scribed: Error Message is [Tue Jan 25 04:53:23 2005] [error]

Re: Aliases in DBI/DBD

2004-12-24 Thread David N Murray
If you are trying something like my $sql = select to_char(mf.ROW_MOD_DATE,'MM/DD/') Modify Date from tbl mf; then its perl that's balking. (List hint: actual code samples are extremely helpful.) You need to escape the quotes within this string (well, that's one way to do it, anyway): my

Re: Problems Installing DBD::MySQL

2004-12-23 Thread David N Murray
Tony, You seem to be missing libnss_files.so. I'm no familiar with SUSE, so I can't tell you where to obtain it from, or if its even used. On my RedHat box, it's in /lib. It implements the 'files' portion of the Name Service Switch system (but I don't know what that is, either). On my box,

Re: Connecting to a remote server

2004-12-02 Thread David N Murray
Pardon my jumping into the middle of this thread without reading the previous, but this problem is well-documented (check google). With MySQL 4.1, you can't connect using DBI. The authentication method changed and the DBD::MySQL module hasn't caught up yet. I went through this a couple of weeks

Re: Why wont my script finish?

2004-11-24 Thread David N Murray
How long does 'delete from table where year = 2003' take in SQLPlus? On Nov 24, Mark Martin scribed: Michael, thanks for the quick response. TABLE was just an example. tried your error checking and nothing came up. So, went back to : 1. defining the SQL statement instead. 2. preparing

Re: Why wont my script finish?

2004-11-24 Thread David N Murray
from DBI on varying subsets of data all the way down to 1 record (the only delete that works)) At 10:57 24/11/2004 -0500, David N Murray wrote: How long does 'delete from table where year = 2003' take in SQLPlus? On Nov 24, Mark Martin scribed: Michael, thanks for the quick response

RE: Why wont my script finish?

2004-11-24 Thread David N Murray
On Nov 24, Jeff Urlwin scribed: I do what you originally did ($dbh-do(delete...) all the time on Oracle 8.1.7. The only difference I have is my $dbh = DBI-connect(dbi:Oracle:database, user, pass, { RaiseError = 1, AutoCommit = 0 }); i.e. I explicitly set

Re: Error on large select statement

2004-09-24 Thread David N Murray
For version info print $DBI::Version and $DBD::Oracle::VERSION. $ oerr ora 1555 01555, 0, snapshot too old: rollback segment number %s with name \%s\ too small // *Cause: rollback records needed by a reader for consistent read are // overwritten by other writers // *Action: Use larger

Re: How to setting timeout in DBD::ODBC

2004-09-16 Thread David N Murray
Try this, it worked for me a couple of weeks ago: my $dbh = DBI-connect(dbi:ADO:Provider=SQLOLEDB;...); # do appropriate error checking $dbh-{ado_commandtimeout} = 0; # turn off timeout HTH, Dave On Sep 15, [EMAIL PROTECTED] scribed: Hello, Is there way to set timeout in DBD::ODBC? I'm

RE: Perl with MySQL

2004-09-13 Thread David N Murray
Kirti, When I've run into really wierd stuff like this with CPAN, I changed my mirror. Its in wherever_perl_is_installed/CPAN/Config.pm. Change the urllist to use another one. My primary mirror stopped being updated. Switching to #2 solved my problems. HTH, Dave On Sep 13, Kirti S. Bajwa

Re: How to Install FTP.pm for Perl

2004-08-23 Thread David N Murray
You missed all the dependencies of DBI. CPAN is your friend. Download and install CPAN-1.76_01.tar.gz the same way you got and installed DBI (tar xvfz, perl Makefile.PL, make, make test, make install). Then, # perl -MCPAN -e shell; You probably want to cpan install Bundle::CPAN next, and let it

Re: Getting a field list from a query with NO results?

2004-08-23 Thread David N Murray
If you don't know the columns that will be returned, I presume you're doing something akin to 'select * from'. At any rate, if you know the table name, why not ask the database for the table info? #!/usr/bin/perl use DBI; my $dbh = DBI-connect(dbi:mysql:test,'',''); die Unable to connect:\n .

Re: DBD::ADO and CommandTimeout

2004-08-19 Thread David N Murray
On Aug 19, Steffen Goeldner scribed: David N Murray wrote: Hi all, I'm having a heck of a time querying a large table. What I'm trying to do is: [snip my sample code] Does this my $dbh = ... $dbh-{ado_commandtimeout} = 0; my $sth = ... print $sth-{ado_comm

DBD::ADO and CommandTimeout

2004-08-18 Thread David N Murray
Hi all, I'm having a heck of a time querying a large table. What I'm trying to do is: #!/usr/bin/perl -w use DBI; use strict; $|++; my $dbh = DBI-connect(dbi:ADO:Provider=SQLOLEDB;Integrated Security=SSPI;Data Source=(local);Initial Catalog=db;CommandTimeout=900); die Connect failed: .

Re: Question about bind_param and Oracle

2004-07-16 Thread David N Murray
You can't use a parameter for the table name. You have to use dynamic sql (i.e. put it in the $sql var before the prepare). There's no point in the prepare if the DB can't even figure out what table is going to be hit. This should be a FAQ, but I didn't see it in there. hth, dave On Jul 16,

Re: no DBD:MSSQL?

2004-07-13 Thread David N Murray
google turns up http://search.cpan.org/search?module=DBD::ADO ADO ODBC are your only options, AFAIK, on Windows. Maybe someone more informed can comment on using the Sybase driver. hth, dave On Jul 13, Janet Goldstein scribed: Am I missing something? I searched CPAN for a DBI driver for

Re: no DBD:MSSQL?

2004-07-13 Thread David N Murray
On Jul 13, Janet Goldstein scribed: David N Murray wrote: google turns up http://search.cpan.org/search?module=DBD::ADO ADO ODBC are your only options, AFAIK, on Windows. Maybe someone more informed can comment on using the Sybase driver. Thanks for your reply, Dave. Actually, I'm

Re: Describe table

2004-05-13 Thread David N Murray
DESCRIBE is a SQLPLUS command, not a SQL statement. I'm looking at the Oracle SQL Reference (8.1.7) and DESCRIBE isn't listed. An alternative that works for me is select * from sys.user_tab_columns where table_name = table order by column_id; HTH, Dave On May 13, Jimmy Jauhal scribed: Hi

Re: Correct way to deal with returned NULLs?

2004-04-26 Thread David N Murray
$dateclosed = '' if !defined($dateclosed); On Apr 26, Jesse, Rich scribed: Howdy, I have a question from one of our developers that's been bugging me and I can't find an answer. Given this v1.37 DBI code fragement: while ( my ($projectno,$description,$dateclosed) = $sth-fetchrow_array )

Re: environment variables in perl scripts

2004-04-25 Thread David N Murray
(I'm assuming Linux and the bash shell here, since you didn't specify.) The problem is when you run './setup_vars' it runs in the context of another process and environment changes don't go 'backwards'. What you need to do is 'source' the file that contains the environment variables using the

RE: Why won't my script terminate?

2004-03-24 Thread David N Murray
I think knowing which line its hanging up on would be benficial in diagnosing this. In that regard, why not try the perl debugger. If you're not familiar with the debugger, here's a quick rundown on the commands you'll need: $ perl -d script_name.pl and_any_args_for_script DB1 b n* n* is a line

Re: getting table structure out of MS-Access

2004-03-24 Thread David N Murray
I thought this worked, but when I test it now, I can't get it to work. YMMV. -- Dave #!/usr/bin/perl -w # this does a 'describe' for MS access use DBI; use strict; $|++; #DBI-trace(8); die usage: desc.pl DSN table_name\n if $#ARGV != 1; my $dbh = DBI-connect(dbi:ODBC:$ARGV[0], '', '',

Re: perl-oracle connection error

2004-02-21 Thread David N Murray
Apache (assuming you are using Apache, you didn't indicate) doesn't have ORACLE_HOME set. On Feb 21, ram kumar scribed: This is the script: #! /usr/bin/perl # This should fix it: $ENV{ORACLE_HOME} = '/opt/ora9/product/9.2'; # but there's probably a better way... print Content-type:

RE: Strange matching problem...

2004-01-22 Thread David N Murray
On Jan 22, NIPP, SCOTT V (SBCSI) scribed: OK. I am working on converting this to use placeholders and the qq quoting option. I am obviously very new to placeholders, so this is probably a stupid question, but here goes. I execute the script and receive the following error: [EMAIL

Re: Quick DBI:ODBC question...

2004-01-20 Thread David N Murray
What's the error that's returned? I looked at some code that I use for ODBC, and my format is DBI-connect('dbi:ODBC:dsn','username','password'), not 'database=dsn'. HTH, Dave On Jan 20, Herbold, John W. scribed: I am trying to hit a MS SQL server using DBI:ODBC from an win2k box. I have

Re: DBD

2004-01-10 Thread David N Murray
I got this same error and have seen others post with the same problem. I d/l'd the whole oracle kit (dbd-oracle-1.14, from cpan) and built it on my machine, and it works fine (DBI doesn't have any .dll dependencies that I'm aware of). I have the full oracle 8.1.4 client installed, MSVC 6 SP3,

RE: Perl and DBI

2004-01-09 Thread David N Murray
I'm kind of curious. If you aren't willing to use google to do the 30 seconds of searches needed to find ActiveState and ppm to install perl, how are you going to write a program in perl using DBI? Maybe you should start here: http://www.catb.org/~esr/faqs/smart-questions.html On Jan 9,

Re: Oracle.dll load Failure V5.8.1

2003-12-29 Thread David N Murray
I got this same error and have seen others post with the same problem. I d/l'd the whole oracle kit (dbd-oracle-1.14, from cpan) and built it on my machine, and it works fine (DBI doesn't have any .dll dependencies that I'm aware of). I have the full oracle 8.1.4 client installed, MSVC 6 SP3,

Re: Optimization for faster select...

2003-12-11 Thread David N Murray
Sounds like a great test! Why don't you let us know which way is faster: doing the substr's on the DB or in perl (my bet is perl). For that matter, you could also test to see if join('|', @row) is faster. You could certainly move the \n up to the first print line (via . or ,) and cut out a

Re: A little SELECT syntax

2003-10-26 Thread David N Murray
1) What's the error? 2) Does your sql statement work in mysql (interactive mode)? 3) What does WHERE 1 AND ... mean? IOW, what's the '1 AND' supposed to be doing? 4) Start smaller when you are developing SQL statements that you feel are complex: - select * from memodata where readdate =

Re: DBI Newbie: Connection Failure Issue??

2003-10-06 Thread David N Murray
On Oct 6, David Kramer scribed: Im new to using DBI, so this question is very simple Im sure. I have searched the web and have read through O'Reilly's Programming the Perl DBI. Im trying to connect to an Oracle 8.1.7 database running on Solaris 8. The script itself resides on my app server

Re: How easy is it to reuse DBI code with other databases

2003-09-26 Thread David N Murray
On Sep 26, Dan Anderson scribed: I am trying to create a CGI perl script that uses DBI. I want to allow it to use any database supported by DBI without having to code for anything more then mySQL. Is this possible? Will I need to include all supported DBI modules (or is it DBD?) with my

Re: Cant call method execute problem

2003-09-09 Thread David N Murray
On Sep 9, Sharma, Amit scribed: Hi, While trying to execute the following SQL , I get the following error: Can't call method execute on an undefined value at x.pl line 105. .. my $sqlSch = SELECT SEQ_NO from $TableName; The substitution of $TableName (if its populated) has already occurred

Re[4]: memory leak on DBI

2003-07-01 Thread David N Murray
Is he using mysql? Or is it just installed. His answer looked like an echo of your example. He never said he was using mysql, although he was asked which db several times. Rudy, I admire your patience. Dave On Jun 30, Rudy Lippan scribed: On Mon, 30 Jun 2003, [koi8-r] íÏÎÁÛ£× íÉÈÁÉÌ

Re: ORA-1036 on non-select prepare/execute

2003-07-01 Thread David N Murray
I think I understand what's happening, I'm just struggling to put it into words. What you are trying to do is use a placeholder for a value that is required at 'prepare' time, rather than 'execute' time. Maybe someone else can expound on the actual technical reasons for this. I have only seen

Re: writing errors to a file.

2003-07-01 Thread David N Murray
Not a DBI question, but what platform? Un*x: perl script.pl logfile 21 Windows: perl script.pl logfile 21 If you want errors to a different logfile, or output to come to the screen with errors to a logfile, perl script.pl 2error_log HTH, Dave p.s. BTW, that's quite a sig you have. On Jul

Re: ActiveState Awards

2003-06-12 Thread David N Murray
Remember, vote early and vote often. We'll have to work on ActiveState as to why Tim's at the bottom of the ballot. He should be first (alphabetically!) ;-) BTW: http://www.activestate.com/Corporate/ActiveAwards On Jun 12, [EMAIL PROTECTED] scribed: ...Has anybody mentioned that Tim is a

Re: Database layout and query questions...

2003-06-10 Thread David N Murray
Some questions, that might help you answer yours: What's the advantage of having a table per user, vs. a 'users' table with one row per user? How many rows do you envision in each user table, and what are their columns? If you are looking to create a per_user table that just contains 'key',

Re: How can I fetch column names?

2003-06-10 Thread David N Murray
Which database? It usually varies. On Jun 10, Anthony Nickolayev scribed: Greetings. Maybe the answer for my question will be RTFM, but i still cant find it myself. The problem is: i need to fetch just list, contains column names - and i dont know how to do it. I didnt find it in DBI manual

REJECTED MAIL (fwd)

2003-06-09 Thread David N Murray
Jun 2003 17:42:20 + Received: from localhost (127.0.0.1) by nazgul.jsbsystems.com with SMTP; Mon, 09 Jun 2003 17:42:20 + Date: Mon, 09 Jun 2003 13:42:20 -0400 (EDT) From: David N Murray [EMAIL PROTECTED] Subject: RE: Vague DBI Error In-reply-to: [EMAIL PROTECTED] X-X-Sender: [EMAIL

Re: How to upload binary in Mysql through DBI/Perl?

2003-05-30 Thread David N Murray
I haven't played with file uploads in awhile, but it seems to me that the easiest way would be to upload the binary as a file, then read the file and store it into the BLOB column, deleting the file when done. Are you actually collecting the binary data off the form, as an INPUT item, or will the

Re: query (urgent)

2003-05-30 Thread David N Murray
My initial reaction is to say RTFM, but since this is so urgent, that's probably not an option. The error you seem to be reporting is a trivial one and is covered quite well in the MySQL documentation regarding security. If I were to be rude, I'd say 'use the correct password', or 'make sure you

Re: ERROR: ORA-03106: fatal two-task communication

2003-04-03 Thread David N Murray
Can post a sample of your connect statement? Searching Google Groups for ORA-03106 yields something about not using BEQ. I've only ever done TCP/IP connections, so the problem may be in your tnsnames.ora file. Can you connect from sqlplus on the same machine? Dave On Apr 2, rbamidip scribed:

Re: blob error need help

2003-02-17 Thread David N Murray
My silly, off-the-cuff guess is that you need DBD built using OCI8 libraries. Did you build DBD yourself, or download a package? Can you build it yourself (perl Makefile.PL; make; make test; make install)? If you are using Oracle 8, then you have the right libraries to do the build. It looks

Re: how to count rows or put output to array?

2003-01-28 Thread David N Murray
Of course, you can do it all with array references if your a glutton for punishment. I can never remember how and always have to look it up with working code. my $rs = $dbh-selectall_arrayref(select * from table); # count print count: $#$rs\n; # each row my $rr; foreach $rr (@$rs) { print

Re: spcifying ports for DBD::Oracle

2002-12-18 Thread David N Murray
Isn't it specified in your tnsnames.ora? I'm not familiar with a way to specify a port to sqlplus. I thought it just pulled it from tnsnames.ora. If you can connect using sqlplus as: $ sqlplus scott/tiger@test then I think $dbh = DBI-connect('dbi:Oracle:test','scott','tiger'); should work. The

Re: missing left parenthesis problem running DBD::Oracle

2002-12-17 Thread David N Murray
SQL select * from table device; select * from table device * ERROR at line 1: ORA-00906: missing left parenthesis SQL On Dec 17, Ford, Andy scribed: I'm getting an error running DBD::Oracle: DBD::Oracle::db do failed: ORA-00906: missing left parenthesis (DBD ERROR:

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 =

RE: Trying to get LIKE to work

2002-11-14 Thread David N Murray
Hmmm, I don't know if I agree with the %$date is a reference sentiment: $ cat t.pl $d = 7-Aug; print %$d%; print \n; $ perl t.pl %7-Aug% $ (I first did this with 'perl -e', bash needs too many backslashes to make it readable.) Now, if I try this, I find I can't get it to work: SQL desc t1 Name

Re: Error with crond

2002-11-14 Thread David N Murray
My experience with cron on Solaris is that your .profile is not run before the script is executed. It looks like your environment may not be setup properly (I'm assuming the script works when you run it interactively as root). HTH, Dave On Nov 14, [EMAIL PROTECTED] scribed: Hello I want to

Re: (Fwd) oracle question

2002-10-30 Thread David N Murray
Some good points in my experience with DBI, perl, Oracle, Apache: 1) Tim fixes things faster than my hold time on the phone with commercial vendors :-) Seriously, security related fixes to OSS are RELEASED orders of magnitude faster than commercial vendors. 2) Oracle and Solaris aren't open

RE: Hiding the db password

2002-10-22 Thread David N Murray
Pardon my jumping in here, but I believe the answer to your question is Yes. On another track, is OS authentication an option for the DB you are using? No password is required if OS authentication is used. The OS does the authentication and the DB just asks the OS. Works pretty well for SQL

Re: error while installing DBI

2002-09-02 Thread David N Murray
I don't think DBI is available in PPD format. You need to CPAN or do it by hand (download the package and its dependencies, gzip -d, tar, perl Makefile.pl, make, make tests, make install). I've had mixed success with CPAN on Windows. HTH, Dave On Sep 2, MURUGAN V V scribed: Hi, When I try

Re: suprressing login incorrect error

2002-08-20 Thread David N Murray
Any luck with RaiseError=0,PrintError=0? That seems to work for me. On Aug 19, Levine, Peter W scribed: Hi, I'm using DBI in a cgi-bin script. I can't find a way to suppress the error message DB-Library: Login incorrect if DBI-connect fails. This is an issue because the raw output causes

RE: Backing up a table. Any ideas, tips?

2002-07-25 Thread David N Murray
Enterprise Manager has the ability to export the schema. You would then have to convert it to whatever db you are going to implement. On Jul 25, Brad Fike scribed: I'm using MS SQL in my test environment but the production environment could be just about anything -Original

RE: best way to insert date/time into oracle table

2002-06-14 Thread David N Murray
Why not just put it as a constraint on the table to supply a default value of SYSDATE for the column? Then you don't have to deal with it from the program side at all. On Jun 14, Kipp, James scribed: THANKS! I just found that out the hardway :) Thanks all for your help. SYSDATE is the best

Re: DBD::Oracle problem

2002-05-01 Thread David N Murray
Put the oracle directory where libclntsh.so is located in the LD_LIBRARY_PATH. hth, Dave On May 1, Eric Ngantchjon scribed: How can I solve the problem below ? Can't load '/usr/local/lib/perl5/site_perl/5.6.1/sun4-solaris/auto/DBD/Oracle/Oracle..so' for module DBD::Oracle: ld.so.1:

Re: Oracle version of Informix DBD_INFORMIX_RELOCATABLE_INFORMIXDIRenv variable

2002-04-24 Thread David N Murray
I think ORACLE_HOME may be what your looking for. Mine's set to /opt/oracle/product/8.1.7. HTH, Dave On Apr 24, Mahdi A. Sbeih scribed: Hi all, Is there a variable for Oracle like the one used before installing DBD-Informix in case of relocatable INFORMIXDIR or in oracle this is

RE: problem in install DBI in solaris 2.8

2002-04-17 Thread David N Murray
Also, you may want to remove/rename the /usr/ucb/cc file and make sure gcc is in your path. I ran into this when trying my first compile of any GNU tools. Sun `thoughtfully' installs a `cc' command that says that C isn't installed. Get rid of it if you are only using GCC. Dave On Apr 17,

Re: report formatting

2002-04-17 Thread David N Murray
If I remember my Perl history correctly, report formatting was one of Larry's motivations for writing Perl. I'm not being facetious when I say use Perl to format reports. Any decent Perl book (like the one with the Camel on it, Chapter 2 in my copy) will show you how to write reports. Use DBI