Forums

How to DBRead from External database

tshirley 02 Jun, 2016
Hi,

I have plenty of experience with the Basic DBRead but this is the first time I have tried the external DB.

I have a need to read data from a database that is in the same host but a different Joomla instance.

So I set up my DBRead and placed in the External Database Tab:

Host : localhost
Name: glidinga_joom984
User: myuser
Password: mypassword
Prefix: 2bi_

When I click "Load Tables" I get a list of the tables in glidinga_joom984 as I expected and I can pick the one I want.

and then I enable the External tab.

But what do I do back in the Basic tab? I put my selection criteria there in Conditions (because there is no place for conditions in the External Taband set the Model to No and selected no table there because it is set in the External tab.

If I have Basic not enabled I get no data. If I have Basic and External enabled I get Error 500.

So I am a bit confused. What are the correct settings to read a selected record from an External database?



Cheers

Tim
GreyHead 02 Jun, 2016
Hi Tim,

A bit of ambiguity in the settings I think - I took a look at the code.

The Enable in the Basic tab applies to the whole action; if you set that to No then the action is skipped and nothing is done.

The Enable in the External Database tab is to enable the External Connection; if you set that to Yes then the Table setting in the basic tab is ignored - but everything else there should still work OK.

Bob
tshirley 02 Jun, 2016
Thanks Bob,

That's what I thought, but if I have both tabs enabled I get an error 500 so I am not sure what to look for as a problem because I can get no debug info.

Cheers

Tim
GreyHead 02 Jun, 2016
HI Tim,

I don't have a quick way to test. If you temporarily set site Debug on and Error Reporting to Maximum or Developer you might see some more useful error message. Not sure what would cause a 500 message here though :-(

Bob
tshirley 02 Jun, 2016
Hi Bob,

I can avoid the issue by passing as parameters the data I was intending to read. But I would like to understand as I am sure there will come a time when I really have to do it.

Anyway thanks for your advice.

Tim
GreyHead 02 Jun, 2016
Hi Tim,

You can use a Custom Code action with a Joomla! DB query - see this FAQ

Bob
This topic is locked and no more replies can be posted.