Seb <splu...@gmail.com> writes: > Hi, > > The last code block in ob-doc-sql¹ suggests I should be able to place a > number of #+HEADER lines above my SQL source code to specify the > connection string. I am trying to connect to a remote PostgreSQL > server, and after lots of experimentation, the only way this works for > me is to have a single #+HEADER line with a :cmdline with the entire > connection string. All the other header arguments (:database, :dbuser, > etc.), whether in separate lines or in a single one, seem to be > completely ignored. Using Org 8.2.10 and Emacs 24.4.1 from Debian Sid > packages. Is this a problem with this version combination, or does the > functionality of the header arguments depend on the engine being used? > Thanks. > > > +--- Footnotes ---+ > ¹ http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-sql.html
FWIW, the following worked fine for me: #+name: my-query #+header: :engine postgresql #+header: :dbhost <host> #+header: :dbuser <user> #+header: :dbpassword <password> #+header: :database sheetmusic #+begin_src sql SELECT id, creator, title, category, boxnumber FROM music WHERE id > 300; #+end_src #+RESULTS: my-query | # -*- coding: utf-8 -*- | | | | | | id | creator | title | category | boxnumber | |-------------------------+---------+-------------------------------------------------------------------+-----------+-----------| | 387 | 92 | Lullay my Liking | Christmas | 101 | | 397 | 303 | Te Deum in B minor | General | 314 | | ... GNU Emacs 24.4.50.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.10.9) of 2014-08-11 Org-mode version 8.3beta (release_8.3beta-559-g43ca1f @ /home/nick/elisp/org-mode/lisp/) -- Nick