| 1 | <HTML> |
| 2 | <HEAD> |
| 3 | <META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1"> |
| 4 | <TITLE>Closing a connection</TITLE> |
| 5 | <LINK REL="Stylesheet" href="odbc.css"> |
| 6 | </HEAD> |
| 7 | <BODY bgcolor="white"> |
| 8 | |
| 9 | <table width="90%" cols="3" border="0"> |
| 10 | <TR> |
| 11 | <TD colspan="3" class="big">Closing a connection</TD> |
| 12 | </TR> |
| 13 | <TR> |
| 14 | <TD colspan="3"><P>Before your program terminates you need to free all resources you |
| 15 | have allocated. If you checked the source on the previous page, you certainly |
| 16 | spotted <CODE><A HREF="gloss.html#free">SQLFreeHandle</A></CODE>. This function must be used |
| 17 | to free each allocated handle. It expects a parameter which states the type of the handle |
| 18 | to be freed and the handle itself. So if you want to free an environment handle you should |
| 19 | call (in our example program):</P> |
| 20 | <CODE> |
| 21 | SQLFreeHandle(SQL_HANDLE_ENV, V_OD_Env); |
| 22 | </CODE> |
| 23 | <P> |
| 24 | Before you free any handle make sure that it is no longer needed, wouldn't be funny, if you |
| 25 | released to connection handle but forgot to close the connection ;)</P> |
| 26 | <P> |
| 27 | And if you want to close a connection you need <CODE><A HREF="gloss.html#clos">SQLDisconnect</A></CODE>. |
| 28 | This closes the connection associated with the connection handle offered as argument to <CODE>SQLDisconnect</CODE>. |
| 29 | In our program we need to call:</P> |
| 30 | <CODE> |
| 31 | SQLDisconnect(V_OD_hdbc); |
| 32 | </CODE> |
| 33 | <P> |
| 34 | If you need source code, please have a look <A HREF="conne.html#list">here</A>.</P> |
| 35 | </TD> |
| 36 | </TR> |
| 37 | </TABLE> |
| 38 | </BODY> |
| 39 | </HTML> |