[Catalyst] work with second database

J. Shirley jshirley at gmail.com
Wed Apr 11 20:14:15 GMT 2007


On 4/11/07, Michael Higgins <mhiggins at banfieldgroup.com> wrote:
> Hello, All --
>
> As I'm still trying to get my head around the Catalyst way of doing things,
> I'm hoping can someone give me a hint:
>
> I have an application set up to report on a database. So far, so good.
>
> Now, I've got another database I need to query. How do I best integrate
> access to it into my existing application?
>
> Sorry for the generality of the question, but I don't even know the
> terminology yet. Is this, say, going to be a 'separate namespace' or
> something?
>
> Is there an example out there I could familiarize myself with, where a
> Catalyst application uses two different databases?
>
> I understand I can have as many models, views and controllers as I need. I
> don't understand what I need to create in order to have another model
> accessed from an existing controller, or how to define that model and get it
> loaded.
>
> Any leg up greatly appreciated.
>
> Cheers,
>
> --
> Michael Higgins
>
>
>

Hi Michael,

The long answer depends a bit on what you are already using to connect
to the database (DBix::Class, Data::ObjectDriver, RoseDB, etc?).

The short answer is simply create another model class and configure
it, just like you did with the first one.

The tutorial has a lot of good information on accessing a database:
http://search.cpan.org/~jrockway/Catalyst-Manual-5.700501/lib/Catalyst/Manual/Tutorial/CatalystBasics.pod

-Jay



More information about the Catalyst mailing list