beldon on 26 Jan 2004 19:46:02 -0000


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

[PLUG] Perl/MySQL conundrum


I am working on a Perl script which takes Windows event logs, parses them, and puts the information into a MySQL database.  The Perl script runs on Windows and the MySQL database is on a SuSE Linux box, and I'm using an ODBC connection to the MySQL database.  I've defined all of the fields I need and have evrything working...except one thing.

One of the fields is a Text field in MySQL.  I keep getting an error because of the odd characters in the free-form text.  I have tried everything I could personally think of (like going through each line one character at a time to scrub out the offending characters), as well as the Perl cookbook solution which goes like this:

     $msgstr =~ s/([\'\"])/\\$1/g;

All to no avail.  What I get is:

Error: [1064] [2] [0] "[TCX][MyODBC]You have an error in your SQL syntax.  Check the manual that corresponds to your MySQL server version for the right syntax to use near '' SWID=20040124230026169EGLDAT02PID3984TID4820 - EGLDAT02, 1936"

For the record, here is what I'm trying to insert into the Text field specific to the above error, but it could be just about anything:

SWID=20040124230026169EGLDAT02PID3984TID4820 - EGLDAT02, 1936(c4c), 2004/01/24 23:00:46.293; Error: 0, Generic; Process ID: 1936; Thread: 3148; Host: EGLDAT02; Text: Unknown error while executing report d:\program files\cognos\cer2\published reports\ACSC Reports - Architect\apps\Master Gaming Report (Summary by Game).imr.; BackTrace Info:  1. File Name: Y:\src\iwr\IWR\Dispatchers\irsdispatchers\irsinstance.cpp; Line#:1180; Desc.:Unknown error while executing report d:\program files\cognos\cer2\published reports\ACSC Reports - Architect\apps\Master Gaming Report (Summary by Game).imr.;

Any help would be much appreciated.

     -Beldon


___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug