The sqlstart() function

The sqlstart() function starts an implicit default connection. An implicit default connection can support one connection to the default database server (that the INFORMIXSERVER environment variable specifies).

Tip: Restrict use of sqlstart() to applications before version 6.0 that only use one connection. Informix® ESQL/C continues to support this function for compatibility with earlier versions of these applications. For applications of Version 6.0 and later, use the CONNECT statement to establish explicit connections to a default database server.

Syntax

mint sqlstart();

Usage

Informix® ESQL/C provides the sqlstart() function for pre-Version 6.0 applications that can only support single connections. In this context, possible uses of sqlstart() are as follows:
  • You only need to verify that the default database server is available but you do not intend to open a database. If the call to sqlstart() fails, you can check the return status to verify that the default database server is not available.
  • You need to speed up the execution of the DATABASE statement when the application runs over a network. When you put the call to sqlstart() in an initialization routine, the application establishes a connection before the user begins interaction with the application. The DATABASE statement can then open the specified database.
  • You do not know the name of the actual database to access, or your application plans to create a database. The call to sqlstart() can establish the implicit default connection and the application can later determine the name of the database to access or create.

If you have an application before version 6.0 that needs an implicit default connection for any other reason, use the DATABASE statement instead of sqlstart(). For applications of version 6.0 and later, use the CONNECT statement to establish database server connections.

When you call the sqlstart() function, make sure that the application has not yet established any connections, implicit or explicit. When the application has established an explicit connection, sqlstart() returns error -1811. If an implicit connection was established, sqlstart() returns error -1802.

You can call this function several times before you establish an explicit connection, as long as each implicit connection is disconnected before the next call to sqlstart(). For information about disconnecting, see Terminate a connection. For more information about explicit and implicit connections, see Establish a connection.

Return codes

0
The call to sqlstart() was successful.
<0
The call to sqlstart() was not successful.