I would like to evaluate SQL source blocks in Org Babel using the connections I have set up in sql-connection-alist from sql-mode. This way I can save database credentials in a private (Elisp) file and share the files with the queries.

Is there any way to configure this in Org Mode?

1 Answer 1


I submitted a patch to do this: ob-sql.el: Option to reference connections in `sql-connection-alist'. It should be included in the next version of Org Mode.

  • It's out with Org 9.3
    – larsen
    Dec 6, 2019 at 8:33
  • Last time I tried using this I was looking for exactly this and gave up, glad to see it has been added. Super useful - thanks! Dec 17, 2020 at 10:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.