OpenSQLConnection
OpenSQLConnection[src]
makes a connection to a named data source.
makes a connection to a data source described by a JDBC object.
opens a GUI for creating and managing named data sources.
更多信息和选项
- To use OpenSQLConnection, you first need to load DatabaseLink using Needs["DatabaseLink`"].
- The following options can be given:
-
"Name" "" name of the connection "Description" "" textual description of the connection "Username" "" username to use for connecting "Password" "" password to use for connecting "Location" "" location of the file that defines the connection "Catalog" Automatic location of the database catalog "Properties" {} key-value pairs, as rules, passed to JDBC driver "ReadOnly" Automatic set the connection to be read only "RelativePath" False indicates whether or not database location is specified relative to configuration (for file-based databases) "Timeout" $SQLTimeout timeout setting for operations, in seconds "TransactionIsolationLevel" Automatic set transaction isolation for the connection "UseConnectionPool" Automatic open the connection from a managed pool "Version" None version of the configuration file
范例
打开所有单元关闭所有单元基本范例 (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 named data source:
Open a connection to a data source specified using JDBC:
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.
Options (9)
"Catalog" (1)
"Properties" (1)
"ReadOnly" (1)
"RelativePath" (1)
"Timeout" (1)
A connection attempt will time out in $SQLTimeout seconds, which has a driver-dependent default. Override it with the "Timeout" option, supplying an integer number of seconds:
"TransactionIsolationLevel" (1)
Transactions on the opened connection are isolated using a driver-dependent default. Override it with the "TransactionIsolationLevel" option, supplying one of "ReadUncommitted", "ReadCommitted", "RepeatableRead", or "Serializable":
More information about transactions and isolation levels is available in the Transactions tutorial.
"UseConnectionPool" (1)
Set the "UseConnectionPool" option to open a connection in a managed pool. The pool will be created if it does not already exist:
This is the pool object associated with the connection:
Close the pool and any associated connections:
More information about connection pools is available in the Connection Pools tutorial.