DatabaseLink`
DatabaseLink`

SQLConnectionUsableQ

SQLConnectionUsableQ[conn]

tests whether or not queries may be issued on conn.

SQLConnectionUsableQ[conn,{sql,res}]

expects result res when issuing sql on conn.

Details

Examples

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: