470,599 Members | 1,508 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,599 developers. It's quick & easy.

SetConnectAttr ODBC

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

Dec 30 '05 #1
2 2629
aj*****@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
Dec 30 '05 #2
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.

<aj*****@gmail.com> wrote in message
news:11**********************@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

Dec 30 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Marco Aschwanden | last post: by
3 posts views Thread by Joe | last post: by
4 posts views Thread by Andreas Lauffer | last post: by
3 posts views Thread by Lauren Quantrell | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.