title: Using pyspark to connect to PostgreSQL
body: <p>I am trying to connect to a database with pyspark and I am using the following code:</p>
  <pre><code>sqlctx = SQLContext(sc)
  df = sqlctx.load(
      url = &quot;jdbc:postgresql://[hostname]/[database]&quot;,
      dbtable = &quot;(SELECT * FROM talent LIMIT 1000) as blah&quot;,
      password = &quot;MichaelJordan&quot;,
      user =  &quot;ScottyPippen&quot;,
      source = &quot;jdbc&quot;,
      driver = &quot;org.postgresql.Driver&quot;
  )
  </code></pre>
  <p>and I am getting the following error:</p>
  <p><a href="https://i.stack.imgur.com/LnaDy.png" rel="noreferrer"><img src="https://i.stack.imgur.com/LnaDy.png" alt="enter image description here" /></a></p>
  <p>Any idea why is this happening?</p>
  <p><strong>Edit</strong>: I am trying to run the code locally in my computer.</p>