[Koha-devel] Use of "my $dbh=C4Connect;"

Larry Currie lcurrie at CalAcademy.Org
Tue Mar 25 13:56:04 CET 2003


We're developing a script to load data for the biblio, biblioitems, and
items tables of the koha MySQL database using DBI and we're wondering
what to use for our database handle.  I can see that in a number of the
koha scripts the command

my $dbh=C4Connect;

is used to establish the connection to the koha database and that the
command lines

use C4::Database;          and
use C4::Input;

are inserted at the top of the scripts.

The DBI documentation, however, instructs you to use the following
database handle command:

my $dbh = DBI->connect("dbi:DriverName:db_name", $user, $password)
   or die "Can't connect to $data_source: $DBI::errstr";

Can someone help us to reconcile these two methods or instruct us on how
we should be connecting to the koha database to perform our INSERT
commands?

Thanks.

Larry Currie

--
Lawrence W. Currie
User Services Librarian
California Academy of Sciences
Golden Gate Park
San Francisco, CA 94118
lcurrie at calacademy.org
(415) 750-7108
(415) 750-7106 fax
http://www.calacademy.org/research/library/






More information about the Koha-devel mailing list