I guess I've been out of the loop for a while. I used to have this at the end of my org-mode SQL files:

#+PROPERTY: engine mysql
#+PROPERTY: dbhost xx.xx.xx.xx
#+PROPERTY: dbuser xxxxxx
#+PROPERTY: dbpassword xxxxxxxxx
#+PROPERTY: database xxxxxxxxxxxxx

But since I recently updated org-mode, these don't have any effect anymore. In ob-sql I can see they're not getting passed to org-babel-execute:sql.

I tried a different form that I saw in the doc:

#+PROPERTY: header-args:sql :engine mysql
#+PROPERTY: header-args:sql :dbhost xxxxxxx
#+PROPERTY: header-args:sql :dbuser xxxxxxx
#+PROPERTY: header-args:sql :dbpassword xxxxxx
#+PROPERTY: header-args:sql :database xxxxxxxxxxxx

but that doesn't work either. Can anyone tell me the proper new-style form for passing header args to all sql code blocks?

1 Answer 1


This is the format i am using and it works however it does not setup the connection when loading the code, you need to hit ctrl+c ctrl+c twice to execute the block then your src code blocks containing sql will run.

#+PROPERTY: header-args:sql :engine mysql
#+PROPERTY: header-args:sql+ :dbhost xxxxxxx
#+PROPERTY: header-args:sql+ :dbuser xxxxxxx
#+PROPERTY: header-args:sql+ :dbport xxxx 
#+PROPERTY: header-args:sql+ :dbpassword xxxxxx
#+PROPERTY: header-args:sql+ :database xxxxxxxxxxxx

bit late but this confused me so thought i would answer in the hope it helps others.

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.