tests whether or not queries may be issued on conn.


expects result res when issuing sql on conn.

Details and Options

  • To use SQLConnectionUsableQ, you first need to load DatabaseLink using Needs["DatabaseLink`"].
  • SQLConnectionUsableQ is a server-side test and initiates communication with the connection's target server, local or remote.


open allclose all

Basic Examples  (1)

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 to a sample database:

Test the connection's usability:

Close the connection:

Test the connection's usability again:

Generalizations & Extensions  (1)

SQLConnectionUsableQ issues a test query whose contents depend on the RDBMS conn is connected to. When using custom drivers, use the two-argument form to supply your own test:

Properties & Relations  (1)

SQLConnectionUsableQ initiates server communication and is therefore a stronger test than SQLConnectionOpenQ. However, it will generally take longer to evaluate:

Close the connection: