Problems using the DBI class to access CSV files.



I've been using the DBI class for a while now & I'm trying to port some code from a Windows environment where it is working perfectly to a Unix environment where it's not really working. I've also reviewed the Perl DBI book again & see nothing about this type of problem. It seems that it's just the CSV type of database that is having issues.

I'm trying to parse pipe separated log files to search for data so that actions can be taken based on what I find in the log files.

A sample log file:

TIME|Status|Description|
17:15:51|OK|No Problems|
17:31:12|Warning|Skipped file abc|
18:45:03|ERROR|Can't read file xyz|

Afraid that it might be a bug in my code, I began using "dbish" to test out my queries. But I get the same problems as in my code. I find all 3 rows in Windows, but I always find Zero rows on the Unix platforms.

On Windows:
M:\...\logs>dbish
DBI::Shell 11.91 using DBI 1.49

WARNING: The DBI::Shell interface and functionality are
======= very likely to change in subsequent versions!

Available DBI drivers:
1: dbi:CSV
2: dbi:DBM
3: dbi:ExampleP
4: dbi:File
5: dbi:ODBC
6: dbi:Proxy
7: dbi:Sponge
Enter driver name or number, or full 'dbi:...:...' DSN: DBI:CSV:csv_sep_char=|

Connecting to 'DBI:CSV:csv_sep_char=|' as ''...
@> select * from RMSComprate.060707.log.txt
@> ;
TIME,Status,Description,
'17:15:51','OK','No Problems'.''
'17:31:12','Warning','Skipped file abc',''
'18:45:03','ERROR','Can't read file xyz',''

[3 rows of 4 fields returned]
@>

But if I attempt to do the same thing against AIX Unix, I get
heisys@het-web1:/.../logs> dbish
DBI::Shell 11.93 using DBI 1.52

WARNING: The DBI::Shell interface and functionality are
======= very likely to change in subsequent versions!

Available DBI drivers:
1: dbi:CSV
2: dbi:DBM
3: dbi:ExampleP
4: dbi:File
5: dbi:Multiplex
6: dbi:Oracle
7: dbi:Proxy
8: dbi:Sponge
Enter driver name or number, or full 'dbi:...:...' DSN: DBI:CSV:csv_sep_char=|

Connecting to 'DBI:CSV:csv_sep_char=|' as ''...
@> select * from test.log
@> ;
TIME,Status,Description,

[0 rows of 4 fields returned]

Can anyone offer suggestions?

Curtis Leach
Programmer Analyst
Harrah's Entertainment, Inc. - RMS I&AS
Phone: (901) 537-3453
Cell: (901) 573-7973




Relevant Pages

  • Re: How to remove a single line from a flat file
    ... process writing to the log files. ... But the fact that if you want to edit the syslog file you have to turn off syslog, that tells me you're missing something in the kernel. ... the reason you only have a few programs that take advantage of such functionality is that such functionality is so difficult to take advantage of. ...
    (comp.lang.tcl)
  • Unexpected EOF from server PlClient.pm line 79.
    ... WARNING: The DBI::Shell interface and functionality are ... Available DBI drivers: ... DSN: ...
    (perl.dbi.users)
  • %PIX-4-106023 messages in log
    ... We are getting quite a few of these messages in our log files that have ... a destination of the outside interface of the Pix. ...
    (comp.dcom.sys.cisco)
  • Where can I find the log files for RRAS Basic Firewall?
    ... Anyone knowing where can i find log files for the 'Static Filters' provided ... for each interface or how to configure logging for it. ...
    (microsoft.public.win2000.ras_routing)