4D v13.4

External connections

Home

 
4D v13.4
External connections

External connections  


 

 

4D allows you to use external databases, in other words to execute SQL queries on databases other than the local one. To do this, you can connect to any external data source via ODBC or directly to other 4D databases.
Here are the commands that allow you to manage connections with external databases:

  • Get current data source tells you the ODBC data source used by the application.
  • GET DATA SOURCE LIST can be used to get the list of ODBC data sources installed on the machine.
  • SQL LOGIN allows you to connect to an external database directly or via an ODBC data source installed on the machine.
  • SQL LOGOUT can be used to close any external connection and to reconnect to the local 4D database.
  • USE DATABASE (SQL command) can be used to open an external 4D database using the 4D SQL engine.

The example below shows how to connect to an external data source (ORACLE), how to get data from the ORACLE database, and then how to disconnect from the ORACLE database and return to the local database.
Suppose that there is a valid data source named "Test_ORACLE_10g" installed in the system.


To test the above example, in the main window of the "4D SQL Code Samples" database, press the Connect to ORACLE button.

 
PROPERTIES 

Product: 4D
Theme: Tutorial