DSN management

Named data sources (DSN) can be used (like in ODBC) to name some connections and define their connection parameters, it becomes easier to use them (one just has to remember the DSN name), and it becomes possible to change the connection parameters without changing any code.

They can be listed using the .l command, and details about a DSN can be listed using the same command with the DSN name as argument:

gda> .l
                              DSN list
DSN                  | Description                          | Provider  
---------------------+--------------------------------------+-----------
Bugzilla             | Bugzilla data source                 | MySQL     
koha                 |                                      | PostgreSQL
SalesTest            | Test database for a sales department | SQLite    
(3 rows)
gda> .l SalesTest
                              DSN 'SalesTest' description
Attribute         | Value                                                                 
------------------+-----------------------------------------------------------------------
DSN               | SalesTest                                                             
Provider          | SQLite                                                                
Description       | Test database for a sales department                                  
Connection string | DB_DIR=/home/user/name/.libgda;DB_NAME=sales_test
Username          |                                                                       
Global            | FALSE                                                                 
(6 rows)
gda>
    

The .lr DSN_NAME [DSN_NAME...] command removes the DSN listed as arguments, and the The .lc command creates (or modifies an existing) DSN, such as show:

gda> .lc my_dsn PostgreSQL://DB_NAME=my_db;HOST=moon
gda> .l my_dsn
        DSN 'my_dsn' description
Attribute         | Value                  
------------------+------------------------
DSN               | my_dsn                 
Provider          | PostgreSQL             
Description       |                        
Connection string | DB_NAME=my_db;HOST=moon
Username          |                        
Global            | FALSE                  
(6 rows)
gda>