Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

DBI ODBC CGI Access hangs on execution of select statement

by buttroast (Scribe)
on Apr 14, 2003 at 00:28 UTC ( [id://250180]=perlquestion: print w/replies, xml ) Need Help??

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

I have a working script that accesses records in an Access database via DBI ODBC. It searches last names in a genealogy database (obituary index), and when I enter last names with 2 or more characters, everything is fine. When I try to search for just one letter (to see every name that starts with that letter), my browser hangs (sending request to localhost), and it leaves temporary jet files in my cgi-bin. I think the problem started when I accidentally ran the script while I had the database open through Access. Now there is an Access lock file that I can't seem to get rid of. My select statement selects records where the last name is like '_______%'. If you need more information, let me know. - buttroast
  • Comment on DBI ODBC CGI Access hangs on execution of select statement

Replies are listed 'Best First'.
Re: DBI ODBC CGI Access hangs on execution of select statement
by tachyon (Chancellor) on Apr 14, 2003 at 01:14 UTC

    Debug stagewise. If you think the DB is corrupt then why don't you just... Open the database in Microsoft Access, click on the 'Tools' menu and select 'Database Utilities -> Compact and Repair Database'. That will do the repair (if needed) for you.

    Next see if you can do a SELECT * from table WHERE lastname LIKE 'A%' directly in Access. This should show you all the lastname A's in your table. If this works then try it with DBI and see if it flies.

    If it still does not work then details of you code would be useful. Are you checking return values for instance? Is it a simple time out issue due to a huge return of names? Have you added some print's so you know exactly which line of code is causing the hang?

    use CGI; use DBI; my $q = new CGI; my $debug = 1; $debug && print $q->header; $debug && print '<pre>'; $debug && print "connecting.....\n"; my $dbh = DBI->connect(.....); $debug && print "connected\n"; # yada yada

    What files are left in your cgi-bin. Where is the DB located. What version of Access, DBI, DBD-OBCD, Perl, Apache. yada yada

    There are not a lot of good resons to use a DB as pedestrian as M$ Access for anything serious IMHO. Have you considered using something (almost anything) else? There is a good port of MySQL for Win32 for desktop use and this DB is also proven to work well on the web. Access is not M$ flagship product, SQL Server is so Access is effectively the Windows XP Home of databases. Actually probably the WinME or Win3.0 would be more accurate.

    cheers

    tachyon

    s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

      I'm only using Access because I don't know how to use MySQL yet. I think I will try to backup the db and just delete the original...my db is in a general folder one level above my cgi-bin folder. Does it need to be somewhere specific?

        I'm only using Access because I don't know how to use MySQL yet.

        Concepts are all the same. GUI Interface is of course different. You also have a command line interface which is good if you come from *nix but may be very unfaliliar if you were weaned on drag and drool.

        I think I will try to backup the db and just delete the original...

        Why? Just repair it. Make a copy first of course just to be safe. We have all had the M$ hanging data loss blues (BSOD) at one stage of another.

        my db is in a general folder one level above my cgi-bin folder. Does it need to be somewhere specific?

        Not really provided you can connect to it. Just wanted to clarify that it is on localhost and therefore there are no network issues involved. The only real issue is that you don't want it under your HTTP root in a world readable directory assuming that this is a commercial widget and you don't want just anybody walking off with your data. Plus all the usual security stuff.

        cheers

        tachyon

        s&&rsenoyhcatreve&&&s&n.+t&"$'$`$\"$\&"&ee&&y&srve&&d&&print

        I'll post my code later tonight...I'm not at home right now.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://250180]
Approved by Aristotle
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2024-04-19 13:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found