Connecting to a Database

Embedded SQL for C and SQL Server

Embedded SQL for C and SQL Server

Connecting to a Database

Use a CONNECT TO statement in your application to specify the Microsoft® SQL Server™ name, database name, login ID, and password for the connection. You can connect to servers and databases other than those used during precompiling.

The default time-out for a database connection is 10 seconds. If the specified server does not respond to the connection request, or if the network name lookup fails, the compilation or execution suspends for approximately 10 seconds. Use the SET OPTION statement to change the connection time-out.

For more information about Embedded SQL statements, see Embedded SQL Statements.