This doesn't directly answer your question, but you might want to take a look at the dbext plugin.
This plugin contains functions/mappings/commands to enable Vim to access several databases.
[...]
dbext provides a common interface between your editor and a database. If your company/project moves onto a new database platform, there is no need to learn the new databases tools. While editing your SQL (and without leaving Vim) you can execute database commands, run queries, display results, and view database objects. dbext understands various programming languages, and can parse and prompt the user for [host] variables and execute the resulting statement. See below for more details.
A database client inside Vim!