Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-10036

DataFrameReader.json and DataFrameWriter.json don't load the JDBC driver class before creating JDBC connection

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 1.5.0
    • SQL
    • None

    Description

      Here is the reproduce code and the stack trace

      val url = "jdbc:postgresql://.../mytest"
      import java.util.Properties
      
      val prop = new Properties()
      prop.put("driver", "org.postgresql.Driver")
      prop.put("user", "...")
      prop.put("password", "...")
      
      val df = sqlContext.read.jdbc(url, "mytest", prop)
      
      java.sql.SQLException: No suitable driver found for jdbc:postgresql://.../mytest
      	at java.sql.DriverManager.getConnection(DriverManager.java:689)
      	at java.sql.DriverManager.getConnection(DriverManager.java:208)
      	at org.apache.spark.sql.execution.datasources.jdbc.JDBCRDD$.resolveTable(JDBCRDD.scala:121)
      	at org.apache.spark.sql.execution.datasources.jdbc.JDBCRelation.<init>(JDBCRelation.scala:91)
      	at org.apache.spark.sql.DataFrameReader.jdbc(DataFrameReader.scala:200)
      	at org.apache.spark.sql.DataFrameReader.jdbc(DataFrameReader.scala:130)
      

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            zsxwing Shixiong Zhu
            zsxwing Shixiong Zhu
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment