| Database Toolbox User's Guide | Search  Help Desk |
| close | Examples See Also |
Close database connection or cursor
Syntax
close(conn) close(cursor)
Description
close(conn)
closes the database connection, conn.
close(cursor)
closes the cursor structure, cursor, that was returned by fetch or exec.
Database connections and cursors remain open until you close them using the close command. Always close a cursor or connection when you finish using it so that MATLAB stops reserving memory for it. Also, most databases limit the number of cursors and connections that can be open at one time.
If you terminate a MATLAB session while a cursor and connection are open, MATLAB closes them, but your database might not free up the connection or cursor. Therefore, always close connections and cursors when you finish using them.
Close a cursor before closing the connection used for that cursor.
For command line help on close, use either of the overloaded methods:
help database/close.m help cursor/close.m
Examples
To close the cursorcurs1 and the connection connA, type:
close(curs1); close(connA)
See Also
database, exec, fetch