multiple database model support

View: New views
6 Messages — Rating Filter:   Alert me  

multiple database model support

by Tyler Bird :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

hi

I just developed a catalyst application
and I was wondering how I could get it to support multiple databases.

Instead of just one per application.

Tyler

_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

Re: multiple database model support

by Andreas Marienborg :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

./script/myapp_create.pl model DB1
./script/myapp_create.pl model DB2

add on more options if you want to


- andreas

On Feb 26, 2008, at 11:41 PM, Tyler Bird wrote:

> hi
>
> I just developed a catalyst application
> and I was wondering how I could get it to support multiple databases.
>
> Instead of just one per application.
>
> Tyler
>
> _______________________________________________
> List: Catalyst@...
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@.../
> Dev site: http://dev.catalyst.perl.org/


_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

Re: multiple database model support

by Matt S Trout-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Feb 26, 2008 at 03:41:43PM -0700, Tyler Bird wrote:
> hi
>
> I just developed a catalyst application
> and I was wondering how I could get it to support multiple databases.
>
> Instead of just one per application.

Each C::M::DBIC::Schema represents a single connection to a single
DBIx::Class::Schema.

You can create as many of them as you like.

DBIx::Class was designed from the ground up to support N connections via
the same classes.

--
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/

_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

Re: multiple database model support

by James R. Leu :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Tyler,

Maybe this post will help:

    http://lists.scsys.co.uk/pipermail/catalyst/2007-November/015971.html

On Mon, Mar 10, 2008 at 05:11:15PM +0000, Matt S Trout wrote:

> On Tue, Feb 26, 2008 at 03:41:43PM -0700, Tyler Bird wrote:
> > hi
> >
> > I just developed a catalyst application
> > and I was wondering how I could get it to support multiple databases.
> >
> > Instead of just one per application.
>
> Each C::M::DBIC::Schema represents a single connection to a single
> DBIx::Class::Schema.
>
> You can create as many of them as you like.
>
> DBIx::Class was designed from the ground up to support N connections via
> the same classes.
>
> --
>       Matt S Trout       Need help with your Catalyst or DBIx::Class project?
>    Technical Director                    http://www.shadowcat.co.uk/catalyst/
>  Shadowcat Systems Ltd.  Want a managed development or deployment platform?
> http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/
>
> _______________________________________________
> List: Catalyst@...
> Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
> Searchable archive: http://www.mail-archive.com/catalyst@.../
> Dev site: http://dev.catalyst.perl.org/
--
James R. Leu
jleu@...


_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

attachment0 (196 bytes) Download Attachment

Re: multiple database model support

by jagdish eashwar :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I am working on two Catalyst applications and have set up different Mysql databases for each of them. Some of the tables that these two applications use are the same. At present, I am maintaining the common tables in both the databases. After reading this thread, I tried putting the common tables in a third database and creating two models in each of the Catalyst applications. I am, however, unable to set up  relationships between  tables across databases. Is this possible?

jagdish

On Thu, Feb 28, 2008 at 4:57 PM, Andreas Marienborg <omega@...> wrote:
./script/myapp_create.pl model DB1
./script/myapp_create.pl model DB2

add on more options if you want to


- andreas


On Feb 26, 2008, at 11:41 PM, Tyler Bird wrote:

hi

I just developed a catalyst application
and I was wondering how I could get it to support multiple databases.

Instead of just one per application.

Tyler

_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/


_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/


_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/

Re: multiple database model support

by Matt S Trout-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Tue, Jul 01, 2008 at 06:20:35AM +0530, jagdish eashwar wrote:
> I am working on two Catalyst applications and have set up different Mysql
> databases for each of them. Some of the tables that these two applications
> use are the same. At present, I am maintaining the common tables in both the
> databases. After reading this thread, I tried putting the common tables in a
> third database and creating two models in each of the Catalyst applications.
> I am, however, unable to set up  relationships between  tables across
> databases. Is this possible?

Yes, kind of.

If they're MySQL, then what I'd do is three sets of DBIC namespaces
and load the ones you need into each app.

DBIC can happily handle ->table('db1.table') under MySQL, and MySQL will
let you join between databases (the same way you'd use schemas in pg)

If you wantto discuss this further, I'd suggest taking it to the dbix-class
list.

--
      Matt S Trout       Need help with your Catalyst or DBIx::Class project?
   Technical Director                    http://www.shadowcat.co.uk/catalyst/
 Shadowcat Systems Ltd.  Want a managed development or deployment platform?
http://chainsawblues.vox.com/            http://www.shadowcat.co.uk/servers/

_______________________________________________
List: Catalyst@...
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/catalyst@.../
Dev site: http://dev.catalyst.perl.org/
LightInTheBox - Buy quality products at wholesale price