FAQ
Hi all,
I have a script about query record from MS Access database.
This database contains a table named Lengths.
The list of field names is Sample_ID, Taxon_ID, Lenght.

Question is coming:
1. When I use the query command: select * from Lengths
It works well!
2. When I use the query command: select * from Lengths where Taxon_ID
=1
It gives the following:
18-1-16
23-1-17
23-1-15
23-1-14
24-1-15
Segmentation fault
3. When I use the query command: select * from Lengths where
Sample_ID = 1
The result is :
[hxu@fleetlink msaccess]$ perl test.pl
Segmentation fault

Does anyone meet this problem?
My code is like this:
my $dbh = DBI-> connect( "dbi:ODBC:DSN=mdb1") or die "$DBI::errstr";
my $query = "select * from Lengths";

my $tp=$dbh->prepare("select * from Lengths where Sample_ID = 1") or
die "cna nont $dbh->err $dbh->errstr \n";
$tp->execute();

#print $tp;

while (my @tmp_l=$tp->fetchrow_array())
{ print join('-',@tmp_l),"\n";}

The operating system is Red Hat Enterprise 3.
Perl : v5.8.3 built for i386-linux-thread-multi
ODBC: unixODBC 2.2.12
DBD::ODBC: 1.14

Best Regards,
Xu

Search Discussions

  • Martin Evans at Oct 5, 2007 at 8:00 am

    nickyxu1981@gmail.com wrote:
    Hi all,
    I have a script about query record from MS Access database.
    This database contains a table named Lengths.
    The list of field names is Sample_ID, Taxon_ID, Lenght.

    Question is coming:
    1. When I use the query command: select * from Lengths
    It works well!
    2. When I use the query command: select * from Lengths where Taxon_ID
    =1
    It gives the following:
    18-1-16
    23-1-17
    23-1-15
    23-1-14
    24-1-15
    Segmentation fault
    3. When I use the query command: select * from Lengths where
    Sample_ID = 1
    The result is :
    [hxu@fleetlink msaccess]$ perl test.pl
    Segmentation fault

    Does anyone meet this problem?
    My code is like this:
    my $dbh = DBI-> connect( "dbi:ODBC:DSN=mdb1") or die "$DBI::errstr";
    my $query = "select * from Lengths";

    my $tp=$dbh->prepare("select * from Lengths where Sample_ID = 1") or
    die "cna nont $dbh->err $dbh->errstr \n";
    $tp->execute();

    #print $tp;

    while (my @tmp_l=$tp->fetchrow_array())
    { print join('-',@tmp_l),"\n";}

    The operating system is Red Hat Enterprise 3.
    Perl : v5.8.3 built for i386-linux-thread-multi
    ODBC: unixODBC 2.2.12
    DBD::ODBC: 1.14

    Best Regards,
    Xu
    You don't mention which driver you are using. Is it by any chance the
    one in mdbtools? If it is then this project does not seem to have been
    updated since 2004-06-18 and I see a number of problems reported like yours.

    If you are not using mdbtools what driver are you using?

    Why not run perl under a debugger to see where the segmentation fault is
    occurring e.g. gdb /usr/bin/perl myscript.pl, then run and you should
    get a stack dump hopefully showing where the problem is.

    If you want to access a MS Access database from Linux and can put the
    access database on a Windows machine there are a number of other
    alternatives to mdbtools which are a lot more mature/reliable using
    Microsoft's own ODBC driver including using DBI Proxy or an ODBC-ODBC
    Bridge.

    Martin
    --
    Martin J. Evans
    Easysoft Limited
    http://www.easysoft.com

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupdbi-users @
categoriesperl
postedOct 4, '07 at 1:09p
activeOct 5, '07 at 8:00a
posts2
users2
websitedbi.perl.org

2 users in discussion

Nickyxu1981: 1 post Martin Evans: 1 post

People

Translate

site design / logo © 2022 Grokbase