The default scaffolding site creates a connection pool at startup and stores it in the foundation type.
You can access the foundation type in your handler with:
y <- getYesod
Look at the runDB function. It accesses the connection pool from the foundation type.
Without knowing any more specifics of your situation,
you probably just want to write a function runDB2 that runs against a different connection pool (to your other database) that you also create at startup.
Greg Weber
Hi
This might not be the correct answer to your problem, but I asked
about how to pass a hashtable to the application in a prevoius mail.
The answer was to pass the ioref in the data constructor - Michael
wrote a very good example at:
https://github.com/snoyberg/haskell-web-rosetta/blob/master/counter/yesod.hs
It might be you can connect to the database, and then pass it on and
handle this second db-connection manually?
Cheers,
Petter Egesund
On Mon, Feb 28, 2011 at 10:05 AM, Katsutoshi Itoh <cutsea110@gmail.com> wrote:
> Hi
>
> I write an application, which must to access 2 databases.
> 1st is main database for this application.
> 2nd database is used as main database by another application.
>
> Could you teach me how to write to access 2nd database?
> Since there is no access to the 2nd database only partially, I'm a
> little problem in an ad hoc way.