This topic is locked

Multiple database connections

5/20/2010 6:40:22 AM
PHPRunner General questions
C
ckranich authorDevClub member

Hello All,
Is there any simple way to connect two different database servers at the same time?

(For example a mySQL database as main database and an additional MSSQL database

for auxiliary read-only information)
The only idea I had was to develop both parts in individual php-runner projects and

then merging the second projects's code into the first one's connect functions

yielding a second database connection(under an other name) This then may be used

together with some handcoded php code (for example in events)
Any other way/idea how to do such things?
Best Regards,
Marcovaldo

A
ann 5/21/2010

Marcovaldo,
unfortunately, PHPRunner doesn't support two databases, the only way to connect other databases is to use events.

E
electromotive 5/23/2010

I also have the need to access multiple databases, mySQL and MSSQL (and others).
For now I have built them as separate projects kept in separate directories, with links from one (primary) to the other (secondary).

They each have their own sessions and at the moment I don't try and share session data. I keep the theme of each project different so there is less confusion.
Where I needed to use readonly secondary database data I created duplicate tables in the primary system and refreshed these tables as needed (for lookups or whatever, by automatic or clicking a button). But this is not a general solution for most as the currency of the secondary data is always delayed.
However, direct access to two or more databases in one project is the next logical step.
For instance in a legacy MSACCESS database I have to deal with, the backend tables for one appliation is in 3 or more databases of the same type. In the short term accessing multiple databases of the same type (ie multiple msaccessdb) will be much easier (than different database types like mySQL & MSSQL) because the code is the same, only the connection string changes. I can see how this could be easily done with events.
But builtin support for multiple databases of different types will be a major feature in a future PHPR product and will be awesome. Bring it on.