infor.com
concierge
infor u
developer portal
documentation central
customer center
Posts
Categories
Groups
ERPs
CSD
FSM/HRT
LN
M3
Syteline/ CSI
Hubs
Developer
Healthcare
Hospitality
Public Sector
Onboarding
Release Center
CloudSuites
Aerospace & Defense (LN)
Automotive (LN)
Chemicals (M3)
Corporate (FSM/HRT)
Distribution (Sx.e/CSD)
Distribution Enterprise (M3)
Engineering & Construction (LN)
Fashion (M3)
Food & Beverage (M3)
Healthcare (FSM/HRT)
Industrial (Syteline/CSI)
Industrial Enterprise (LN)
Manufacturing (M3)
Public Sector (FSM/HRT)
Solutions
Supply Chain Management (SCM)
Human Capital Management (HCM)
Events
Groups
User Groups
Your Groups
About
Email Community Support
Infor News
Migrated Forums
Home
Clovertech
Clovertech Archive
Read Only Archives
Cloverleaf
Cloverleaf
SQL connection help
hari nagasamudra
hello,
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
Find more posts tagged with
Clovertech
Comments
System
Originally posted by Daniel Lee
I think after your SQLAllocHandle SQL_HANDLE_DBC where you allocate the database handle, you'll need to connect to the database before you create your statement handle.
set errcode [odbc SQLConnect $hdbc SQL_NTS SQL_NTS SQL_NTS]