Starting a Session

The sqllogin() function initiates communication with ESQL-LIB and optionally passes any startup parameters you (or the application user) specify to Progress, including any database connection parameters. It can also specify an optional application name used to generate filenames for SQL r-code files compiled during execution.

You can call sqllogin() only once. The sqllogin() function returns 0 if it successfully logs in to ESQL-LIB and connects any specified databases. If it fails for any reason (including failure to connect databases), sqllogin() returns -1 and ends your ESQL session. The only ESQL-LIB function you can call after sqllogin() fails is sqlgetmsg() . Once sqllogin() fails, you can make no other calls to ESQL-LIB (including sqllogin()) without exiting to the operating system and restarting your application.

NOTE: Because sqllogin() ends your ESQL session if it fails, your application cannot recover if sqllogin() fails to connect a specified database. To maintain your ESQL session after such a failure, connect to databases using the sqlconn() function, and pass to it only client startup parameters that have no effect on database connection and run-time behavior. For more information on sqlconn() and database connection, see the "Connecting and Disconnecting Databases" section. For more information on client startup parameters, see the Progress Startup Command and Parameter Reference.

Specifying Progress Startup Parameters

The startup parameters that you can specify to sqllogin() for the small client model are different than for the large client model. Following are the parameters you can specify for the small client model:

Following are the parameters you can specify for the large client model:

You can specify Progress startup parameters to sqllogin() using three techniques:

You can also use these techniques together, as shown in the following example:

main(argc,argv)
int argc;
char *argv[ ];
{
  int ret;
  ret = sqllogin(argc-1,&argv[1],"-db wildlife -U Jon -P noj",""); 

Here, you pass sqllogin() both startup parameters from the command line and startup parameters in a character string. ESQL-LIB passes all these startup parameters to Progress with the command line parameters last. Any parameter settings that the application user specifies at startup replace any equivalent settings in the command string. Thus, you can specify default parameter settings that the user can override.

Specifying an Application Name

When you log in with sqllogin(), you can specify an application name. ESQL uses the first two characters of this name plus a random hexadecimal number to generate the filename for each SQL r-code file compiled during execution.

To associate run-time compiled r-code files with the sections of your application in which they are compiled, specify a different application name at the start of each section using the sqlapplname() ESQL-LIB function.

If you use a null string as an application name (shown as the fourth sqllogin() argument in the previous code fragments), ESQL generates the entire filename for each r-code file that it compiles using a random hexadecimal number string.


Copyright © 2004 Progress Software Corporation
www.progress.com
Voice: (781) 280-4000
Fax: (781) 280-4095