-
July 29th, 2017, 11:45 PM
#1
Function sequence error
Hi,
My application connects to MS SQL Server performs some queries and then disconnects and finishes.
Upon disconnecting I'm releasing all handles that I allocated on connection. Unfortunately when releasing the very last one (environment handle) I'm getting "Function sequence error".
Now my question is - Since it is MS SQL Server I'm allocating many different connection and statement handles and then release them afterwards.
Is there a way for me to get which function didn't close the connection or release HDBC handle?
If there is none - what would you recommend for the debugging this issue? Moving thru the code would be hard as it is a big code (even though I wrote all of it) and I'm afraid I may just inadvertently skip the error.
Thank you for any pointers.
-
July 30th, 2017, 09:25 PM
#2
Re: Function sequence error
I forget, are you limited to C in this project?
-
July 30th, 2017, 09:56 PM
#3
Re: Function sequence error
Hi,
Originally Posted by Arjay
I forget, are you limited to C in this project?
Nope. It is C++ one.
But ODBC API is C one.
Thank you.
-
July 31st, 2017, 09:38 AM
#4
Re: Function sequence error
I have to wonder why you are using raw ODBC when there are C++ alternatives like OleDb and the ATL consumer classes where the programmer doesn't have to handle every aspect of allocating memory for data retrieval. Since these alternatives are in C++, the class destructors handle the cleanup.
I find the ATL Consumer classes particularly easy to work with. As there is a wizard the allows you to point to a view, sproc or table and the necessary classes are generated and added to your project.
-
July 31st, 2017, 10:58 AM
#5
Re: Function sequence error
Hi, Arjay,
Originally Posted by Arjay
I have to wonder why you are using raw ODBC when there are C++ alternatives like OleDb and the ATL consumer classes where the programmer doesn't have to handle every aspect of allocating memory for data retrieval. Since these alternatives are in C++, the class destructors handle the cleanup.
Is OLEDB and ATL cross-platform solutions? Cross-DB solutions?
Originally Posted by Arjay
I find the ATL Consumer classes particularly easy to work with. As there is a wizard the allows you to point to a view, sproc or table and the necessary classes are generated and added to your project.
Is there an alternatives for *nix/OSX to those 2 above?
Thank you.
-
August 1st, 2017, 10:11 AM
#6
Re: Function sequence error
Originally Posted by OneEyeMan
Is OLEDB and ATL cross-platform solutions?
Is there an alternatives for *nix/OSX to those 2 above?
Thank you.
Historically, the Visual C++ Programming forum has implied Windows as the platform and the use of frameworks such as MFC and ATL. I suppose with the cross platform support in VS 2017, this has changed. Both OleDb and ATL rely on COM so cross platform for each is out. Really a shame to have to manually do this with ODBC.
-
August 1st, 2017, 10:57 AM
#7
Re: Function sequence error
Arjay,
So now back to my question - is there a way to debug this that does not involve going thru the code manually?
Thank you.
-
August 1st, 2017, 01:08 PM
#8
Re: Function sequence error
Originally Posted by OneEyeMan
Arjay,
So now back to my question - is there a way to debug this that does not involve going thru the code manually?
Thank you.
It would be good to structure the ODBC code into classes and leverage the destructors to clean up any allocated memory or handles.
Of course, if this has not been done, then you'll need to track down the issues manually. If you have put the ODBC code into its own dll, then perhaps you can isolate the problems with some specific tests?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|