You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by Joerg Jaspert <mo...@german.ath.cx> on 2002/02/27 23:04:42 UTC

DBI Connect Cache

Hi

In my Apache startup.pl i have the following:

use Apache::DBI ();
[...]
Apache::DBI->connect_on_init(
     "DBI:mysql:database=database;host=localhost",
     "user", "password",
     {
      PrintError => 1, # warn() on errors
      RaiseError => 0, # don't die on error
      AutoCommit => 1, # commit executes immediately
    }
    );

(repeat it for any database i want open). 
To get them opened at startup for all Apache Processes.
(There are many mysqld so i think it works).

Now i use in my EmbPerl Sites DBIx::Recordset with
$DBIx::Recordset::FetchsizeWarn = 0;
$dsn = 'DBI:mysql:database:localhost';
$user = "user";
$pass = "password";

And then:
*set = DBIx::Recordset->Select(
	{'!DataSource' => $dsn,
	 '!Table'      => 'table',
	 '!Username'   => $user,
	 '!Password'   => $pass,
	 'id_field'        => $order});

(Replace Select with Search, Insert, Update, etc.)

Now my Question: Does this use the Connection via Apache::DBI ?
Does it use the Apache::DBI Connection if i set WriteMode ?


-- 
begin  OjE-ist-scheisse.txt
bye, Joerg
Registered Linux User #97793 @ http://counter.li.org
end

---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org


Re: DBI Connect Cache

Posted by Gerald Richter <ri...@ecos.de>.
Hi
>
> Now my Question: Does this use the Connection via Apache::DBI ?

Yes

> Does it use the Apache::DBI Connection if i set WriteMode ?
>

Yes, the WriteMode setting is only checked by DBIx::Recordset itself before
any writes to the DB

Gerald


-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925131
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------



---------------------------------------------------------------------
To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
For additional commands, e-mail: embperl-help@perl.apache.org