[NTG-context] LuaTeX/ConTeXt connect to SQL Server

Hans Hagen pragma at wxs.nl
Mon May 26 22:56:43 CEST 2014

On 5/26/2014 9:48 PM, Matt Baker wrote:
> I apologize, I'm not completely understanding you.  So the reason I have:
>   local presets = {
>       server = "XXX\XXX",
>       Database = "Customer",
>       Integrated Security = "True",
>       }
> Is it would need to look something like this - or an equivalent.  There
> Server would need to be the location of the DB Server, then the DB name,
> and then some way to tell it to utilize windows authentication (this model
> is based lightly on the C# connection model).

no, it should look like this:

local presets = {
     database = "test",
     username = "root",
     password = "none",
     host     = "localhost",
     port     = 3306,

You should use lowercase keys. Spaces in keys are impossible anyway 
unless you use ["foo bar"] = "xxx". It's Lua, so some basic 
understanding of Lua helps.

I'm unaware of windows auth, but username/pwd should work okay.

> Is there not a prebuilt library to access SQL built into the LuaTeX/ConTeXT
> libraries?  It seems that there should be a method in which I could include
> a set of database queries in an external document that can link to the tex


> document.  The closest I am to being familiar with any of this is Nlatexdb
> (based off of latexdb and rlatexdb) http://www.ctan.org/pkg/nlatexdb .
> I am rather new to ConTeXT and Lua so I am struggling with wrapping my head
> around all of this as it is.

The interface in context is an abstraction layer that can use several 

- the command line mysql program (client)
- the luasql library (not the best piece of code)
- the swiglib lua binding

and starting with the client method is easiest as one can also mimmick 
that on the command line.

> Perhaps if you could show me an example document that links to a DB might
> be beneficial... I was hoping you would have shown this at the end of your
> PDF.

attached some left-overs from the 2012 context conference

                                           Hans Hagen | PRAGMA ADE
               Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
                                              | www.pragma-pod.nl
-------------- next part --------------
A non-text attachment was scrubbed...
Name: demo-sql.pdf
Type: application/x-pdf
Size: 31244 bytes
Desc: not available
URL: <http://www.ntg.nl/pipermail/ntg-context/attachments/20140526/f265cbcc/attachment-0001.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: demo-sql.tex
Type: application/x-tex
Size: 5458 bytes
Desc: not available
URL: <http://www.ntg.nl/pipermail/ntg-context/attachments/20140526/f265cbcc/attachment-0001.tex>

More information about the ntg-context mailing list