KNOWLEDGE BASE
Log In    |    Knowledge Base    |    4D Home
Tech Tip: The new SQL LOGIN command
PRODUCT: 4D Developer | VERSION: 11.3 | PLATFORM: Mac & Win
Published On: December 10, 2008

In 4D v11 SQL Release 3 (11.3), the SQL LOGIN command replaces the ODBC LOGIN command used in previous versions. Not only has the name of the command changed, but new functionality has also been added to it.

The second and third parameter work just like before (user and password respectively). The first parameter can now be:

"my_Data_Source" or "ODBC:my_Data_Source"

With these, SQL LOGIN behaves like ODBC LOGIN. For this you will need to configure the ODBC driver. Examples are shown below:

SQL LOGIN ("ODBC:my_4D_Data_Source";"user";"password")


or

SQL LOGIN ("my_4D_Data_Source";"user";"password")


The new command lets you connect directly to a 4D SQL Server, bypassing the ODBC driver. No ODBC overhead means faster access. In this case, the first parameter will be:

"4D:4D_DataBase_Name" or "IP:192.168.0.10"

"4D_DataBase_Name" is the name of the 4D database being accessed and "192.168.0.10" is the address of the external 4D database (if the external 4D database is using a non default port number, add ":port#" following the IP address). Here are examples:

SQL LOGIN ("4D:4D_DataBase_Name";"user";"password")

SQL LOGIN ("IP:192.168.0.10";"user";"password")


Two other options exist for the first parameter:
- The SQL_INTERNAL constant redirects all subsequent SQL queries to the internal SQL engine of the database.
- An empty string ("") opens a connection dialog box so that the data source to be connected to can be entered manually.

Finally, a new fourth parameter has been added to this command. It is the "*" and it indicates if the SQL code executed within the Begin SQL/End SQL tags will be sent to the internal SQL engine of 4D (* is omitted) or sent to the source specified in the first parameter (* is passed).