Forum OpenACS Q&A: Re: Querying other DB's from OACS

Collapse
Posted by Jerry Asher on
Short answer: Yes and no for the reasons you have suggested.

There are several layers involved.

The OACS DB Layer (db_foreach, ...) sits on top of the AOLserver database driver layer.

You're right in that you set up a different pool to speak to each database, configuring each pool in your config.tcl.

In your config.tcl, I believe all you need to do is to set ns_section ns/db/pool/remotepool datasource to point to the right host and database, maybe something like: ashcroft.justice.gov::tia.

You will need to check on your other pg instance to make sure it can accept connections via tcp.  IIRC, the default ootb is that it will not accept tcp based connections on linux.

But you're also right in that the public interface to the OACS db layer (db_... ) doesn't make it easy to switch pools.

So you either need to add that, use the older and funnier ns_db layer, or create another instance of your application that just points to the remote database.