[Dbix-class] RE: multiple database connection
Roland Philibert
rphilibert at aptina.com
Mon Oct 24 09:07:19 GMT 2011
To clarify they are distinct mysql databases. One in particular is used
to establish relationships with 3 others that are of the same
characteristics.
To start with 2 db only, how can I configure the DBIC schema so the
relationship can be met, I have in DB.pm:
__PACKAGE__->config(
schema_class => 'MyApp::Schema',
connect_info => {
dsn => 'dbi:mysql:database=db1:host=host1',
user => 'root',
password => 'root'
},
);
Can I here add another connect_info to db2 from host2 or have dsn
referencing to an array of connections?
Thanks.
-----Original Message-----
From: Roland Philibert
Sent: 21 October 2011 15:52
To: 'dbix-class at lists.scsys.co.uk'
Subject: multiple database connection
Hi all,
Could anybody send me an example on how to connect multiple databases
using DBIC::Schema?
I have:
package MyApp::Model::DB;
use strict;
use base 'Catalyst::Model::DBIC::Schema';
__PACKAGE__->config(
schema_class => 'MyApp::Schema',
connect_info => {
dsn => 'dbi:mysql:database=db1:host=host1',
user => 'root',
password => 'root',
}
);
And I need to connect to another mysql db (db2) under a different host
(host2)
Thank you all.
R.
---
Aptina (UK) Limited, Century Court, Millennium Way, Bracknell, Berkshire, RG12 2XT. Registered in England No. 06570543.
This e-mail and any attachments contain confidential information and are solely for the review and use of the intended recipient. If you have received this e-mail in error, please notify the sender and destroy this e-mail and any copies.
More information about the DBIx-Class
mailing list