DatabaseLink`
DatabaseLink`

SQLResultSetOpen

SQLResultSetOpen[query]

makes a result set from an SQL query.

Details and Options

  • To use SQLResultSetOpen, you first need to load DatabaseLink using Needs["DatabaseLink`"].
  • The following options can be given:
  • "Mode" "ScrollInsensitive"the timeout for the query
    "FetchDirection" Automaticprocessing direction hint to JDBC driver
    "FetchSize"AutomaticJDBC driver hint for filling result sets

Examples

open allclose all

Basic Examples  (2)

If you find that the examples in this section do not work as shown, you may need to install or restore the example database with the DatabaseLink`DatabaseExamples` package, as described in Using the Example Databases.

Open a connection:

Use SQLSelect instead of SQLExecute:

Options  (3)

"Mode"  (2)

Specify one of "ForwardOnly", "ScrollInsensitive", or "ScrollSensitive", depending on whether the desired result set is scrollable and sensitive to changes in the underlying data:

The mode "MySQLStreaming" is supported by some MySQL drivers. This unscrollable mode is suitable for streaming large result sets with low memory use:

Compute memory in use, including both kernel and Java layers:

Read a conventional forward-only result set 100 rows at a time:

Memory use is relatively high, as the driver is keeping a copy of the result set in memory:

Reset:

Read the result set in streaming mode:

Memory use in the streaming case is relatively low:

"FetchDirection"  (1)

Specify "Forward", "Reverse", or "Unknown" to direct the JDBC driver to employ different fetching and caching strategies: