The DbConnect function creates a connection to an ODBC database.
Used to connect to the Data Source Name used in subsequent Database functions.
<connection_string>, string containing database connection information. The string contains a number of arguments and values separated by semicolons, the first argument must be DSN and its value is the data source name as configured in ODBC (see How to Create an ODBC Connection to a Database). Examples:
"DSN=SQLTEST ;UID=MY_USER ;PWD=ABC"
The arguments in <connection_string> depend on your database driver, see your database documentation for advanced settings. Under a Windows 64 bits, configure the ODBC using this command line:
It loads the 32 bits ODBC configurator.
If you want to access the 64 bits ODBC engine, you need to use the 64 bit version of our automation tool.
ret, optional numeric return value. If the function successfully opens the database within the timeout value (30 secs by default, use #ActionTimeout to change this default value) , the return value is 0. If the function fails, the return value is a nonzero value (see Error Codes for Database Functions).
DbConnect("DSN=DBTest") ' connection to ODBC database called DBTest
DbConnect("DSN=SQLTEST ;UID=MICHAEL ;PWD=ABC") ' connection to an ODBC database called SQLTEST for the user Michael using the password ABC