3

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?

GaryO
  • 476
  • 2
  • 16

1 Answers1

2

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.

Oly
  • 583
  • 1
  • 5
  • 15