Hi,
Not clear how outside of SAP network means in your context. See to query any database it has to be linked first to the server from where you want to query it. I query Legacy DB schema. If you scenario is establish data connection and query its possible.
Basically to query something it has to be connected in some possible way. may be you can try the same out to check if it works in your case
Cheers,
Arindam