title: How to get one stream from error stream and input stream when calling a script using JSCH
body: <p>I am calling a script file (.sh) located on remote machine using JSCH. During execution the script outputs both error and success statements. The JSCH code what I have written exhibits two streams, InputStream &amp; Error Stream</p>
  
  <p>How can I get an single input stream that contains error and output ?</p>
  
  <pre><code>Channel channel=session.openChannel("exec");
  ((ChannelExec)channel).setCommand("/opt/sdp/SnapShot/bin/dumpSubscribers.ksh");;
  InputStream in=channel.getInputStream();
  InputStream error=((ChannelExec)channel).getErrStream();
  channel.connect();
  
  **Script output:**
  
  \[2014-01-23 19:41:01] SnapShot: Start dumping database
  szTimgExtension: sdp511 enabled
  functionOfferSupport active
  
  Failed to prepare statements: ODBC Error 'S0022', TimesTen Error 2211, ODBC rc -1
  [TimesTen][TimesTen 7.0.6.8.0 ODBC Driver][TimesTen]TT2211: Referenced column O.START_SECONDS not found -- file "saCanon.c", lineno 9501, procedure "sbPtTblScanOfColRef()" [Unable to prepare statement: &lt;Statement for getting subscriber_offer data.&gt;.]
  
  Database error: ODBC Error 'S0022', TimesTen Error 2211, ODBC rc -1
  [TimesTen][TimesTen 7.0.6.8.0 ODBC Driver][TimesTen]TT2211: Referenced column O.START_SECONDS not found -- file "saCanon.c", lineno 9501, procedure "sbPtTblScanOfColRef()" [Unable to prepare statement: &lt;Statement for getting subscriber_offer data.&gt;.]
  
  [2014-01-23 19:41:01] SnapShot: Result files:
  /var/opt/fds/TT/dump//SDP1.DUMP_subscriber.v3.csv
  /var/opt/fds/TT/dump//SDP1.DUMP_usage_counter.v3.csv
  [2014-01-23 19:41:01] SnapShot: Finished dumping database
  </code></pre>