I have this TCL script (just the piece posted) and trying to connect to the external server.
set err [odbc SQLAllocHandle SQL_HANDLE_ENV SQL_NULL_HANDLE henv]
echo “SQLAllockHandle:$err”
odbc SQLSetEnvAttr $henv SQL_ATTR_ODBC_VERSION SQL_OV_ODBC3 0
set err [odbc SQLSetEnvAttr $henv SQL_ATTR_ODBC_VERSION SQL_OV_ODBC3 0]
echo “SQLSetEnvAttr:$err”
# allocate a connection handle
odbc SQLAllocHandle SQL_HANDLE_DBC $henv hdbc
set err [odbc SQLAllocHandle SQL_HANDLE_DBC $henv hDBConnection]
echo “SQLAllocHandle:$err”
# allocate a statement handle
odbc SQLAllocHandle SQL_HANDLE_STMT $hdbc hstmt
set err [odbc SQLAllocHandle SQL_HANDLE_STMT $hdbc hstmt]
echo “SQL_HANDLE_STMT:$err$hstmt”
set err [odbc SQLPrepare $hstmt $sqlStmt SQL_NTS]
echo “SQLPrepare:$err”
set err [odbc SQLExecute $hstmt]
# $sqlStmt SQL_NTS]
echo “SQLExecDirect:$err”
and I get the following error.
SQLAllockHandle:SQL_SUCCESS
SQLSetEnvAttr:SQL_SUCCESS
SQLAllocHandle:SQL_SUCCESS
SQL_HANDLE_STMT:SQL_ERRORhstmt0
[0:TEST] Tcl error:
msgId = message0
proc = ‘odbcHARI’
args = ”
result = ‘hstmt is not open
handle hstmt0 not found’
errorInfo: ‘
hstmt is not open
handle hstmt0 not found
while executing
“odbc SQLPrepare $hstmt $sqlStmt SQL_NTS”
(“run” arm line 21)
invoked from within
“switch -exact — $mode {
start {
# Perform special init functions
odbc SQLAllocHandle SQL_HANDLE_ENV SQL_NULL_HANDLE …”
(procedure “odbcHARI” line 17)
invoked from within
“odbcHARI {MSGID message0} {CONTEXT sms_ib_data} {ARGS {}} {MODE run} {VERSION 3.0}”‘
Do we need to exclusively OPEN the connection? I feel like I am missing one important thingy. ANY HELP IS MUCH APPRECIATED.
thanks,
Hari