--- Jeff Urlwin <[EMAIL PROTECTED]> wrote: > Actually, it would also help if you sent me a trace file of what's going > on. >
i've attached a zip containing four text files. note i get different
errors when running the same script on win2k and win2k server. i'm not
sure why... system dsn are configured the same, both are running dbi 1.34
and odbc 1.04.
>
> One way is to put the following line right before the connect:
> DBI->trace(9, "dbitrace.txt");
>
> Jeff
>
> >
> > here's a sample piece that works when i don't include "use eggsupp;"
> >
> > hope this helps.
> >
> > #!perl.exe -w
> >
> > use DBI;
> > use strict;
> >
> > ##############################################################
> > ###################
> > #
> > #
> > # THIS SCRIPT EXECUTES A QUERY THAT RETURNS PAYOR,
> > CUSTOMER, AND FILE. #
> > # A FEW STATES ARE THEN FILTERED OUT, AND THE RESULTS ARE
> > THEN PRINTED #
> > # TO A TEXT FILE
> > #
> > #
> > #
> > ##############################################################
> > ###################
> >
> > ##### my's
> >
> > my ($dbh, $sth);
> >
> > ##### open file
> >
> > my $file = "c:\\data\\recent_claim_data2.txt";
> > open (TEXT, ">$file") || die "Can't Open $file: $!\n";
> >
> > ######## open db
> >
> > my $dbname = 'eggpayorteam';
> > my $user = 'Alala';
> > my $passwd = 'Plala';
> >
> > # connect to database
> >
> > $dbh = DBI->connect("dbi:ODBC:$dbname", $user, $passwd) or
> > die $dbh->errstr;
> >
> > # set data size and ok to truncate
> >
> > $dbh->{LongReadLen} = 10000;
> > $dbh->{LongTruncOk} = 1;
> >
> > ### Query
> >
> >
> > my $sql = "
> > use eggsupp;
> > select *
> > from filesupp
> > where owner like 'Adam%'
> > ";
> >
> > $sth = $dbh->prepare($sql);
> > $sth->execute();
> >
> >
> > while(my @now = $sth->fetchrow_array)
> > {
> > my $payor = $now[0];
> > my $cust = $now[1];
> > my $lfd = $now[2];
> >
> > print "$payor\t$cust\t$lfd\n";
> > print TEXT "$payor, $cust, $lfd\n";
> > }
> >
> > ######### disconnect
> >
> > $sth->finish;
> > $dbh->disconnect;
> >
> > ###### close file
> >
> > close(TEXT) || die "can't close $file: $!\n";
> >
> >
> > ------------
> >
> > error when "use eggsupp;" :
> >
> > DBD::ODBC::st execute failed: [Microsoft][ODBC SQL Server
> > Driver]Invalid cursor state (SQL-24000)(DBD:
> > dbd_describe/SQLNumResultCols err=-1) at C:\perl\scripts\
> > simple.pl line 49. DBD::ODBC::st fetchrow_array failed: (DBD:
> > no select statement currently executi ng err=-1) at
> > C:\perl\scripts\simple.pl line 52.
> >
> >
> > --- Jeff Urlwin <[EMAIL PROTECTED]> wrote:
> > > >
> > > >
> > > > Strangely enough, splitting the request into 2, first is Use
> > > > db and second is whatever else still seems to work. Not sure
> > >
> > > If someone can send me a small example of this not working
> > under the
> > > latest DBD::ODBC, I'll be happy to look at it. Preferrably
> > something
> > > generic that
> > > can be run on any SQL Server instance. Use "use" with a standard
> > > databse if
> > > possible.
> > >
> > > > why. Also, problem seems to be confined to scripts run for
> > > > the DOS prompt. CGI scripts we have still work fine.
> > >
> > > This doesn't make sense, though. There is NO reason that a
> > CGI script
> > > would be different than the command prompt unless:
> > > a) the actual connection from the CGI script is different (i.e
> > > connecting as IUSR_xxx instead of your user)
> > > or
> > > b) the CGI script is pointing to a different perl than the one
> > > running from the command line.
> > >
> > > >
> > > > As far as a workaround, my answer would be go back a couple
> > > > of versions of the ODBC package. It used to work. If you
> > > > know where I can get older versions, please let me know.
> > >
> > > CPAN and building from the source can get you older versions.
> > >
> > > I put a lot of work in getting multiple statements to work and it
> > > should work better now than before. If, however, it
> > doesn't, please
> > > send me samples...
> > >
> > > One of the largest differences between 0.28 and 1.0x is
> > that DBD::ODBC
> > > now acts as an ODBC 3.x application rather than ODBC 2.x.
> > Some things
> > > seem more
> > > "picky" with SQL Server's ODBC driver this way.
> > >
> > > Jeff
> > >
> > > >
> > > > Thanks
> > > >
> > > > E. Scott Stricker - NGIT @ Smartlink
> > > > ----- Original Message -----
> > > > From: "Adam Peterson" <[EMAIL PROTECTED]>
> > > > To: "E. Scott Stricker" <[EMAIL PROTECTED]>;
> > > > <[EMAIL PROTECTED]>
> > > > Sent: Thursday, March 27, 2003 8:55 AM
> > > > Subject: Re: DBD-ODBC Strange Behavior?
> > > >
> > > >
> > > > > is there anyway to get around this? this could case a lot
> > > > of problems
> > > > > if someone by mistake switched the default database on the
> > > > system dsn
> > > > > name!
> > > > >
> > > > >
> > > > >
> > > > >
> > > > > --- "E. Scott Stricker" <[EMAIL PROTECTED]> wrote:
> > > > > > Getting the same thing with the newer versions of
> > DBD-ODBC. The
> > > > > > generic behavior is that the software no longer seems
> > to support
> > > > > > batches. We've had the same problem with any sql statement
> > > > > > containing multiple sql commands (in
> > > > > > this case USE is the first and SELECT is the second).
> > > > Used to work with
> > > > > > older software.
> > > > > >
> > > > > > E. Scott Stricker - NGIT @ Smartlink
> > > > > > ----- Original Message -----
> > > > > > From: "Adam Peterson" <[EMAIL PROTECTED]>
> > > > > > To: <[EMAIL PROTECTED]>
> > > > > > Sent: Wednesday, March 26, 2003 4:59 PM
> > > > > > Subject: DBD-ODBC Strange Behavior?
> > > > > >
> > > > > >
> > > > > > > hello,
> > > > > > >
> > > > > > > i'm running my script on a win2000 box called
> > > > eggpayorteam. i have
> > > > > > > established a ODBC system DSN name of "eggpayorteam"
> > > > and have set
> > > > > > > the default database to "eggsupp". when i run my
> > > > queries below i
> > > > > > > get
> > > > > > errors,
> > > > > > > noted further below. when i remove "use eggsupp" it
> > > > runs fine. is
> > > > > > > this strange behavior? and why is this happening?
> > > > > > >
> > > > > > > sth = $dbh->prepare("
> > > > > > > use eggsupp
> > > > > > > select count(fileid) as number from filesupp fs
> > > > > > > where datecreated >= '$past' and datecreated <= '$today' ");
> > > > > > >
> > > > > > > $sth->execute;
> > > > > > >
> > > > > > > while( my @data = $sth->fetchrow_array)
> > > > > > > {
> > > > > > > $total_num = $data[0];
> > > > > > > print "$total_num\n\n\n";
> > > > > > > }
> > > > > > >
> > > > > > > ###### query 2#
> > > > > > >
> > > > > > > $sth = $dbh->prepare("
> > > > > > > use eggsupp
> > > > > > > select count(fileid), crashtypedescr
> > > > > > > from filesupp fs join crashtype ct on fs.crashtype =
> > > > > > > ct.crashtypeid where crashtype <> '' and datecreated
> > > > >= '$past'
> > > > > > > and datecreated <= '$today' group by
> > crashtype,crashtypedescr
> > > > > > > ");
> > > > > > >
> > > > > > > $sth->execute;
> > > > > > >
> > > > > > > ---------------------
> > > > > > >
> > > > > > >
> > > > > > > DBD::ODBC::st execute failed: [Microsoft][ODBC SQL Server
> > > > > > Driver]Invalid
> > > > > > > cursor
> > > > > > > state (SQL-24000)(DBD:
> > dbd_describe/SQLNumResultCols err=-1)
> > > > > > > at
> > > > > > > C:\perl\scripts\ crash_pie.pl line 59.
> > > > > > > DBD::ODBC::st fetchrow_array failed: (DBD: no
> > select statement
> > > > > > currently
> > > > > > > executi
> > > > > > > ng err=-1) at C:\perl\scripts\crash_pie.pl line 61.
> > > > DBD::ODBC::st
> > > > > > > execute failed: [Microsoft][ODBC SQL Server
> > > > > > Driver]Invalid
> > > > > > > cursor
> > > > > > > state (SQL-24000)(DBD:
> > dbd_describe/SQLNumResultCols err=-1)
> > > > > > > at
> > > > > > > C:\perl\scripts\ crash_pie.pl line 77.
> > > > > > > DBD::ODBC::st fetchrow_array failed: (DBD: no
> > select statement
> > > > > > currently
> > > > > > > executi
> > > > > > > ng err=-1) at C:\perl\scripts\crash_pie.pl line 79.
> > > > > > >
> > > > > > > __________________________________________________
> > > > > > > Do you Yahoo!?
> > > > > > > Yahoo! Platinum - Watch CBS' NCAA March Madness,
> > live on your
> > > > > > > desktop! http://platinum.yahoo.com
> > > > > >
> > > > >
> > > > >
> > > > > __________________________________________________
> > > > > Do you Yahoo!?
> > > > > Yahoo! Platinum - Watch CBS' NCAA March Madness, live on
> > > > your desktop!
> > > > > http://platinum.yahoo.com
> > > >
> > > >
> > >
> > >
> >
> >
> > __________________________________________________
> > Do you Yahoo!?
> > Yahoo! Tax Center - File online, calculators, forms, and more
> http://platinum.yahoo.com
>
>
__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - File online, calculators, forms, and more
http://platinum.yahoo.com
dbitrace.zip
Description: dbitrace.zip
