SQL Support

For you database folks out there, you can even run interactive SQL sessions through Emacs. You can navigate through your SQL command history using normal motion commands and even create complex SQL statements in any buffer and then shuttle them off to the interactive area for debugging.

Prerequisites

Before we get started with SQL queries, you do need to have a few things in place. Most of the SQL interaction modes require an actual client application for their particular database. For example, we use the MySQL server. We have to install the MySQL client programs (mysql, at a minimum) on any system where we want to use SQL mode. Even though the MySQL version of SQL mode is built-in, we still need access to a real client. This is true for every type of database you expect to access.

And speaking of communicating with the database, you must also have the basics of communication taken care of. You need to have network access to the server in question. You also need to have a valid username and password for connecting to that server. A good rule before jumping into SQL mode in Emacs is to make sure you can connect and interact with your database server from your machine. If it works from a terminal window or other client application, you can make it work in Emacs.

One last thing to remember: the various SQL modes in Emacs are just helpers, so you can't do anything with them that you couldn't do with your normal database client. You won't magically have access to that restricted ...

Get Learning GNU Emacs, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.