[rt-devel] Accessing a second database

Bart Duchesne bduc at dyndaco.com
Fri May 3 18:06:41 EDT 2002


Hi all,

We are currently running RT 2.0.13 successfully for several weeks now
and I'm making some customisations for it.

Take a seat as the problem description is rather long, but tested.

What I have done is the following :

I made a class hierarchy of my company database (Postgress; running on a
different machine then RT in a different database) the same way it is
done in RT (using DBIx::SearchBuilder::Handle, Dx::S::Record , etc)

I have a test perl script using these objects successfully from the
commandline; so access to the database is ok and the objects really
work.

Then I added my modules to the RT lib directory, modified the webmux  to
also use my modules and called MYDB::Init() right after RT::Init().
This is where trouble starts, it appears to me that the Dx::S::Handle
uses a global $DBIHandle that is overwritten each time Handle->Connect
is called: the call to RT::Init messes up the handle made by MYDB::Init,
so it's tables are unacessible because the handle it has constructed now
points to the RT database instead of mine.

Trying to be smart, I modified Dx::S::Handle and made the $DBIHandle  a
instance variable, I modified the Handle->dbh function to store in the
$self hash.

At a first sight it worked, I can access my two databases now using the
objects, BUT after a while I get a an error when RT tries to use the
$session{tickets} object, it's database handle has become invalid. When
not using these $session{tickets} everything works nicely.

Can someone help me out, I'm lost ...

regards


Bart  Duchesne
Dyndaco
bduc at dyndaco.com







More information about the Rt-devel mailing list