Hi,

I'm knocking up a small script to copy some CSV data files into a MS
SQL/Access database using DBD::ODBC.

>From the documentation I've read I believe that I'm correct in saying that
if I set RaiseError and PrintError as follows:

$dbh2 = DBI->connect("DBI:ODBC:Database", {RaiseError=>0, PrintError=>0} );

then I shouldn't get any output to screen in the event of errors.

However if I attempt to INSERT into a table I get the following output to
the screen if I break the rules of the Primary key:

DBD::ODBC::st execute failed: [Microsoft][ODBC Microsoft Access Driver] The
changes
you requested to the table were not successful because they would create
duplicate values
in the index, primary key, or relationship.  Change the data in the field or
fields that contain
duplicate data, remove the index, or redefine the index to permit duplicate
entries and try
again. (SQL-23000)(DBD: st_execute/SQLExecute err=-1) at copydb.pl line 33.

Am I wrong in assuming that these errors should be turned off by setting
RaiseError and PrintError to 0 ?

What I want to be able to do is to handle the errors myself, logging just
the keys of records that fail to insert to a file.
With things as they are at the moment the script is taking ages to run due
to all the extra screen output that I don't want.

Any ideas / suggestions as to how to stop this ?

Regards,

Rob Leadbeater

Reply via email to