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.
Details and Options
- 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 "AutoCommit" True set the autocommit mode for the connection
Examples
open allclose allBasic 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 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 (10)
"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.
"AutoCommit" (1)
Set the "AutoCommit" option to open a connection. Connecting database with default AutoCommit set to True.
Creating table and inserting data by enabling AutoCommit mode. Insertion operation takes more time when AutoCommit mode is enabled.
Connecting database by disabling AutoCommit mode.
Insertion operation takes less time while performing bulk insert when AutoCommit is disabled.
Insertion is completed but not committed.
Other database connections are not able to see the changes before commit.
Committing the databases changes.
Other database connections are able to see the changes after commit.