Table of Contents
- 2.1 Database Connection Example
- 2.2 Connecting to a Session
- 2.3 Working with a Session Object
- 2.4 Using SQL with Session
- 2.5 Setting the Current Schema
- 2.6 Dynamic SQL
This section explains the concepts of connections and sessions as used by the X DevAPI. Code examples for connecting to a MySQL Document Store (see Using MySQL as a Document Store) and using sessions are provided.
An X DevAPI session is a high-level database session concept that is different from working with traditional low-level MySQL connections. Sessions can encapsulate one or more actual MySQL connections when using the X Protocol. Use of this higher abstraction level decouples the physical MySQL setup from the application code. Sessions provide full support of X DevAPI and limited support of SQL.
For MySQL Shell, when a low-level MySQL connection to a single MySQL instance is needed this is still supported by using a ClassicSession, which provides full support of SQL.
Before looking at the concepts in more detail, the following examples show how to connect using a session.