How to check the status of the native ODBC connection with the Database toolkit?

3 views (last 30 days)
I am exploring the database toolkit and trying to understand its behavior and the status of connections to a MySQL database. I am on Win 7 and utilizing Matlab's native ODBC connection to a MySQL database. I have no trouble connecting and am able to query data, but do not understand how to determine current status and whether the close commands for the cursor and connection are working. Ideally, I would use the matlab ping command but had thought I saw a release note prior to 2014a indicating ping was not supported for native ODBC but I no longer find that googling. Here are my commands to establish the connection and cursor
conn=database.ODBCConnection('MySQLResearch','user','pwd');
SVGLcurs=exec(conn,'select * from SVGL2A');
SVGLcurs=fetch(SVGLcurs);
now if I execute ping:
>> ping(conn)
Undefined function 'ping' for input arguments of type 'database.ODBCConnection'.
The documentation explains that functions like "columns" or "rows" are metadata and not supported by native ODBC but there is nothing under the ping documentation for me to draw a similar conclusion as it directly mentions testing the status of ODBC. Yet the format of the error generated is identical to that of "rows":
>> numrows=rows(SVGLcurs)
Undefined function 'rows' for input arguments of type 'database.ODBCCursor'.
Is ping considered metadata?
Further, after closing the cursor and connection, I am still able to access it:
>> close(SVGLcurs)
>> close(conn)
>> SVGLcurs.Data
ans =
[ 1] [ 1] '1979-12-31' [2947] [2062] [ 14] [ 0]
[ 2] [ 2] '1980-12-31' [2943] [1919] [ 28] [ 6]
[ 3] [ 3] '1981-12-31' [2856] [1805] [ 40] [ 9]
[ 4] [ 4] '1982-12-31' [2752] [1611] [ 27] [ 21]
Is this just a failure on my part to understand what it means to close the cursor? Is there no inconsistency between closing the cursor and seeing what data it is associated with? Is there a command I could execute at this point that would give me similar functionality to ping so I could confirm connection and cursor are truly closed, so I could open another?
I am trying to determine if it is reasonable to have a script with multiple open and close operations or if it is more pragmatic to limit one open and close process per script. Thanks for any suggestions you could share in helping me to better understand.
Tom

Answers (0)

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!