Here’s a couple of “Hello, World! scripts.
set usr sa
set pass
set dsn test_dev
package require odbc
echo [odbc SQLAllocHandle SQL_HANDLE_ENV SQL_NULL_HANDLE henv]
echo [odbc SQLSetEnvAttr $henv SQL_ATTR_ODBC_VERSION SQL_OV_ODBC3 0]
echo [odbc SQLAllocHandle SQL_HANDLE_DBC $henv hdbc]
echo [odbc SQLConnect $hdbc $dsn SQL_NTS $usr SQL_NTS $pass SQL_NTS]
echo [odbc SQLConnect $hdbc $dsn SQL_NTS $usr SQL_NTS $pass SQL_NTS]
package require odbc
set usr sa
set pass
set dsn test_dev
puts [odbc SQLAllocHandle SQL_HANDLE_ENV SQL_NULL_HANDLE henv]
puts [odbc SQLSetEnvAttr $henv SQL_ATTR_ODBC_VERSION SQL_OV_ODBC3 0]
puts [odbc SQLAllocHandle SQL_HANDLE_DBC $henv hdbc]
set retries 3
set sleep_int 5
set err [odbc SQLConnect $hdbc $dsn SQL_NTS $usr SQL_NTS $pass SQL_NTS]
while {$retries && [cequal $err SQL_ERROR]} {
[code]package require odbc
set usr sa
set pass
set dsn test_dev
puts [odbc SQLAllocHandle SQL_HANDLE_ENV SQL_NULL_HANDLE henv]
puts [odbc SQLSetEnvAttr $henv SQL_ATTR_ODBC_VERSION SQL_OV_ODBC3 0]
puts [odbc SQLAllocHandle SQL_HANDLE_DBC $henv hdbc]
set retries 3
set sleep_int 5
set err [odbc SQLConnect $hdbc $dsn SQL_NTS $usr SQL_NTS $pass SQL_NTS]
while {$retries && [cequal $err SQL_ERROR]} {