This topic is locked

Connecting to two databases

11/10/2006 7:56:20 AM
PHPRunner General questions
G
gdude66 author

Is there any way for drawing data from two different MySQL or MSSQL databases simultaneously or will phpr only handle one connection?

T
thesofa 11/12/2006

OK, I have set up a test for this, using Navicat, I created a database called ex1 with 3 tables, continent, country and state. tey are linked together with the country having a field of the continent ID and the state having a field of the country ID.

I then made another copy of this, called ex2.

I then built a query using Navicat with tables from both of the open databases, like this

SELECT

`ex2`.`country`.`country`,

`ex1`.`states`.`state`,

`ex1`.`cont`.`continent`

FROM

`ex2`.`country`

Inner Join `ex1`.`cont` ON `ex2`.`country`.`IDCont` = `ex1`.`cont`.`ContID`

Inner Join `ex1`.`states` ON `ex1`.`states`.`IDCountry` = `ex2`.`country`.`CountryID`

which i then cut and pasted into PHPR.

In the past I have found that if there is a glitch in the sql query, PHPR will not allow movement to the next page.

This query has been accepted by PHPR and I can move to the next page. I just assume it will be fine.

Notice that the fields are specified with the following syntax

`databasename`.`tablename`.`fieldname`, all three have tickles around them and they are seperated by a full stop.

I hope this helps, plese let us know if it is successful.

I suspect that trying to pull data from more than one database may be slow.

Also, I think PHPR will have real problems coding the pages if one database is MYSQL and one is MSSQL, as in your case?

HTH

M
mazyad 2/12/2007

How can acheive this objective if I have multipl MDB files as follow:

  1. Shared Members.MDB with the login table includes SerialNumber, UserID, UserName
  2. Cars.Mdb with model, make, ..etc
  3. RealEstate.MDB with land, location, price .. etc.

J
Jane 2/12/2007

Unfortunately, you can't use two databases in the PHPRunner.
I recommend you to create tables with username and password in your main database.

T
thesofa 2/13/2007

if you are using MDB files from Access, you can create linked tables in one databse that point to the data in the other databses, just as if you were pulling data from an external source.

with the database open that will provide most of the data, select the Tables tab in the access database window.

click on New in the tool bar

then select 'Link Table' from the menu list

follow the wizard to point the link to the other database.

there you go, all sorted?

HTH