SQLConnectionOpenQ[conn]
tests whether or not conn is a valid connection object.
SQLConnectionOpenQ
SQLConnectionOpenQ[conn]
tests whether or not conn is a valid connection object.
Details and Options
- To use SQLConnectionOpenQ, you first need to load DatabaseLink using Needs["DatabaseLink`"].
- SQLConnectionOpenQ is strictly a client-side test and initiates no communication with the connection's target server, local or remote.
Examples
open all close allBasic Examples (1)
Needs["DatabaseLink`"]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:
conn = OpenSQLConnection["demo"]Test the connection's validity:
SQLConnectionOpenQ[conn]CloseSQLConnection[conn];Test the connection's validity again:
SQLConnectionOpenQ[conn]Properties & Relations (1)
Needs["DatabaseLink`"]SQLConnectionOpenQ initiates no server communication, so a True result does not imply that queries may be issued on the connection. Use SQLConnectionUsableQ for this purpose:
conn = OpenSQLConnection["demo"]Through[{SQLConnectionOpenQ, SQLConnectionUsableQ}[conn]]Since SQLConnectionUsableQ performs server communication, it will generally take longer than SQLConnectionOpenQ to evaluate:
AbsoluteTiming[#[conn]]& /@ {SQLConnectionOpenQ, SQLConnectionUsableQ}CloseSQLConnection[conn];