Re: (Fwd) Perl DBI question

Bruce Johnson <[email protected]>
Newsgroups gmane.comp.lang.perl.modules.dbi.general
Message-ID <[email protected]>
On May 9, 2013, at 10:47 AM, "Vancura, Mark D (Mark)" <[email protected]> wrote:

> Bruce,
> Thanks, the explanation makes sense, so I need to figure out how to follow through
> on this documented suggestion from: 6.1.6. Security Issues with LOAD DATA LOCAL
> 
> *If you use LOAD DATA LOCAL in Perl scripts or other programs that read the [client] group from option files, you can add the local-infile=1 option to that group. However, to keep this from causing problems for programs that do not understand local-infile, specify it using the loose- prefix:
> [client]
> loose-local-infile=1
> 
> *If LOAD DATA LOCAL is disabled, either in the server or the client, a client that attempts to issue such a statement receives the following error message: 
> ERROR 1148: The used command is not allowed with this MySQL version
> 
> Thus this fits my situation exactly, I just have to learn where the "option files" are
> and how to put the [client] loose-local-infile=1 into it.
> 
> Any suggestions where to look this up?

right there in theat section you looked at, down in the comments is


"For use in perl DBI scripts, adding an option at the end of the data source definition for DBI->connect fixes the LOAD DATA LOCAL problem in some situations...

use strict;
use DBI;
my $dsn = "DBI:mysql:mydb;mysql_local_infile=1"; 
my $user = "me";
my $password = "secret";
my $dbh = DBI->connect($dsn,$user,$password);"

the $dsn creation statement is where you can put a ton of options; mysql-only ones would be documented in the DBD:mysql documentation, I'll bet.


-- 
Bruce Johnson
University of Arizona
College of Pharmacy
Information Technology Group

Institutions do not have opinions, merely customs
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.