Sunday, May 8, 2011

Postgres-psql and Oracle sql*Plus from emacs


  • Just as a brief note, I found out about this nifty feature in emacs:the " sql-mode ". With it you can invoke your favorite sql interpreter in my case psql and sql*plus inside this great editing environment. What does it do? well it provides syntax highlighting and you can detach sql commands from their output.


Here's the emacs wiki entry for those who want to know more:

http://www.emacswiki.org/emacs/SqlMode

the emacs .el module can be downloaded from this link:

http://repo.or.cz/w/emacs.git/blob_plain/HEAD:/lisp/progmodes/sql.el

if you don't know how to install el emacs module here's an easy guide:

http://edward.oconnor.cx/2005/09/installing-elisp-files

once you have it installed, you can access the help file issuing the following emacs command:

M-x sql-help RET

Launching the psql interpreter takes only a:

M-x sql-postgres

and for sql*plus:

M-x sql-oracle

There are some customizations you can do, for example if you work with one database most of time, it can be set to be the default database among other parameters you can set.

Here's a great guide on how to get the best out of this module, but it's in german. Sadly I don't have the time to translate it, but you can always use the google-translate tool.

http://www.mi.hs-rm.de/~barth///dbs/vorl/DBSInfoXEmacs.pdf

[caption id="attachment_287" align="aligncenter" width="255" caption="emacs_sql_mode"][/caption]

No comments:

Post a Comment