CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: DBI:
Error importing data



Aug 17, 2006, 9:12 AM

Post #1 of 2 (5718 views)
Error importing data Can't Post

Hi Guys

Wrote a script which connects to MYSQL and uploads windows eventlog data from a csv file to a database called loganalysis. This seems to work fine until i come across this character ' in the 9th column (Description). As soon as i come across this character the perl script fails.

the line it fails on is as follows

SYS,08/08/2006,11:39:45,KDC,20,Warning,None,,Servername,The currently selected KDC certificate was once valid but now is invalid and no suitable replacement was found. Smartcard logon may not function correctly if this problem is not remedied. Have the system administrator check on the state of the domain's public key infrastructure. The chain status is in the error data.

#!/usr/bin/perl -w

use strict;
use DBI;

my $outsys = "*";

#Upload data to mysql

my $dsn = "DBI:mysql:loganalysis:";
my $user = '*';
my $password = '*';
my $conn = DBI->connect($dsn,$user,$password) || die "Cannot Connect to Database Server, Reason: " . DBI->errstr;

#Upload Security logs
open(SYS, $outsys);
my @sys = <SYS>;
foreach (@sys) {
my @columes = split(/,/);
my $Description = $columes[9];
$conn->do("INSERT INTO NTSystemLogs(Description)
VALUES(\'$Description\')") || die " Error importing: " . $conn->errstr

close SYS;


Error importing: You have an error in your SQL syntax; check the manual that corresponds to your My
SQL server version for the right syntax to use near 's public key infrastructure. The chain status
is in the error data.

Please note that all the columes before comming across this line import without any problem

Any help on avoiding this would be appreciated


Aug 17, 2006, 11:21 AM

Post #2 of 2 (5717 views)
Re: [fatmando] Error importing data [In reply to] Can't Post

see your other thread


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives