I need to query a foxpro database (3rd party software).

In the past I have had no success with DBD::ODBC accessing foxpro
databases (causes an application error).  So I used DBD::ADO instead. 
However, with the latest DBD::ADO (2.5) the script dies during connect().

Here's the snippet I'm using to connect: 

DBI->trace(1);
my $dsn = qq(Driver={Microsoft Visual FoxPro Driver};
SourceType=DBF;SourceDB=$dir);

my $attr = {
        PrintError=>0, 
        RaiseError=>1, 
        LongTruncOk=>1, 
        ChopBlanks=>1
};

my $dbh = DBI->connect("dbi:ADO:$dsn", '', '', $attr);

Below are the traces using DBD::ADO and DBD::ODBC - the DBD::ADO error
looks like a problem with autocommit.

--
  Simon Oliver

TRACE using DBD::ADO:
    DBI 1.28-nothread dispatch trace level set to 1
    -> DBI->connect(dbi:ADO:Driver={Microsoft Visual FoxPro
Driver};SourceType=D
BF;SourceDB=\\FS1\PCOUNTER\DATA, , ****, HASH(0x1abef9c))
    -> DBI->install_driver(ADO) for MSWin32 perl=5.006001 pid=2748 ruid=0
euid=0

       install_driver: DBD::ADO version 2.5 loaded from
C:/Perl/site/lib/DBD/ADO
..pm
    <- install_driver= DBI::dr=HASH(0x1cbc38c)
->ADO Connection: ->> Open ADO connection using Driver={Microsoft Visual
FoxPro
Driver};SourceType=DBF;SourceDB=\\FS1\PCOUNTER\DATA
->> Transaction support: 1 Transactions can only contain Data Manipulation
(DML)
 statements.  DDL statements within a trnsaction cause an error.
    <- connect('Driver={Microsoft Visual FoxPro
Driver};SourceType=DBF;SourceDB=
\\FS1\PCOUNTER\DATA' '' ...)= DBI::db=HASH(0x2b40204) at DBI.pm line 490
    <- STORE('RaiseError' 1)= 1 at DBI.pm line 532
    <- STORE('PrintError' 0)= 1 at DBI.pm line 532
1   <- FETCH('AutoCommit')= 1 ('AutoCommit' from cache) at ADO.pm line
1661
    <- STORE('AutoCommit' 1)= 1 at DBI.pm line 532
1   <- FETCH('Warn')= 0 ('Warn' from cache) at ADO.pm line 1645
    !! ERROR: -2147352569 undef
    <- STORE('ChopBlanks' 1)= 1 at DBI.pm line 535
DBD::ADO::db STORE failed:  at C:/Perl/site/lib/DBI.pm line 535.
Connection open, destroy at credit.pl line 0
<- State: (1)
<- modified connection Attributes 0
<- AutoCommit -> 1  Provider Support -> 1 Comments -> Transactions can
only cont
ain Data Manipulation (DML) statements.  DDL statements within a
trnsaction caus
e an error.
    <- DESTROY= undef
    <- disconnect_all= undef at DBI.pm line 552
    <- DESTROY= '' during global destruction

TRACE using DBD::ODBC:
    DBI 1.28-nothread dispatch trace level set to 1
    -> DBI->connect(dbi:ODBC:Driver={Microsoft Visual FoxPro
Driver};SourceType=
DBF;SourceDB=\\FS1\PCOUNTER\DATA, , ****, HASH(0x1abef9c))
    -> DBI->install_driver(ODBC) for MSWin32 perl=5.006001 pid=2692 ruid=0
euid=
0
       install_driver: DBD::ODBC version 0.41 loaded from
C:/Perl/site/lib/DBD/O
DBC.pm
    <- install_driver= DBI::dr=HASH(0x1cbc38c)
    <- connect('Driver={Microsoft Visual FoxPro
Driver};SourceType=DBF;SourceDB=
\\FS1\PCOUNTER\DATA' '' ...)= DBI::db=HASH(0x1c388e8) at DBI.pm line 490
    <- STORE('RaiseError' 1)= 1 at DBI.pm line 532
    <- STORE('PrintError' 0)= 1 at DBI.pm line 532
    <- STORE('AutoCommit' 1)= 1 at DBI.pm line 532
    <- STORE('ChopBlanks' 1)= 1 at DBI.pm line 535
    <- STORE('LongTruncOk' 1)= 1 at DBI.pm line 535
    <- connect= DBI::db=HASH(0x1c388e8)
    <- prepare('SELECT id, balance FROM UMIST-BI')=
DBI::st=HASH(0x1c38900) at c
redit.pl line 40
    !! ERROR: -1 '[Microsoft][ODBC Driver Manager] Program type out of
range (SQ
L-S1003)(DBD: describe/SQLBindCol err=-1)'
    <- execute= undef
D:\PCOUNTER>perl -MDBD::ADO -e"print $DBD::ADO::VERSION"
2.5

Reply via email to