.open opens a JDBC connection in the current session. If the current session already has an open database connection, the command would fail.

In order for .open command to work, .protocol and .classpath settings must be configured before the protocol is used to open a connection.


usage: .open [options] [url]
  -D <name=value>       set a connection property
  -f,--prompt           force password prompt
  -p,--password <arg>   specify the password
  -u,--user <arg>       specify the user


URL is basically a JDBC connection URL without jdbc: prefix.


-- Open a Teradata session with client character set being UTF8.
.open -u dbc -p dbc teradata://

-- Open a PostgreSQL connection with user postgres and empty password
.open -u postgres postgresql://

-- Open a MySQL connection with root user, and default database vagrant
.open -u root mysql://localhost/vagrant

-- Open SQLite in-memory database
.open sqlite::memory: