Note that there are some explanatory texts on larger screens.

plurals
  1. POhow avoids deadlock condition
    text
    copied!<p>I try to write a program like a compiler. In this case I must simulate these codes of SQLPL (this one can be just for example). For example in command prompt I want to do these:</p> <pre><code>c:\&gt; sqlplus .... Enter User-Name:(here we must enter username) xxxx Enter password:(same up)yyyyy ... sql&gt;(now I want to send my sql command to shell)prompt "rima"; "rima" [&lt;-output] sql&gt; prompt "xxxx" sql&gt; exit </code></pre> <p>very simple. I try to use this code:</p> <pre><code>ProcessStartInfo psi = new ProcessStartInfo( @"sqlplus"); psi.UseShellExecute = false; psi.CreateNoWindow = true; psi.RedirectStandardInput = true; psi.RedirectStandardOutput = true; //psi.RedirectStandardError = true; Process process = new Process(); process.StartInfo = psi; bool started = process.Start(); if (started) { process.StandardInput.WriteLine("user/password"); process.StandardInput.Flush(); string ret = process.StandardOutput.ReadLine(); // &lt;-- stalls here System.Console.WriteLine("sqlplus says :" + ret + "\"."); } </code></pre> <p>I find out it form <a href="http://www.eggheadcafe.com/software/aspnet/29658435/wrap-command-shell-in-sys.aspx" rel="nofollow noreferrer">here</a> but as if you read this code has problem! DEADLOCK Condition problem! This is my second time I ask my question, every time my knowledge growing, but I can't get how I can solve my problem at last!!!</p> <p>So I kindly kiss your hand, please help me, this process is not clear for me. Any one can give me a code that handle my problem? Already I look at all codes, also I try to use ProcessRunner that in my last post some one offer me, but I can't use it also, I receive an error.<br></p> <p>I hope by first example you find out what I want, and solve the second code problem...<br> <strong>I use C# for implementation, also my DB is Oracle</strong> <br> I don't want close sqlplus for each time connecting because it take time to log in again.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload