Previous Topic

Next Topic

Book Contents

Book Index

Scripting - Connect function

This function is used to sign on to a database. It is mainly used when running Batch Queries – you must Connect to a database before any queries can be run. However this function can also be used when you are in “normal” (interactive) AQT – you can use this to sign onto a number of databases without going through the normal signon dialogs.

The Connect function takes the following parameters. Most of these correspond to parameters specified on the Signon window.





Specifies a full connection string

If this option is specified, no other option is needed except Dbs.

This is a technical parameter and should only be used by those familiar with database connection strings.


The name of the database you wish to connect to.

This is the same as the database name you would use in the Signon window. If you have specified Conn, the Dbs parameter has a slightly different meaning. It will be used as (an arbitrary) name you give this database (you may need to refer to this database if you code a use function).


User-id to sign on with.

If not specified, you will be signed on without a user-id or password.


Password to sign on with.

This password is specified in clear text. This is a security exposure - it is preferable to use the Epwd parameter instead.

If user is specified, and pwd is not specified, you will be signed on with a user-id only. This would be the equivalent of checking the No Password option in the Signon window.


Encrypted Password.

AQT provides a facility for generating encrypted passwords for use in the Connect Function. This will avoid the need to code clear passwords in batch files. Generating Encrypted Passwords has more information about this.


The name of the SQL Server / Sybase / Informix database to sign onto.

This is the same as option Database Name in the signon window.


Specifies the level of prompting you wish for the signon

Values are:

  • None (default)
  • Missing (same as Prompt for Missing Info in the Signon window)
  • Always (same as Prompted Signon).

This parameter is ignored if you are running AQT in batch mode.


Specifies the name of the Excel Worksheet to be written to

This is used for Excel only.

If you code Sheet it is recommended that you also code Filemode, which specifies what to do if the Worksheet already exists.

This parameter is optional – if not coded, a new Worksheet is always created (and Filemode is ignored).



Used only for Excel, and only if Sheet is specified.

AQT supports appending data to worksheets. Use Filemode=append to do this.


Specifies whether you are signing on with sysoper or sysdba privileges.

Only used when signing onto Oracle.

Requires Oracle ODBC Driver v9.2 or above.

Parameters marked * are mandatory


--aqt connect,dbs=sample

--aqt connect,dbs=ora_sample,user=system,epwd=JkAlDkEEkGg,connectas=sysdba

--aqt connect,conn=”Driver={Microsoft Access Driver (*.mdb)};Dbq=c:\aqtdemo.mdb”,dbs=Access