I am looking to connect ConTeXt to a SQL Server database. I have looked through the manuals, and even read pragma-ade's SQL PDF (which, for me, seems a bit abstract). I am not extremely familiar with Lua but have read up on the language (I am more familiar with JS). For LaTex I used nlatexdb which did the trick, but LaTex isn't able to do what ConTeXt can.

  • The connection needs to use Windows Authentication.

  • The document is set up as a letter with an environment that it pulls from.

  • It would be preferable to have the connection and queries be seperate from the letter itself, and be able to place variables into the letter that can be populated through the queries (much like nlatexdb) if possible.

    • example: Dear ??first ??last, Thank you for your interest in ??product... etc.

I am rather new to ConText and just starting to get the hang of it, long time latex user, the transition starts off rather confusing, but once it makes sense it opens up a whole toolbox of available tools which is great. Just need this one last tool.

Any help would be much appreciated.

EDIT:: Honestly I haven't gotten to any point that I felt I could attempt trying the connection. Looking at the SQL PDF from pragma-ade it should look something like:

    local presets = {
    server = "XXX\XXX",
    Database = "Customer",
    Integrated Security = "True",
    presets.id = "XXX"
    local template = [[
    'Control_Name' LIKE 'Long_Name' AND 'Client_Id' = 154;

    local data, keys = utilities.sql.execute {
    presets = presets,
    template = template,
    variables = {},

I can't seem to find where or how the connection is being made, except perhaps where utilities.sql.execute is called, but I can't find any information anywhere about such a call in lua or context...

  • Welcome to TeX.SE! Please post an example of what you've tried so far.
    – Mico
    May 23 '14 at 17:33
  • You could increase you chances of getting an answer a lot by asking on the mailing list. May 23 '14 at 19:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.