title: How to read with SQL from DB2 using pyspark?
body: <p>I want to connect and read from from DB2 using an SQL statement with pySpark. The only code I found on the internet reads the entire table as below</p>
  
  <pre><code>user = &lt;username&gt;
  password = &lt;password&gt;
  jdbcURL = "jdbc:db2://xx.xx.xxx.xxx:50000/Database" 
  prop = {"user":user, "password":password, "driver":"com.ibm.db2.jcc.DB2Driver",  "sslConnection":"false"} 
  table = &lt;schema.table&gt;
  df = sqlContext.read.jdbc(url=jdbcURL,table=table,properties=prop) 
  df.count()
  </code></pre>
  
  <p>I would like to read using an SQL statement like </p>
  
  <pre><code> 'select * from table limit 100'
  </code></pre>
  
  <p>Could you please help?</p>