I am sorry that not showing u a detail at least, about my text file...Here is te 
sample of my text file...

===========================================================================

"1.200.200.202.157 2.200.200.250.7 3.0 4.255 5.8 6.1109 7.0 8.0 9.1095648052.771 
10.1095648052.979 11.1417 12.445     13.27 14.6 15.0 16.0 17.0 18.0 19. 20.0 21.0 22.0 
23.119000    24.0 25.0 26.0 27.32"
"1.200.200.202.157 2.200.200.250.7 3.0 4.255 5.2 6.92 7.0 8.0 9.1095648052.770 
10.1095648052.771 11.1413 12.445     13.17 14.6 15.0 16.0 17.0 18.0 19. 20.0 21.0 22.0 
23.0    24.0 25.0 26.0 27.0"
"1.200.200.245.239 2.200.200.255.255 3.0 4.255 5.6 6.468 7.0 8.0 9.1095648052.402 
10.1095648052.847 11.137 12.137     13.0 14.17 15.0 16.0 17.0 18.0 19. 20.0 21.0 22.0 
23.0    24.0 25.0 26.0 27.32"
"1.200.200.101.1 2.200.200.255.255 3.0 4.255 5.1 6.243 7.0 8.0 9.1095648061.059 
10.1095648061.059 11.138 12.138     13.0 14.17 15.0 16.0 17.0 18.0 19. 20.0 21.0 22.0 
23.0    24.0 25.0 26.0 27.32"
"1.200.200.100.97 2.200.200.255.255 3.0 4.255 5.3 6.234 7.0 8.0 9.1095648053.622 
10.1095648055.122 11.137 12.137     13.0 14.17 15.0 16.0 17.0 18.0 19. 20.0 21.0 22.0 
23.0    24.0 25.0 26.0 27.32"

==================================================================

But there is no problem about the data i think..And sorry because i am not customize 
it first...:)....The big matter is how can i import a text file into mysql...I just 
wrote some code ...Here is my code...

========================================================

#!/usr/bin/perl

use DBI;
use IO::Socket;
###########################
#import.pl
#Roime Bin Puniran
#Telekom RnD
###########################

$local = IO::Socket::INET->new(
                                Proto     => 'tcp',
                                LocalAddr => '*******************',
                                Reuse     => 1
                                ) or die "$!";
$local->listen();
$local->autoflush(1);

print "......Testing.......\n";
#my $addr;

while($addr=$local->accept())
        {
        print"Connect From : ", $addr->peerhost();
        #Display Message
        print "Port : ", $addr->peerport(), "\n";

        my $dbh=DBI->connect('dbi:mysql:test', 'root','')||
                die "Error opening database: $DBI::errstr\n";

        print "I think it's connect !.........";

        my $sth=$dbh->prepare(" LOAD DATA LOCAL INFILE    
"/home/roime/MYSQL_PERL/IN_NETWORK/packet.txt" INTO TABLE flow FIELDS
                TERMINATED BY ',' ");
        
        $sth->execute();
        $set->finish();

        $dbh->disconnect ||
                die "Failed to connect..........";
        $dbh->disconnect ||
                die "Error opening database: $DBI::errstr\n";

        my $result;
                while(<$addr>)
                {
                        last if m/^end/gi;
                        print "Received : $_";
                        print $addr $_;
                        $result += $_;
                }

                chomp;
                if(m/^end/gi)
                {
                                my $send = "result";
                                print $addr "$send\n";
                                print "Result: $send\n";
                }
                print "Closed connection\n";

                close $addr;
                print "At your service....Waiting Please !!......\n";
        }


==============================================================
i just used this below method to import it into mysql, instead of mysqlimport...

my $sth=$dbh->prepare(" LOAD DATA LOCAL INFILE    
"/home/roime/MYSQL_PERL/IN_NETWORK/packet.txt" INTO TABLE flow FIELDS
                TERMINATED BY ',' ");

But i receive this message when i compiled it..............

"String found where operator expected at import.pl line 34, near "TERMINATED BY ','""
  (Might be a runaway multi-line "" string starting on line 33)
        (Missing semicolon on previous line?)
syntax error at import.pl line 34, near "TERMINATED BY ','""
Execution of import.pl aborted due to compilation errors. "

Do you have any suggestion ?...




This e-mail and any attachments may contain confidential and
privileged information. If you are not the intended recipient,
please notify the sender immediately by return e-mail, delete this
e-mail and destroy any copies. Any dissemination or use of this
information by a person other than the intended recipient is
unauthorized and may be illegal.
-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>

Reply via email to