Using DBI

[prev] [thread] [next] [Date index for 2004/12/28]

From: Octavian Rasnita
Subject: Using DBI
Date: 19:21 on 28 Dec 2004
Hi all,

I am a new member on this list and after reading the posts from this list in
the last few days, I don't even know if this is the apropriate place for
asking questions about using mod_perl.
If it is not, please tell me if there is another list which could be more
useful for a mod_perl beginner.

I want to use the DBI module with mod_perl 2 with Perl 5.8.4, and for the
moment... under Windows 2000.

I have tried:

In httpd.conf:
PerlRequire [path]/preload.pl

in preload.pl:
use Apache::DBI();
use DBI ();
DBI->install_driver("mysql");
###Apache::DBI->connect_on_init("DBI:mysql:database=presa;host=localhost",
"ODBC", undef, {PrintError =>1, RaiseError=>0, AutoCommit => 1});

in the GetCategories.pm module:
##use Apache::DBI;
use DBI;
my $dbh = ...;

I have tried more combinations, but every time I get the following error in
the logs:

[Tue Dec 28 21:07:34 2004] [error] DBD::mysql::db prepare failed: handle 2
is owned by thread 265c564 not current thread 14ce78c (handles can't be
shared between threads and your driver may need a CLONE method added) at
f:/web/presa/modules/GetCategories.pm line 18.\n
-----

So I have commented out the following line in preload.pl:
###Apache::DBI->connect_on_init("DBI:mysql:database=presa;host=localhost",
"ODBC", undef, {PrintError =>1, RaiseError=>0, AutoCommit => 1});

And in GetCategories.pm I have used only:

use DBI;
my $dbh = ...;

Well, in this case the script works, but I don't know if this way of using
DBI is the best way.

Thank you for any suggestion.

Teddy


        -- 
        Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html

Using DBI
Octavian Rasnita 19:21 on 28 Dec 2004

Re: Using DBI
Stas Bekman 20:51 on 28 Dec 2004

Re: Using DBI
Malcolm J Harwood 21:18 on 28 Dec 2004

Re: Using DBI
Octavian Rasnita 21:56 on 28 Dec 2004

Re: Using DBI
Malcolm J Harwood 22:09 on 28 Dec 2004

Re: Using DBI
Stas Bekman 22:14 on 28 Dec 2004

Re: Using DBI
Randy Kobes 23:15 on 28 Dec 2004

Re: Using DBI
Randy Kobes 23:27 on 28 Dec 2004

Re: Using DBI
Octavian Rasnita 07:46 on 29 Dec 2004

Re: Using DBI
Randy Kobes 16:24 on 29 Dec 2004

Generated at 12:15 on 16 Jan 2005 by mariachi v0.52