vBulletin Search Engine Optimization
| |||||||
| Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi, I am trying to call SQLSetConnectAttr api but I am getting following error: SQLSTATE: HY024 Native: -99999 Message: [IBM][CLI Driver] CLI0191E Invalid attribute value. SQLSTATE=HY024 I have created connection successfully but whiling setting connection autocommit mode to false I am getting above error. SQLUINTEGER autocommit; autocommit = SQL_AUTOCOMMIT_OFF; rc = SQLSetConnectAttr( hdbc, SQL_ATTR_AUTOCOMMIT, (void *)&autocommit, 0); Could some pls help ? Regards Ajay |
| |||
| ajay978@gmail.com wrote: > Hi, > I am trying to call SQLSetConnectAttr api but I am getting following > error: > SQLSTATE: HY024 > Native: -99999 > Message: [IBM][CLI Driver] CLI0191E Invalid attribute value. > SQLSTATE=HY024 > > I have created connection successfully but whiling setting connection > autocommit mode to false I am getting above error. > > SQLUINTEGER autocommit; > autocommit = SQL_AUTOCOMMIT_OFF; > rc = SQLSetConnectAttr( hdbc, SQL_ATTR_AUTOCOMMIT, (void > *)&autocommit, 0); You are calling the function with the wrong parameters, and the explicit casts prevent your compiler from raising an error/warning. Try this: rc = SQLSetConnectAttr(hdbc, SQL_ATTR_AUTOCOMMIT, SQL_AUTOCOMMIT_OFF, 0); p.s: As a general rule: if you need casts in your code, there is a high chance that you have a problem in the code itself. (Of course, there are exceptions to that rule.) -- Knut Stolze DB2 Information Integration Development IBM Germany |
| ||||
| The third parameter is the value, not a pointer to the value. Your use of an explicit cast to force the wrong value prevents the compiler from telling you that your code is wrong, so you get told off at runtime. <ajay978@gmail.com> wrote in message news:1135931348.004449.284520@f14g2000cwb.googlegr oups.com... > Hi, > I am trying to call SQLSetConnectAttr api but I am getting following > error: > SQLSTATE: HY024 > Native: -99999 > Message: [IBM][CLI Driver] CLI0191E Invalid attribute value. > SQLSTATE=HY024 > > I have created connection successfully but whiling setting connection > autocommit mode to false I am getting above error. > > SQLUINTEGER autocommit; > autocommit = SQL_AUTOCOMMIT_OFF; > rc = SQLSetConnectAttr( hdbc, SQL_ATTR_AUTOCOMMIT, (void > *)&autocommit, 0); > > Could some pls help ? > > Regards > Ajay > |