Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 10.0.1 » SQL Anywhere Server - Programming » SQL Anywhere Embedded SQL » Library function reference

db_get_property function Next Page

db_init function


int db_init( SQLCA * sqlca );


This function initializes the database interface library. This function must be called before any other library call is made and before any embedded SQL command is executed. The resources the interface library required for your program are allocated and initialized on this call.

Returns 1 if successful, 0 otherwise.

Use db_fini to free the resources at the end of your program. If there are any errors during processing, they are returned in the SQLCA and 0 is returned. If there are no errors, a non-zero value is returned and you can begin using embedded SQL commands and functions.

In most cases, this function should be called only once (passing the address of the global sqlca variable defined in the sqlca.h header file). If you are writing a DLL or an application that has multiple threads using embedded SQL, call db_init once for each SQLCA that is being used.

For more information, see SQLCA management for multi-threaded or reentrant code.


Failure to call db_fini for each db_init on NetWare can cause the database server to fail, and the NetWare file server to fail.

For information about using db_init in UltraLite applications, see db_init function.