function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion

Apex Connect to external database

Hi all,

Is there anyone who has experience to get external database information, the background are:

1. we have one customer object

2. we are going to create an PDF page to shows it in pretty format, some of information we can get from the customer object, but some of information we have to to get from external database (SQL Database).

3. we do not want to those information which hosted in external database (SQL database) to sync back to salesforce even it might more easlier, but we would like have the real time data snapshot.


So the question is how to get those information and put in the class? is there any reference docment? Thanks.




Hi Quinsong, 

We cannot query external databases (sql server) from SOQL via apex. You would need to create a web service and use that from Apex Code in order to query an external database.


Hope this helps....