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:message-id:date:from:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; q=dns; s=default; b=HMaCurrMSj2M5cyeYicGn/45oKn0qH84QcHgLzf5rth OMb5pwdLmNS2AxdSnTDL780PJgoFrw0PbFCPVU9LzDsE5vWd/Wtk67IQEwVzP+GU oEVht3WiP0SeijFc/Gm8+TcW/6ubciTnYyyRoZc0ep209khgqspQw46ozbrrWmzM = 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:message-id:date:from:mime-version:to:subject :references:in-reply-to:content-type:content-transfer-encoding; s=default; bh=D8Bv2FSuZX1kRycyWaQga7XnNuM=; b=Vz3mJsML/OwDMxYSa 4GOvb7YZvdS5Bk+NrvhPYWYyUA7TlTrdcx77yQ0jzyv/Ix253Edpw3XwcZX8FLVi s4vmFedus0/RbNve7CmbcWHx67KIMttxz7wEsZ37gQ+DUplKreqm7uLTItsG4q15 kvIPZC1Zj0ppRzOCpuspW2FNmk= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , 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=-2.5 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 X-HELO: mail-ie0-f170.google.com X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=Jlna7hHznD016wJ/NsCqZovAsKHpoktMop1VBnhUEzE=; b=LCl8b9piQ5PSjRqp5uPoN5x7gmMbp6i0anxb20/GQLuUxy1DQvm0NoU1qMpon8zLnY kTdxOjzrT/md9oR9ZkgT+oG0Pnh1vSbj+ULfDtmuX7Lnd0vE3Oa8z+g9JpFnEK77MU88 q2LWpbobn2bOYq66NYeQbzJW2ITvzmEuMmTSKQ1MbmroLEKEdyN1aM7Q1uZ176gS8ciC mZR2KPdKhPvm62588sqDP9tcfSyOJ5hzizebHlOhuyLxJcIBTcj2QLyD0oiiB099MSLw 956XhmDQGRPwzt4mNO5yDB+0nck4tsBjLYMu+kfMxI9uNyKG8lr2FqdYvfPOqCkfXQOl l0Dw== X-Gm-Message-State: ALoCoQkkzrG4cqElnlHfBPtgM19bp7/v+oVdVc32rDMe+qNE1r+gdWBzW4wDZ50ODOZl3ndNjLb1 X-Received: by 10.42.131.197 with SMTP id a5mr47599037ict.8.1395600943985; Sun, 23 Mar 2014 11:55:43 -0700 (PDT) Message-ID: <532F2E28.8020406@breisch.org> Date: Sun, 23 Mar 2014 14:55:36 -0400 From: "Chris J. Breisch" User-Agent: Postbox 3.0.9 (Windows/20140128) MIME-Version: 1.0 To: "cygwin AT cygwin DOT com" Subject: Re: SQL server utility not working when invoked(from a asp.net application) using cygwin References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes 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