Development with ODBC SDK
- Last Updated: November 5, 2020
- 1 minute read
- DataDirect Connectors
- ODBC
- Documentation
Immediately after each call to SQLConnect, SQLDriverConnect, or SQLBrowseConnect that connects to a DataDirect ODBC driver, you must call SQLSetConnectAttr (SQLSetConnectOption for ODBC 2.0 enabled applications), as follows:
SQLRETURN res_code;
res_code = SQLSetConnectAttr (hdbc,1041,"<license_file>",SQL_NTS);
if (res_code != SQL_SUCCESS) {
<handle_error>
}
res_code = SQLSetConnectAttr (hdbc,1042,"<password>",SQL_NTS);
if (res_code != SQL_SUCCESS) {
<handle_error>
}
where:
- license_file
- is the name of the license file sent to the ODBC driver.
- password
- is the 24-character password sent to the ODBC driver.
- handle_error
- is code to handle errors associated with entering the license file name or the password.
Note: When you use your password to invoke the drivers from your
applications, you must use all 24 characters, including any padded Qs
that were added to lengthen the password, for example,
MYCompanyPWD812QQQQQQQQQ. See "Before branding the drivers" for more
information.The SQLSetConnectAttr function is defined in SQL.H. The result code returned by SQLSetConnectAttr is successful only if the correct number of parameters is passed to the function. If an incorrect license file or password is entered, the next SQL statement fails and the following error message is generated:
Invalid License File: licensefilename
Note: SQLSetConnectAttr is a standard ODBC API call; however,
non-DataDirect ODBC drivers return an error when these calls are made. Your program should
check all "Invalid license file" error messages that arise, but ignore any errors resulting
from calls with non-DataDirect ODBC drivers.
Note: Options 1041 and 1042 are registered to Progress DataDirect
and recognized by DataDirect drivers only.