all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* sqlserver patch for Bable?
@ 2014-09-19 17:34 Subhan Michael Tindall
  2014-09-19 21:00 ` Subhan Michael Tindall
  0 siblings, 1 reply; 2+ messages in thread
From: Subhan Michael Tindall @ 2014-09-19 17:34 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

[-- Attachment #1: Type: text/plain, Size: 1340 bytes --]

Does anyone have a working patch to use MS SQL Server as a back end for SQL code blocks?
I'm stuck on a windows box, and would like to do some literate programming combining some R analysis and data pulled from a sqlserver database accessed using my windows credentials.
I've got it working (for what it's worth) in sql-ms mode if that helps.
I'm hoping someone's already done the work, although I don't think it's extreme (I patched for sql*plus/oracle in the past)
Thanks!
Subhan


Subhan Michael Tindall
Program Analyst - FamilyCare Health Plans
825 NE Multnomah St, Suite 1400; Portland OR 97232
Direct: 503-471-3127
Fax:      503-471-3177
Email:  subhant@familycareinc.org<mailto:subhant@familycareinc.org>
[Email-Signature-Logos June 20143]


This message is intended for the sole use of the individual and entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not the intended addressee, nor authorized to receive for the intended addressee, you are hereby notified that you may not use, copy, disclose or distribute to anyone the message or any information contained in the message. If you have received this message in error, please immediately advise the sender by reply email and delete the message.  Thank you.

[-- Attachment #2: image001.jpg --]
[-- Type: image/jpeg, Size: 30469 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: sqlserver patch for Bable?
  2014-09-19 17:34 sqlserver patch for Bable? Subhan Michael Tindall
@ 2014-09-19 21:00 ` Subhan Michael Tindall
  0 siblings, 0 replies; 2+ messages in thread
From: Subhan Michael Tindall @ 2014-09-19 21:00 UTC (permalink / raw)
  To: Subhan Michael Tindall, help-gnu-emacs@gnu.org

OK, I've almost got this.  By modifying the msosql (deprecated) command I've gotten pretty close.
I hard-coded some server info for ease of testing, the connection seems to be working fine.
Then I had to track down & correct a problem with the temporary file names.
I'm on a windows system & it appears that something in the processing stream was mangling the temp file names by adding an escape before the colon like this:
C:-> C\:
Which was causing a fail.
Fixed this by changing 'Temporary File Directory' to ~/temp 
Now, however, I get the following errors:

(ob-sql.el )
                    ('msosql (format "osql %s -s \"\t\" -i %s -o %s"
                                     (or cmdline "")
                                     (org-babel-process-file-name in-file)
                                     (org-babel-process-file-name out-file)))
;;following is what I added, above is what existed already. Osql is deprecated as a CLI to sqlserver
	('mssqlcmd (format "sqlcmd %s -S FCSQLSVR3 -d PHTStaging -s \"\t\" -i %s -o %s"
		   (or cmdline "")
		   (org-babel-process-file-name in-file)
		   (org-babel-process-file-name out-file)))


#+BEGIN_SRC sql :engine mssqlcmd
select count(*) from referral
#+END_SRC

When evaluated, *Org-Babel Error Output* gets:
Sqlcmd: Error: '-' or '/' does not have an associated argument.
Enter '-?' for help.
And the message buffer holds
executing Sql code block...
sqlcmd  -S FCSQLSVR3 -d PHTStaging -s "	" -i //fcfpsvr2/redir/Desktop/subhant/Desktop/home/temp/sql-in-12936ui1 -o //fcfpsvr2/redir/Desktop/subhant/Desktop/home/temp/sql-out-12936gsE
Wrote //fcfpsvr2/redir/Desktop/subhant/Desktop/home/temp/ob-input-12936t2K
Babel evaluation exited with code 1

The in file holds the query as expected
The out file is empty
The fie ob-input-12936t2K does not exist

Any ideas where to look from here?


> -----Original Message-----
> From: help-gnu-emacs-bounces+subhant=familycareinc.org@gnu.org
> [mailto:help-gnu-emacs-bounces+subhant=familycareinc.org@gnu.org] On
> Behalf Of Subhan Michael Tindall
> Sent: Friday, September 19, 2014 10:35 AM
> To: help-gnu-emacs@gnu.org
> Subject: sqlserver patch for Bable?
> 
> Does anyone have a working patch to use MS SQL Server as a back end for
> SQL code blocks?
> I'm stuck on a windows box, and would like to do some literate programming
> combining some R analysis and data pulled from a sqlserver database
> accessed using my windows credentials.
> I've got it working (for what it's worth) in sql-ms mode if that helps.
> I'm hoping someone's already done the work, although I don't think it's
> extreme (I patched for sql*plus/oracle in the past) Thanks!
> Subhan
> 
> 
> Subhan Michael Tindall
> Program Analyst - FamilyCare Health Plans
> 825 NE Multnomah St, Suite 1400; Portland OR 97232
> Direct: 503-471-3127
> Fax:      503-471-3177
> Email:  subhant@familycareinc.org<mailto:subhant@familycareinc.org>
> [Email-Signature-Logos June 20143]
> 
> 
> This message is intended for the sole use of the individual and entity to
> which it is addressed and may contain information that is privileged,
> confidential and exempt from disclosure under applicable law. If you are not
> the intended addressee, nor authorized to receive for the intended
> addressee, you are hereby notified that you may not use, copy, disclose or
> distribute to anyone the message or any information contained in the
> message. If you have received this message in error, please immediately
> advise the sender by reply email and delete the message.  Thank you.

This message is intended for the sole use of the individual and entity to which it is addressed and may contain information that is privileged, confidential and exempt from disclosure under applicable law. If you are not the intended addressee, nor authorized to receive for the intended addressee, you are hereby notified that you may not use, copy, disclose or distribute to anyone the message or any information contained in the message. If you have received this message in error, please immediately advise the sender by reply email and delete the message.  Thank you.




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-09-19 21:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-19 17:34 sqlserver patch for Bable? Subhan Michael Tindall
2014-09-19 21:00 ` Subhan Michael Tindall

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.