({{, (RefLink[DatabaseConnect, paclet:ref/DatabaseConnect])[db] 
activates a connection to the database db.}})

OpenersNotesSection(Spacer1)Details

The database db can be specified using (RefLink[DatabaseReference, paclet:ref/DatabaseReference]) or (RefLink[RelationalDatabase, paclet:ref/RelationalDatabase]).

Functions such as (RefLink[RelationalDatabase, paclet:ref/RelationalDatabase]) and (RefLink[EntityValue, paclet:ref/EntityValue]) automatically connect to databases as needed. In general, there is no need to manually connect.

(RefLink[DatabaseConnect, paclet:ref/DatabaseConnect]) returns a (RefLink[Success, paclet:ref/Success]) or a (RefLink[Failure, paclet:ref/Failure]) object.

OpenersPrimaryExamplesSection(Spacer1)Examples  (1)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Connect to an external database:

ref=DatabaseReference[FindFile["ExampleData/ecommerce-database.sqlite"]]

DatabaseConnect[ref]

Check that you are connected:

ref["Connected"]

Disconnect from the database:

DatabaseDisconnect[ref]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[DatabaseDisconnect, paclet:ref/DatabaseDisconnect])  ▪  (RefLink[DatabaseReference, paclet:ref/DatabaseReference])  ▪  (RefLink[RelationalDatabase, paclet:ref/RelationalDatabase])  ▪  (RefLink[EntityPrefetch, paclet:ref/EntityPrefetch])  ▪  (RefLink[ServiceConnect, paclet:ref/ServiceConnect])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Working with Information in Relational Databases, paclet:guide/WorkingWithRelationalDatabases])}})}})