This topic is locked

create view across different databases

12/4/2023 6:33:53 AM
PHPRunner General questions
konenamogo author

Hello,
I have database test1 (Microsoft SQL) and database test2 (MySQL), and table employee1 under database test1 and table employee2
under database test2.

Is it possible to create a view between employee1 and employee2 in PHPRunner ?

How can i do it ?

Thank you

I use PHPRunner 10.8

K
kohle 12/4/2023

Hi,

you need the Enterprise version of phprunner.

rgs
J.

admin 12/4/2023

No, it is not possible. PHPRunner can work with any data that is a result of a single SQL query. However, you cannot query two different database types in the same query, this is simply not how ti works.

Myr0n 12/17/2023

You can play with rest api, create a rest api project A for test1 and other rest api projectB for test2, in your main projectPRODUCTION call both api's and mix your data together.

https://xlinesoft.com/phprunner/docs/about-rest-api.htm

T
Tim 12/19/2023

You could do this at the database level. In MS SQL you can setup a "linked server" to the MySQL DB, and then you can create a view that joins a DB/Table from MS SQL with a table from the MySQL linked server. And then you can use that view in PHPR. If you want to go this route, just do a search on MS SQL linked server.

dageciDevClub member 12/20/2023

I've never tried it, but supposedly you could use Federated tables in MySQL

Take a look at this:

https://stackoverflow.com/questions/11684956/i-need-to-join-table-from-other-database-and-sometimes-other-server

And do let us know if you did managed to work it out.

Davor

jadachDevClub member 12/20/2023

If both databases are on the same server, you will need to make sure the account you are using in PHPRunner has access to both databases.

The best way to combine is to do it in the primary database. Create a view there and then point PHPRunner to that view.

Technically, you can also create the query in the designer of PHPRunner. But that is not the best way to go as you will not be able to access the Query Designer Tab.

Here is a simple example - notice the 3 dot notation:
SELECT dbo.Capacity.ID, dbo.Capacity.capacity, Census.dbo.Cases.Booked, Census.dbo.Cases.Completed, Census.dbo.Cases.AddOns
FROM dbo.Capacity INNER JOIN
Census.dbo.Cases ON dbo.Capacity.ID = Census.dbo.Cases.ID

jadachDevClub member 12/21/2023

Ignore my last reply. I should have read this better. I was assuming you were talking MSSQL only.

You cannot query MSSQL and MySQL together.