Archive for December, 2008

Efficient SQL console

Thursday, December 11th, 2008

I’ve been using SQL consoles for years. Each database has its own SQL console: psql for PostgreSQL, mysql for MySQL, sqlite3 for SQLite3, sqlplus for Oracle,… When one needs information about database objects such as for example the tables, their columns and relations with other tables, one has to remember the syntax to use depending on th SQL console (for example to list the tables: \dt for PostgreSQL, show tables; for MySQL, select name from sqlite_master where type=’table'; for SQLite3).

This can be quite frustrating when using several databases and consoles, and is the reason I decided to write yet another SQL console, part of Libgda which overcomes all these little difficulties. The syntax (and displayed information) is the same for every database Libgda can connect to.

I’ve recently improved it even more by turning the SQL console into a web server to display meta data in a user friendly way. Here is the use case: the user uses the SQL console normally and then decides to start the web server (through a \http command) and then points his web browser to http://localhost:12345 (the port number can also be specified). Here is below the kind of information displayed:

There is at the moment no security around the web server (anyone can connect) but this will be added.