delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2014/03/23/14:08:26

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:date:message-id:subject:from:to
:content-type; q=dns; s=default; b=aVCj9a34xQrQ8+/e+KTRfi/k0JzLQ
WfmUO64QAQIQl5wGwGSzw1OaZFxQKX59pV6SM++73BLc/prTvJRNYPC7P1daqbXd
ZVKuA77OIyVxHctENmIE6oYibE5U3dNcW6ciSbT8jWJn1lkH0hRihsITOONvrsPs
9qRXT2UzCUXfxw=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:date:message-id:subject:from:to
:content-type; s=default; bh=BPchONhkUCqm+yg+Vcihxf9OzWM=; b=XyC
q8KA6XOOx8BvE6OSxSnmRXM4W8ukWLSNq5U+v0SloJX5gAOKToMfG4IX7YDM+8vi
fP6bsOsuR/juytqd4jDIurhipx8wcAw7SZ8WjAcXtyN7h3Vo4qtdsIj8yE+kLUcM
iIU1PN1kc7fhg+pM2JQDaLra/h1G3+HTMP2UyT7w=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2
X-HELO: mail-qg0-f46.google.com
MIME-Version: 1.0
X-Received: by 10.224.165.83 with SMTP id h19mr70522293qay.27.1395598076480; Sun, 23 Mar 2014 11:07:56 -0700 (PDT)
Date: Sun, 23 Mar 2014 23:37:56 +0530
Message-ID: <CAN=kAG7tkCxitPj+5k+otz+Sugyjep-KgJ=sq+oyTYquSdaMRQ@mail.gmail.com>
Subject: SQL server utility not working when invoked(from a asp.net application) using cygwin
From: "Afreen.." <afreen DOT tandur AT gmail DOT com>
To: cygwin AT cygwin DOT com

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!


-- 
Regards,
Afreen T

--
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019