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

Discussion in 'Perl Misc' started by ewitkop90@hotmail.com, Jan 8, 2005.

  1. Guest

    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.
    , Jan 8, 2005
    #1
    1. Advertising

  2. Guest

    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.
    , Jan 8, 2005
    #2
    1. Advertising

  3. wrote :

    > (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 ...

    --
    Epur Si Muove (Gallileo Gallilei)
    Martin Kissner, Jan 8, 2005
    #3
  4. <> wrote:


    > (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).


    --
    Tad McClellan SGML consulting
    Perl programming
    Fort Worth, Texas
    Tad McClellan, Jan 9, 2005
    #4
  5. Peter Wyzl Guest

    <> wrote in message
    news:...
    : 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
    --
    http://cgi.ebay.com.au/ws/eBayISAPI.dll?ViewItem&rd=1&item=4516341671
    print "Just another Perl Hacker";
    Peter Wyzl, Jan 9, 2005
    #5
  6. erik Guest

    Peter Wyzl wrote:
    > <> wrote in message
    > news:...
    > : 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
    > --
    > http://cgi.ebay.com.au/ws/eBayISAPI.dll?ViewItem&rd=1&item=4516341671
    > print "Just another Perl Hacker";



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

    Thanks all.
    erik, Jan 9, 2005
    #6
  7. erik Guest

    Peter Wyzl wrote:
    > <> wrote in message
    > news:...
    > : 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
    > --
    > http://cgi.ebay.com.au/ws/eBayISAPI.dll?ViewItem&rd=1&item=4516341671
    > print "Just another Perl Hacker";



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

    Thanks all.
    erik, Jan 9, 2005
    #7
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.

Share This Page