SQL server utility not working when invoked(from a asp.net application) using cygwin
Chris J. Breisch
chris.ml@breisch.org
Mon Mar 24 10:43:00 GMT 2014
Afreen.. wrote:
> Hello,
>
> I have an asp.net application which uses cygwin to execute shell
> scripts in Windows environment. sqlcmd utility is used in these shell
> scripts to connect to a database and execute queries. sqlcmd is
> command line application that allows SQL queries to be written and
> executed from the command prompt.
>
> The sqlcmd utility works fine when directly invoked from the .net
> application or when the script is directly executed at the Cygwin
> terminal. But fails on integration ie. when the application creates a
> cygwin process& executes the script (I'm using cygwin bash.exe to do
> this) ,sqlcmd utility fails.
>
> To start a cygwin process,using a piece of code similar to this:
>
> {
> string FileName= @"c:\cygwin\bin\bash.exe";
> string Arguments= @"C:\MyDir\Test.script";
> ProcessStartInfo proc = ProcessStartInfo(FileName,Arguments);
> proc.UseShellExecute = false;
> proc.CreateNoWindow = true;
> Process P = new Process();
> P.StartInfo=proc;
> P.Start();
> P.WaitForExit();
> }
>
>
> Here Test.script is the script which contains the sqlcmd
> command.Output of the command is redirected to a file.
>
> sqlcmd -U abc -P abc -S MyServer -Q "sp_helpuser abc"> sql.log
>
> Is there something wrong with the way I'm creating the process (using
> bash.exe) or calling the script?How do I invoke cygwin and execute my
> script from an asp.net application?
>
> Using .net framework 4.0 and cygwin 1.7.20.
> Any help will be highly appreciated!Thanks in advance!
>
>
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.
--
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