[Catalyst] connecting to more than one database

Jonathan Rockway jon at jrock.us
Thu Jul 3 16:22:29 BST 2008


* On Thu, Jul 03 2008, jagdish eashwar wrote:
> So when I was able to do what I had in mind at the database level, I thought it
> would be possible to do the same with Catalyst and DBIx::Class also. I still
> haven't lost hope.  It would be painful and inelegant to have to replicate the
> employee details for each  of the web applications in the respective databases.

Logically, your two databases are one database.  You should consider a
database to be a universe in isolation, with no access to anything else.
If you have dependencies between two databases, they are not two
databases, they are one database.

>From an implementation standpoint, how do you expect the database engine
to implement things like locks across two databases?  (Berkeley can do
it, but I don't know about RDBMSs though.)

Basically, what you want to do with DBIC is not possible.  I don't think
DBMS (should) allow this either.  So you really need to combine your two
databases.

As a last resort, I seem to remember SQL Server being able to alias
tables between databases.  If your DBMS allows something like that, then
you can do that.  You might also be able to add stored procedures to the
first database that returns the tables in the second database.  DBIC
will probably deal with those, at least for reads.  But that's not
really optimal; just make everything one database.

Regards,
Jonathan Rockway

-- 
print just => another => perl => hacker => if $,=$"



More information about the Catalyst mailing list