ajay_perl has asked for the wisdom of the Perl Monks concerning the following question:

Hi! I'm connecting to foxpro database like this:

$dsnado = "DBI:ADO:Provider=vfpoledb;DSN=FoxPro;";<br /> $dbhfox = DBI->connect ($dsnado, '', '');<br />


Then execute this sql query:

$q="SELECT order_bill_n, srok_date FROM orders WHERE ALLTRIM(UPPER(ord +er_bill_n)) LIKE '%23-B%' order by order_bill_n desc ";<br /> $sthfox=$dbhfox->prepare($q) or die "Can't prepare statement: $DBI::er +rstr";<br /> $sthfox->execute() or die "Can't execute statement: $DBI::errstr";<br +/><br />
But having this error:

Can't execute statement: Can't Open Recordset for SELECT order_bill_n, srok_date FROM orders WHERE ALLTRIM(UPPER(order_bill_n)) LIKE '%23-В%' order by order_bill_n desc

Package : DBD::ADO::st
Filename : D:/usr/local/bin/perl/site/lib/DBD/ADO.pm
Line : 1137
Last error : -2147467259

Don't understand, what's can be?

Replies are listed 'Best First'.
Re: Perl OLE DB foxpro
by marto (Cardinal) on Apr 08, 2011 at 10:04 UTC

    The DBD::ADO documentation states:

    "Changing the CursorType is a solution to the following problem:"

    Can't execute statement 'select * from authors': Lasterror : -2147467259 ....

    Perhaps worth testing.

      Use cursor type like this

      $q="SELECT order_bill_n, srok_date FROM orders WHERE ALLTRIM(UPPER(ord +er_bill_n)) LIKE '%22134%' order by order_bill_n desc "; $sthfox=$dbhfox->prepare($q, { ado_cursortype => 'adOpenForwardOnl +y' }) or die "Can't prepare statement: $DBI::errstr"; $sthfox->execute() or die "Can't execute statement: $DBI::errstr";

      Error changed:

      OLE exception from "Microsoft OLE DB Provider for Visual FoxPro":\r [error] \r [error] Unable to create temporary work files.\r [error] \r Win32::OLE(0.1704) error 0x80004005: "Unspecified error"\r in METHOD/PROPERTYGET "Open" at D:/usr/local/bin/perl/site/lib/DBD/ADO +.pm line 1136\r DBD::ADO::st execute failed: Can't Open Recordset for 'SELECT order_bi +ll_n, srok_date FROM orders WHERE ALLTRIM(UPPER(order_bill_n)) LIKE ' +%22134%' order by order_bill_n desc '\r
        [error] Unable to create temporary work files.

        It looks as though you don't have write access to where the driver is trying to write these temp files. This could be TMP or TEMP on Windows, or somewhere else depending how foxpro works (I've no idea, I've never used it). I'd check the eventlog to see if there is anything related to this, or see if one of the sysinternals tools may be able to help you find out what's going on. Perhaps reading some of the google search results will provide an answer.

Re: Perl OLE DB foxpro
by Anonymous Monk on Apr 08, 2011 at 09:45 UTC
    Add DBI->trace(1)
Re: Perl OLE DB foxpro
by InfiniteSilence (Curate) on Apr 08, 2011 at 14:55 UTC
    Pls remember to use <code> tags in your posts.

    Celebrate Intellectual Diversity