From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.comp.tex.context/87585 Path: news.gmane.org!not-for-mail From: Hans Hagen Newsgroups: gmane.comp.tex.context Subject: Re: LuaTeX/ConTeXt connect to SQL Server Date: Mon, 26 May 2014 21:05:25 +0200 Message-ID: <53839075.7090008@wxs.nl> References: Reply-To: mailing list for ConTeXt users NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1401131152 4981 80.91.229.3 (26 May 2014 19:05:52 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 26 May 2014 19:05:52 +0000 (UTC) To: mailing list for ConTeXt users Original-X-From: ntg-context-bounces@ntg.nl Mon May 26 21:05:46 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 1Wp0DS-0003im-Cj for gctc-ntg-context-518@m.gmane.org; Mon, 26 May 2014 21:05:46 +0200 Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id E0BED1024A for ; Mon, 26 May 2014 21:05:45 +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 y4utm-ICVXLI for ; Mon, 26 May 2014 21:05:45 +0200 (CEST) Original-Received: from balder.ntg.nl (localhost [IPv6:::1]) by balder.ntg.nl (Postfix) with ESMTP id 0ADD8101FE for ; Mon, 26 May 2014 21:05:42 +0200 (CEST) Original-Received: from localhost (localhost [127.0.0.1]) by balder.ntg.nl (Postfix) with ESMTP id CE531101EC for ; Mon, 26 May 2014 21:05:37 +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 IEPDI1kwcto7 for ; Mon, 26 May 2014 21:05:36 +0200 (CEST) Original-Received: from filter2-ams.mf.surf.net (filter2-ams.mf.surf.net [192.87.102.70]) by balder.ntg.nl (Postfix) with ESMTP id 305E3101E6 for ; Mon, 26 May 2014 21:05:30 +0200 (CEST) Original-Received: from smtp.ziggozakelijk.nl (D57D1DA2.static.ziggozakelijk.nl [213.125.29.162]) by filter2-ams.mf.surf.net (8.14.3/8.14.3/Debian-9.4) with ESMTP id s4QJ5Uj4007086 for ; Mon, 26 May 2014 21:05:30 +0200 X-Default-Received-SPF: pass (skip=loggedin (res=PASS)) x-ip-name=10.100.1.104; Original-Received: from [10.100.1.104] (unverified [10.100.1.104]) by pragma-net.nl (SurgeMail 6.5a2) with ESMTP id 3744-1713362 for ; Mon, 26 May 2014 21:05:28 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.5.0 In-Reply-To: X-Authenticated-User: hagen@controller-9 X-Bayes-Prob: 0.0001 (Score 0, tokens from: ntg-context@ntg.nl, base:default, @@RPTN) X-CanIt-Geo: ip=213.125.29.162; country=NL; region=Provincie Overijssel; city=Zwolle; latitude=52.5058; longitude=6.0858; http://maps.google.com/maps?q=52.5058,6.0858&z=6 X-CanItPRO-Stream: uu:ntg-context@ntg.nl (inherits from uu:default, base:default) X-Canit-Stats-ID: 0QM6H5uay - 0208e0f4fbc2 - 20140526 (trained as not-spam) X-Scanned-By: CanIt (www . roaringpenguin . com) on 192.87.102.70 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:87585 Archived-At: 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 ___________________________________________________________________________________