[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] SQL support in Babel
From: |
Nick Dokos |
Subject: |
Re: [O] SQL support in Babel |
Date: |
Thu, 20 Nov 2014 23:35:50 -0500 |
User-agent: |
Gnus/5.130012 (Ma Gnus v0.12) Emacs/24.4.50 (gnu/linux) |
Seb <address@hidden> 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