Closing a connection

Before your program terminates you need to free all resources you have allocated. If you checked the source on the previous page, you certainly spotted SQLFreeHandle. This function must be used to free each allocated handle. It expects a parameter which states the type of the handle to be freed and the handle itself. So if you want to free an environment handle you should call (in our example program):


Before you free any handle make sure that it is no longer needed, wouldn't be funny, if you released to connection handle but forgot to close the connection ;)

And if you want to close a connection you need SQLDisconnect. This closes the connection associated with the connection handle offered as argument to SQLDisconnect. In our programm we need to call:


If you need source code, please have a look here.