trying to connect to a mysql database, to input a file

E

ewitkop90

This is my code:
__________________________________________________________________
#!/usr/bin/perl -w
#insert data into mysql
use DBI;

$dbh = DBI->connect('DBI:mysql;firewall:localhost:3306','xxxx',
'xxxxxxx',
{RaiseError => 1, AutoCommit => 1 })


$dbh->do("LOAD DATA INFILE '/var/log/firewall/ns-complete' INTO TABLE
firewall FIELDS TERMINATED BY '
,' LINES TERMINATED BY '\n'");

$dbh->disconnect;
#EOF
_________________________________________________________________
But it is not working. It is giving me the following error:

Scalar found where operator expected at ./mysql-fwlog-input line 9,
near ")


$dbh"
(Missing semicolon on previous line?)
syntax error at ./mysql-fwlog-input line 9, near ")


$dbh"
Execution of ./mysql-fwlog-input aborted due to compilation errors.

Can someone point out what is wrong. According to my docs, this is the
right syntax.
 
E

ewitkop90

Also I forgot to mention that line 9 is the dbh->do string. The actual
sql command where I input the file is crapping out.
 
M

Martin Kissner

(Missing semicolon on previous line?)
syntax error at ./mysql-fwlog-input line 9, near ")
why don't just follow the request?

...
{RaiseError => 1, AutoCommit => 1 });
$dbh->do("LOAD DATA INFILE ...
 
T

Tad McClellan

(Missing semicolon on previous line?)
syntax error at ./mysql-fwlog-input line 9, near ")


Did you read the message?

Did you do what the message said to do?

The parser itself told you how to fix the problem, but you
have to listen to what it says for that to help.

Sheesh!

According to my docs, this is the
right syntax.


That is a silly thing to say when you get a syntax error. The
parser that is emitting the message is *the definition* of
the right syntax.

If it says you have a syntax error, then you have a syntax error
(or a bug in the parser which is not likely to go unnoticed long).
 
P

Peter Wyzl

: This is my code:

This would be the 'previous line missing the semicolon'

: $dbh = DBI->connect('DBI:mysql;firewall:localhost:3306','xxxx',
: 'xxxxxxx',
: {RaiseError => 1, AutoCommit => 1 })


This would be the syntax error telling you how to fix it...

: (Missing semicolon on previous line?)
: syntax error at ./mysql-fwlog-input line 9, near ")

Missing a semicolon on the previous line....?

P
 
E

erik

Peter said:
: This is my code:

This would be the 'previous line missing the semicolon'

: $dbh = DBI->connect('DBI:mysql;firewall:localhost:3306','xxxx',
: 'xxxxxxx',
: {RaiseError => 1, AutoCommit => 1 })


This would be the syntax error telling you how to fix it...

: (Missing semicolon on previous line?)
: syntax error at ./mysql-fwlog-input line 9, near ")

Missing a semicolon on the previous line....?

P


I did trying different syntaxes before posting to the group. What ever
I changed, was not working. Give me a little credit. :)

Thanks all.
 
E

erik

Peter said:
: This is my code:

This would be the 'previous line missing the semicolon'

: $dbh = DBI->connect('DBI:mysql;firewall:localhost:3306','xxxx',
: 'xxxxxxx',
: {RaiseError => 1, AutoCommit => 1 })


This would be the syntax error telling you how to fix it...

: (Missing semicolon on previous line?)
: syntax error at ./mysql-fwlog-input line 9, near ")

Missing a semicolon on the previous line....?

P


I did try different syntaxes before posting to the group. What ever I
changed, was not working. Give me a little credit. :)

Thanks all.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,578
Members
45,052
Latest member
LucyCarper

Latest Threads

Top