SQL server utility not working when invoked(from a asp.net application) using cygwin

Chris J. Breisch chris.ml@breisch.org
Mon Mar 24 19:26:00 GMT 2014


Chris J. Breisch wrote:
>
> Can you give more specifics on how it fails? And is it possible for you
> to upgrade to a more recent version of Cygwin? I'm doing almost all of
> this except for the ASP.net part, and I have no problems. I do this at
> work, and I'm not at the office right now. It's possible I quote the
> arguments differently. I can check in the morning. I also use Windows
> authentication and not SQL authentication, but that shouldn't matter. In
> fact, of the two, SQL authentication is the way less likely to cause
> issues.
>

I checked on what I'm doing in my script. Here's an exact line of code 
from my shell script:
    ${SQLCMD} -E -d ${_db} -S ${_server} -o ${_dosOutput} -Q "${_query}"

Where the variables are defined as follows:
SQLCMD="sqlcmd.exe"
_db=<database name>
_server=<server name>
_dosOutput=<output file name>
_query=<query string>

Note that I'm not using bash redirection, but the sqlcmd option to send 
output to a file. The -E tells sqlcmd to use Windows Authentication 
(actually it uses impersonation, which has it's own set of quirks, but 
that's not an issue for you), rather than using the -U and -P options as 
you are.

I did notice that in your original post you said -Q "sp_helpuser abc". I 
doubt that this is the problem, but -Q "exec sp_helpuser abc" is 
preferred. In my case, I'm not calling a stored procedure but passing an 
actual SQL select, insert, or update to sqlcmd. That shouldn't make any 
difference, though.

I also recently had a problem executing something with sqlcmd, as I 
mistyped "-S" as "-s". I didn't notice that tiny typo for hours and 
pulled out quite a bit of hair. Make sure the case is correct for all 
your options.

Without additional details on what is or isn't happening, this is as 
much assistance as I can provide.

-- 
Chris J. Breisch

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list