In order to connect to an external database and use SQL statements via the BEGIN SQL and END SQL commands offered by 4D, a developer must first call the USE EXTERNAL DATABASE command and set the necessary parameters to do so.
There are three parameters for USE EXTERNAL DATABASE:
-sourceName: A string containing the data source name. This can be found in the Data Sources (ODBC) administrative tool:
Or via the 4D command GET DATA SOURCE LIST. When using another 4D v11 SQL database the drivers array returned by GET DATA SOURCE LIST can be parsed for "4D v11 ODBC Driver". The corresponding element from the source names array will contain the desired DSN.
-user: The username for the corresponding DSN.
-password: The password for the corresponding DSN.