KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: Understanding the SQL LOGIN "dataEntry" Parameter
PRODUCT: 4D | VERSION: 12 | PLATFORM: Mac & Win
Published On: April 15, 2011

The SQL LOGIN command can be used to connect to a multitude of external data sources, as well as the internal database, by modifying the "dataEntry" parameter.

What may not be clear is that each type of connection is, in fact, quite distinct.

SQL LOGIN supports 3 types of connections:

ODBC

An ODBC connection can be established using the syntax "ODBC:My_DSN" or "My_DSN" (the latter form is not recommended as it is less explicit). In this case "My_DSN" must be a valid ODBC Data Source Name. A DSN is required in order to make an ODBC connection using SQL LOGIN. Furthermore any DSN requires an ODBC driver, so the ODBC driver for the target server must be installed on the machine where the DSN is created.

In this case the connection uses Micrsoft's ODBC API to communicate with the external server. This is a network connection.

It is possible to make an ODBC connection to a 4D Server using SQL LOGIN but this adds unnecessary overhead (see below).

Direct

A "direct" connection means that the calling application will be connected to a 4D Server using our proprietary SQL protocol. Direct connections are specified using the syntax "IP:server_name" or "4D:publication_name", where "server_name" is the network name or IP address of the machine running 4D Server and "publication_name" is the name specified in the database settings for publishing.

ODBC is not part of this connection. No ODBC driver is required and no DSN need be created. Though the same command is used (SQL LOGIN) this type of connection is fundamentally different than ODBC. The only similarity to ODBC is that this is also a network connection.

Of course the 4D Server must be configured to accept external SQL connections and must have an appropriate license to do so.

Internal

An internal connection means that no network protocol is involved and subsequent commands will use the internal database engine. In internal connection is specified using the syntax SQL_INTERNAL. Note this is a 4D constant, not a value passed in a string.

This is again completely distinct from both ODBC and direct connections. There is no network access for internal connections and, therefore, neither the ODBC API nor 4D's proprietary SQL API are used.