rookie604 has asked for the wisdom of the Perl Monks concerning the following question:

Hello there I am trying to use DBI with MySQL, and have a trouble using statement handle. Can somebody tell me how to use the statement handle for this SQL statement? LOAD DATA LOCAL INFILE 'file' INTO TABLE table_name Thank you
  • Comment on How do I use a statement handle with DBI?

Replies are listed 'Best First'.
Re: trouble with statement handles
by Roger (Parson) on Sep 18, 2004 at 09:08 UTC
    The LOCAL capability for LOAD DATA may be disabled in the MySQL client library by default. When you connect to the database, add the option "mysql_local_infile=1" to your connect string, LOAD DATA LOCAL will be enabled.

    (However, this option doesn't work if the server has also been configured to disallow LOCAL.)

      Dear whoever gave me a reply, Thank you so much for your reply. Can you please tell me exactly how I would add that option? IN fact, I don't even know what connect string is. As the name says, I am rookie. Young
        Have a read of DBD::mysql and look for the keyword 'mysql_local_infile' in the document.

Re: trouble with statement handles
by Anonymous Monk on Sep 18, 2004 at 09:14 UTC

    <mode="inquisitive>

    Your question is unclear. (How (Not) To Ask A Question, Before asking a database related question ...)

    Why are you talking about a statement handler?

    What did you try?

    If you tried anything, did you get any errors?

    Have you read the DBI docs?

    What is it you don't understand?

    </mode>

    <mode="helpful>

    Perhaps you nees something along the lines of:

    my $dbh=DBI->connect("dbi:mysql:databasename", "username", "password", {RaiseError=>1}) or die "DOES NOT CONNECT"; my $rows_affected = $dbh->do( "LOAD DATA LOCAL INFILE 'file' INTO TABLE table_name");

    </mode>