| GNOME Data Access 5 manual |
|---|
The Libgda's SQL console tool runs is a terminal emulator, and can be launched using the gda-sql (or gda-sql-<version> for a specific version):
gda-sql [--help] [-l] [-L] [-C command] [-f commands file] [-o output file] [-sport to use to run embedded HTTP server] [-tauthentication token required to authenticate clients when running the embedded HTTP server] [connection specification...]
The options are the following ones:
the --help option gives a short help summary
the -l and -L options respectively
output a list of the defined data sources (DSN) and of the installed database adaptaters
(database providers):
[prompt]> gda-sql -l
List of defined data sources
DSN | Provider | Description | Connection string | Username | Global
----------+----------+--------------------------------------+------------------------------+----------+-------
SalesTest | SQLite | Test database for a sales department | DB_DIR=/adir;DB_NAME=data.db | | FALSE
[...]
[prompt]> gda-sql -L
Installed providers list
Provider | Description
---------------+------------------------------------------------------------------------------------
Berkeley-DB | Provider for Berkeley databases
Firebird | Provider for Firebird databases
FirebirdEmbed | Provider for embedded Firebird databases
Ldap | Provider for database where tables are based on data contained in an LDAP directory
MSAccess | Provider for Microsoft Access files
[...]
[prompt]> ./gda-sql -L PostgreSQL
Provider 'PostgreSQL' description
Attribute | Value
---------------+---------------------------------------------------------------------------------------------------------------------------------------
Provider | PostgreSQL
Description | Provider for PostgreSQL databases
DSN parameters | DB_NAME: Database name. The name of a database to connect to (string),
SEARCHPATH: Search Path. Search path among database's schemas ('search_path' variable) (string),
HOST: Database server. Host on which the database server is running (for servers running on unix domain sockets, enter the socket's pa
PORT: Port. Database server port (for servers running on unix domain sockets, enter the socket's file name extension (usually 5432), o
OPTIONS: Options. Extra connection options (string),
USE_SSL: Require SSL. Whether or not to use SSL to establish the connection (boolean),
CONNECT_TIMEOUT: Connection timeout. Maximum wait for connection, in seconds. Zero or not specified means wait indefinitely. It is not
Authentication | USERNAME (string),
PASSWORD (string)
File | /local/extra/lib/libgda-5.0/providers/libgda-postgres.so
(5 rows)
the -C and -f options repectively allow
one to specify a single command to be run or a filename containing the commands to run
before the tool exits
the -o option allows to specify a file to write the
output to
the -s requests the embedded HTTP server to be executed, listening on
the port specified.
the -t specifies a token string which clients will have to
supply to authenticate themselves to the HTTP server, if running.
Connections to be opened can be specified on the command line using either:
defined data sources (the ones listed using the -l option)
connection strings which have the following format: "[<provider>://][<username>[:<password>]@]<connection_params>". If a username or password is required, and is not specified either by a DSN's definition or in the connection string, then it will be requested dynamically. Note that if provided, <username>, <password> and <provider> must be encoded as per RFC 1738
for SQLite and MS Access files: the file name
Connections can also be opened while the tool is running using the .c internal command.
Examples:
[prompt]> gda-sql Sales
[prompt]> gda-sql Postgresql://username@DB_NAME=mydb SQLite://DB_NAME=fspot Sales
[prompt]> gda-sql path/to/dbfile.db