title: How to get the output from .jar execution in python codes?
body: <p>I'm programming the python module that executes SQL to DBMS and retrieves data. I'm trying to use jdbc jar files instead of native DB drivers. I'm wondering how to executes jar file in python and get output from jar execution. And I'd like to know how to pass SQL string to jar argument. 
  Here is the simplified code.
  Any help is greatly appreciated.</p>
  
  <p>[ java code ]</p>
  
  <pre><code>public class GetDBResults {
      public static void main(String[] args) {
  
          // return sql results
          for(int i=0; i&lt;=100; i++){
              // Is this the proper way to generate the output?
              System.out.println(i+"/t"+i*100+1);
      }
    }
  }
  </code></pre>
  
  <p>[ python code ]</p>
  
  <pre><code>subprocess.call( [ 'java','-jar','./GET_DB_DATA.jar' )
  
  # how to get results from jar execution?
  # how to pass SQL string to jar execution?
  </code></pre>