CONNECT TO

CONNECT TO statement allows a program to connect to several databases at a time. The databases can be located on different servers and be of different types. The syntax of this statement is as follows:

Database

A string expression identifying the name of the database to connect to

Session

A string expression identifying  the session name for the connection

Login

A string expression identifying  the username valid on the database server

Password

A string expression identifying  the password valid for the username used

 

The CONNECT TO statement establishes the connection to a database. A program can have several CONNECT TO statements located within program modules. Unlike the DATABASE statement, this statement cannot appear before the MAIN block. Use the DATABASE statement to specify the compile time database, if you need to compile DEFINE ... LIKE statements. The CONNECT TO statement is only used to specify the runtime database connections.

 

The current database connection that will be active is the session of the last CONNECT TO statement executed. The current connection can be changed with the help of the SET CONNECTION statement and closed using the DISCONNECT statement.

 

If you connect to Informix database running on a UNIX platform, the only restriction on establishing multiple connections to the same database environment is that an application can establish only one connection to each local server that uses the shared-memory connection mechanism. To find out whether a local server uses the shared-memory connection mechanism or the local-loopback connection mechanism, examine the $INFORMIXDIR/etc/sqlhosts file.

 

Contact Us

Privacy Policy

Copyright © 2024 Querix, (UK) Ltd.