From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/87587 Path: news.gmane.org!not-for-mail From: Matt Baker Newsgroups: gmane.comp.tex.context Subject: Re: LuaTeX/ConTeXt connect to SQL Server Date: Mon, 26 May 2014 13:48:33 -0600 Message-ID: References: <53839075.7090008@wxs.nl> Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="===============0090495944==" X-Trace: ger.gmane.org 1401133739 964 80.91.229.3 (26 May 2014 19:48:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 26 May 2014 19:48:59 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Mon May 26 21:48:53 2014 Return-path: Envelope-to: gctc-ntg-context-518@m.gmane.org Original-Received: from balder.ntg.nl ([5.39.185.229]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Wp0tA-0001oR-Uz for gctc-ntg-context-518@m.gmane.org; Mon, 26 May 2014 21:48:53 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id 4752A1022D for ; Mon, 26 May 2014 21:48:52 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id Ncdspmg9LR5F for ; Mon, 26 May 2014 21:48:52 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 7AAD41022F for ; Mon, 26 May 2014 21:48:46 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id A40D8101E6 for ; Mon, 26 May 2014 21:48:42 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at balder.ntg.nl Original-Received: from balder.ntg.nl ([127.0.0.1]) by localhost (balder.ntg.nl [127.0.0.1]) (amavisd-new, port 10024) with LMTP id gjfae8xK9NPU for ; Mon, 26 May 2014 21:48:41 +0200 (CEST) Original-Received: from filter1-utr.mf.surf.net (filter1-utr.mf.surf.net [195.169.124.152]) by balder.ntg.nl (Postfix) with ESMTP id F0040101EC for ; Mon, 26 May 2014 21:48:35 +0200 (CEST) Original-Received: from mail-ig0-x22f.google.com (mail-ig0-x22f.google.com [IPv6:2607:f8b0:4001:c05::22f]) by filter1-utr.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id s4QJmWOI010103 (version=TLSv1/SSLv3 cipher=RC4-SHA bits=128 verify=NOT) for ; Mon, 26 May 2014 21:48:33 +0200 Original-Received: by mail-ig0-f175.google.com with SMTP id uq10so294449igb.14 for ; Mon, 26 May 2014 12:48:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=AHZVAJfFYvZFyWn8DYRHnsHvVB/ajdUszaudKEuj0hs=; b=S+jstVXCchSRc/O6CnNlOw98EYE26PBc8qllP9J18MRpogAD7WNeu9ZBm3ssZthTQ0 CYSL+c6RsI1Y+6L3Hf8dO3d0XS8CDMhDXNbYCmhh27bzKIExqU8F8hqOBFbowBtNE3TR iMkZA+pt/n8rBXKP3EH6nwfF74sUoNGN+ZslXk792/qSsMgPmdFunkP3VZJnixdGVr9V 9yTEBbsF9btxOaiycWMG4DKCcfmx6I8hdx42kADjCNpnh/nFr8m7JXDG+oXFiWSRK8bU dx0KznbgP+JoP3qIXADvcvLjY10cmECnPlfk94qq1gWCe17rCOrVxXRFdga7YxP9Bm8G cRrA== X-Received: by 10.50.78.168 with SMTP id c8mr36073369igx.0.1401133713316; Mon, 26 May 2014 12:48:33 -0700 (PDT) Original-Received: by 10.42.97.69 with HTTP; Mon, 26 May 2014 12:48:33 -0700 (PDT) In-Reply-To: <53839075.7090008@wxs.nl> X-Bayes-Prob: 0.0001 (Score 0, tokens from: ntg-context@ntg.nl, base:default, @@RPTN) X-CanIt-Geo: ip=2607:f8b0:4001:c05::22f; country=US X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 07M6HMxsj - 58e1fdef60eb - 20140526 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) X-BeenThere: ntg-context@ntg.nl X-Mailman-Version: 2.1.14 Precedence: list List-Id: mailing list for ConTeXt users List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: ntg-context-bounces@ntg.nl Original-Sender: ntg-context-bounces@ntg.nl Xref: news.gmane.org gmane.comp.tex.context:87587 Archived-At: --===============0090495944== Content-Type: multipart/alternative; boundary=089e0122e68243e44f04fa52dda6 --089e0122e68243e44f04fa52dda6 Content-Type: text/plain; charset=UTF-8 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). 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. 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. Thanks! On Mon, May 26, 2014 at 1:05 PM, Hans Hagen wrote: > On 5/26/2014 6:38 PM, Matt Baker wrote: > >> FROM MY POSTING AT: >> http://tex.stackexchange.com/questions/180018/luatex- >> context-connect-to-sql-server?noredirect=1#comment415824_180018 >> >> 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", >> } >> > > I have no clue where get that setup from as the manual says: > > local presets = { > database = "test", > username = "root", > password = "none", > host = "localhost", > port = 3306, > } > > or something like that. The same kind of connection info that the mysql > client needs. > > presets.id = "XXX" >> > > ? > > > local template = [[ >> SELECT >> 'Control_Content' >> FROM >> 'Customer.dbo.Report_Client_Data' >> WHERE >> 'Control_Name' LIKE 'Long_Name' AND 'Client_Id' = 154; >> ]] >> >> local data, keys = utilities.sql.execute { >> presets = presets, >> template = template, >> variables = {}, >> } >> > > should work given a proper preset table > > > 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... >> > > you can best start with using the command line client approach: > > sql.setmethod("client") > > because the other methods assume a library that matches your luatex (this > should works ok with regular mysql or swiglib bindings but it adds a level > of complication) > > Hans > > > ----------------------------------------------------------------- > 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 > ----------------------------------------------------------------- > ____________________________________________________________ > _______________________ > If your question is of interest to others as well, please add an entry to > the Wiki! > > maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/ > listinfo/ntg-context > webpage : http://www.pragma-ade.nl / http://tex.aanhet.net > archive : http://foundry.supelec.fr/projects/contextrev/ > wiki : http://contextgarden.net > ____________________________________________________________ > _______________________ > --089e0122e68243e44f04fa52dda6 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
I apologize, I'm not completely understanding you. =C2= =A0So the reason I have:
=C2=A0local presets =3D {
=C2=A0 =C2=A0 =C2=A0server =3D "XXX\XXX",
=C2=A0 = =C2=A0 =C2=A0Database =3D "Customer",
=C2=A0 =C2=A0 =C2=A0Integrated Security =3D "True",<= span style=3D"color:rgb(80,0,80);font-family:arial,sans-serif;font-size:13p= x">=C2=A0 =C2=A0 =C2=A0}
Is it would need to look something like this - or an equivalent. = =C2=A0There 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 (t= his model is based lightly on the C# connection model).

Is there not a prebuilt library to access SQL built into the LuaTeX/Con= TeXT libraries? =C2=A0It seems that there should be a method in which I cou= ld include a set of database queries in an external document that can link = to the tex document. =C2=A0The closest I am to being familiar with any of t= his is Nlatexdb (based off of latexdb and rlatexdb)=C2=A0
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.
Perhaps if you could show me an example do= cument that links to a DB might be=C2=A0beneficial... I was hoping you woul= d have shown this at the end of=C2=A0your PDF.

Thanks!
<= /div>


On Mon, = May 26, 2014 at 1:05 PM, Hans Hagen <pragma@wxs.nl> wrote:
On 5/26/2014 6:38 PM, Matt B= aker wrote:
FROM MY POSTING AT:
h= ttp://tex.stackexchange.com/questions/180018/luatex-context-c= onnect-to-sql-server?noredirect=3D1#comment415824_180018<= br>
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<= br> which did the trick, but LaTex isn't able to do what ConTeXt can.

=C2=A0 =C2=A0 -

=C2=A0 =C2=A0 The connection needs to use Windows Authentication.
=C2=A0 =C2=A0 -

=C2=A0 =C2=A0 The document is set up as a letter with an environment that i= t pulls
=C2=A0 =C2=A0 from.
=C2=A0 =C2=A0 -

=C2=A0 =C2=A0 It would be preferable to have the connection and queries be = seperate
=C2=A0 =C2=A0 from the letter itself, and be able to place variables into t= he letter that
=C2=A0 =C2=A0 can be populated through the queries (much like nlatexdb) if = possible.
=C2=A0 =C2=A0 - example: Dear ??first ??last, Thank you for your interest i= n

=C2=A0 =C2=A0 =C2=A0 =C2=A0??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.<= br> 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 attem= pt
trying the connection. Looking at the SQL PDF from pragma-ade it should
look something like:

=C2=A0 =C2=A0 =C2=A0local presets =3D {
=C2=A0 =C2=A0 =C2=A0server =3D "XXX\XXX",
=C2=A0 =C2=A0 =C2=A0Database =3D "Customer",
=C2=A0 =C2=A0 =C2=A0Integrated Security =3D "True",
=C2=A0 =C2=A0 =C2=A0}

I have no clue where get that setup from as the manual says:

local presets =3D {
=C2=A0 =C2=A0 database =3D "test",
=C2=A0 =C2=A0 username =3D "root",
=C2=A0 =C2=A0 password =3D "none",
=C2=A0 =C2=A0 host =C2=A0 =C2=A0 =3D "localhost",
=C2=A0 =C2=A0 port =C2=A0 =C2=A0 =3D 3306,
}

or something like that. The same kind of connection info that the mysql cli= ent needs.

=C2=A0 =C2=A0 =C2=A0presets= .id =3D "XXX"

?


=C2=A0 =C2=A0 =C2=A0local template =3D [[
=C2=A0 =C2=A0 =C2=A0SELECT
=C2=A0 =C2=A0 =C2=A0'Control_Content'
=C2=A0 =C2=A0 =C2=A0FROM
=C2=A0 =C2=A0 =C2=A0'Customer.dbo.Report_Client_Data'
=C2=A0 =C2=A0 =C2=A0WHERE
=C2=A0 =C2=A0 =C2=A0'Control_Name' LIKE 'Long_Name' AND = 9;Client_Id' =3D 154;
=C2=A0 =C2=A0 =C2=A0 ]]

=C2=A0 =C2=A0 =C2=A0local data, keys =3D utilities.sql.execute {
=C2=A0 =C2=A0 =C2=A0presets =3D presets,
=C2=A0 =C2=A0 =C2=A0template =3D template,
=C2=A0 =C2=A0 =C2=A0variables =3D {},
=C2=A0 =C2=A0 =C2=A0}

should work given a proper preset table


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

you can best start with using the command line client approach:

=C2=A0 sql.setmethod("client")

because the other methods assume a library that matches your luatex (this s= hould works ok with regular mysql or swiglib bindings but it adds a level o= f complication)

Hans


-------------------------------------------------------------= ----
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 H= ans Hagen | PRAGMA ADE
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 Ridderstraat 27 | 8061 GH = Hasselt | The Netherlands
=C2=A0 =C2=A0 tel: 038 477 53 69 | voip: 087 875 68 74 | www.pragma-ade.com
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0| www.p= ragma-pod.nl
-------------------------------------------------------------= ----
_____________________________________________________________= ______________________
If your question is of interest to others as well, please add an entry to t= he Wiki!

maillist : ntg-cont= ext@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage =C2=A0:
http= ://www.pragma-ade.nl / http://tex.aanhet.net
archive =C2=A0: http://foundry.supelec.fr/projects/contextrev/=
wiki =C2=A0 =C2=A0 : http://contextgarden.net
_____________________________________________________________= ______________________

--089e0122e68243e44f04fa52dda6-- --===============0090495944== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline ___________________________________________________________________________________ If your question is of interest to others as well, please add an entry to the Wiki! maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context webpage : http://www.pragma-ade.nl / http://tex.aanhet.net archive : http://foundry.supelec.fr/projects/contextrev/ wiki : http://contextgarden.net ___________________________________________________________________________________ --===============0090495944==--