MATLAB DATABASE TOOLBOX RELEASE NOTES User's Guide Page 465

  • Download
  • Add to my manuals
  • Print
  • Page
    / 684
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 464
cursor.fetch
7-35
Fetching large amounts of data can result in memory or speed issues. In this case, use
rowLimit to limit how much data you retrieve at once.
Caution: Leaving cursor and connection objects open or overwriting open objects can
result in unexpected behavior. Once you are finished working with these objects, you
must close them using close.
Examples
Import All Rows of Data Using the Native ODBC Interface
Create a connection conn using the native ODBC interface and the dbtoolboxdemo
data source.
conn = database.ODBCConnection('dbtoolboxdemo','admin','admin')
conn =
ODBCConnection with properties:
Instance: 'dbtoolboxdemo'
UserName: 'admin'
Message: []
Handle: [1x1 database.internal.ODBCConnectHandle]
TimeOut: 0
AutoCommit: 0
Type: 'ODBCConnection Object'
conn has an empty Message property, which means a successful connection.
Use fetch to import all data into the database.ODBCCursor object, curs, and store
the data in a cell array contained in the cursor object field curs.Data.
curs = exec(conn,'select productDescription from productTable');
curs = fetch(curs)
curs =
ODBCCursor with properties:
Data: {10x1 cell}
RowLimit: 0
SQLQuery: 'select productDescription from productTable'
Message: []
Type: 'ODBCCursor Object'
Page view 464
1 2 ... 460 461 462 463 464 465 466 467 468 469 470 ... 683 684

Comments to this Manuals

No comments