Establish a connection

The following two groups of SQL statements can establish connections to a database environment:
  • The SQL connection statements are CONNECT, SET CONNECTION, and DISCONNECT. These statements conform to ANSI SQL and X/Open standards for the creation of connections.
  • The SQL database statements include DATABASE, CREATE DATABASE, CLOSE DATABASE, and START DATABASE. These statements are a way to establish connections that are specific to HCL OneDB™.
Important: It is recommended that you use the CONNECT, DISCONNECT, and SET CONNECTION connection statements for new applications of Version 6.0 and later. For versions before 6.0, the SQL database statements (such as DATABASE, START DATABASE, and CLOSE DATABASE) remain valid for compatibility with earlier versions.
The type of connection that the application establishes depends on which of these types of statements executes first in the application:
  • If the first SQL statement is a connection statement (CONNECT, SET CONNECT) statement, the application establishes an explicit connection.
  • If the first statement is an SQL database statement (DATABASE, CREATE DATABASE, START DATABASE), the application establishes an implicit connection.