Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
Database Servers
DB2InformixIngresMS SQLOraclePervasive.SQLPostgreSQLProgressSybase
Desktop Databases
FileMakerFoxProMS AccessParadox
General
General DB TopicsDatabase Theory
Related Topics
Java Development.NET DevelopmentVB DevelopmentMore Topics ...

Database Forum / DB2 Topics / December 2005

Tip: Looking for answers? Try searching our database.

SetConnectAttr ODBC

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
ajay978@gmail.com - 30 Dec 2005 08:29 GMT
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
Knut Stolze - 30 Dec 2005 09:29 GMT
> Hi,
> I am trying to call SQLSetConnectAttr api but I am getting following
[quoted text clipped - 11 lines]
>     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.)

Signature

Knut Stolze
DB2 Information Integration Development
IBM Germany

Mark Yudkin - 30 Dec 2005 10:53 GMT
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.

> Hi,
> I am trying to call SQLSetConnectAttr api but I am getting following
[quoted text clipped - 16 lines]
> Regards
> Ajay
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.