News:

Bored?  Looking to kill some time?  Want to chat with other SMF users?  Join us in IRC chat or Discord

Main Menu

Possible to access different database within same server?

Started by Biology Forums, May 10, 2019, 10:44:27 AM

Previous topic - Next topic

Biology Forums

I'd like to access a table found within another database other than the one stated in my settings.php file. The good thing is that the other database is found on the same server. Are SMF's database functions designed to access other databases, or must I use the database within that chosen in settings.php?

Illori

if the user that has rights to the SMF database has no rights to the other database it cannot read from it. this is handled on the server level not SMF.

Biology Forums

I have 2 websites, each one has their own database.

Website 1 wants to access tables in website 2, sort of thing

SychO

Quote from: Study Force on May 10, 2019, 10:53:33 AM
I have 2 websites, each one has their own database.

Website 1 wants to access tables in website 2, sort of thing

Quote from: Illori on May 10, 2019, 10:51:38 AM
if the user that has rights to the SMF database has no rights to the other database it cannot read from it. this is handled on the server level not SMF.

^
Checkout My Themes:
-

Potato  •  Ackerman  •  SunRise  •  NightBreeze

Kindred

sure - you can do almost anything you want - if you can code it.
However, no - you can not use SMF's database functions to access a different database. SMF's database functions are specifically written as a closed loop - they pre-parse the request, clean it (reject it if its malicious) and then access ONE database, by using ONE user and most of the functions perform ONE action.

this is security.
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Looking

You could call the data from the external table and store it within the DB for SMF using an external script and then have SMF utilize it that way.

vbgamer45

I generally do SELECT * FROM databasename.tablename  that will work in smf database calls.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Biology Forums

Quote from: vbgamer45 on May 10, 2019, 04:09:34 PM
I generally do SELECT * FROM databasename.tablename  that will work in smf database calls.

I'll try that. Or, as mentioned, store the information I need from website B in a JSON file that can then be accessed via URL in website A.

vbgamer45

Less overhead doing the sql directly. The mysql user has to have access to both databases.
Community Suite for SMF - Take your forum to the next level built for SMF, Gallery,Store,Classifieds,Downloads,more!

SMFHacks.com -  Paid Modifications for SMF

Mods:
EzPortal - Portal System for SMF
SMF Gallery Pro
SMF Store SMF Classifieds Ad Seller Pro

Advertisement: