I was trying to export to pdf with C-c C-e l o and would get an error to run ejc-connect first. Then I realized that export is a "new" buffer, so I added the :cache yes to the header and that allowed the export to use the cached results rather than invoking the query again.
***** demo sql
#+begin_src sql :results raw :exports both :cache yes
SELECT
whencreated,
whenChanged,
userAccountControl
FROM
GCSnap where samaccountname like 'guest'
#+end_src
#+RESULTS[e2e15d13332ce674b982da1bb01327abaf8644ab]:
| whencreated | whenchanged | useraccountcontrol |
|-----------------------+-----------------------+--------------------|
| 2014-06-09 18:51:05.0 | 2019-10-11 23:08:53.0 | 514 |
I was trying to export to pdf with
C-c C-e l o
and would get an error to run ejc-connect first. Then I realized that export is a "new" buffer, so I added the:cache yes
to the header and that allowed the export to use the cached results rather than invoking the query again.