Log In    |    Knowledge Base    |    4D Home
PRODUCT: 4D Developer | VERSION: 11 | PLATFORM: Mac & Win
Published On: November 14, 2007

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.

Commented by Jesse Pina on March 30, 2009 at 8:46 AM
As of 4D v11 SQL release 3, this command has been replaced by the SQL LOGIN command. USE EXTERNAL DATABASE is being kept for compatablity only, and will not be available in future versions.

For more information regarding the SQL LOGIN command, please see the following Tech Tip: