Advertisement
Guest User

Untitled

a guest
Jul 12th, 2016
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. from pyspark.sql import SQLContext
  2. sqlContext = SQLContext(sc)
  3.  
  4. df = sqlContext.load(source="jdbc",
  5. url="jdbc:postgresql://[publichost]:[port]/compose",
  6. dbtable="[tablename]")
  7. df.take(2)
  8.  
  9. Py4JJavaError: An error occurred while calling o42.load.
  10. : java.sql.SQLException: No suitable driver found for jdbc:postgresql://host:port/compose
  11. at java.sql.DriverManager.getConnection(DriverManager.java:700)
  12. at java.sql.DriverManager.getConnection(DriverManager.java:219)
  13. at org.apache.spark.sql.execution.datasources.jdbc.JDBCRDD$$anonfun$getConnector$1.apply(JDBCRDD.scala:188)
  14. at org.apache.spark.sql.execution.datasources.jdbc.JDBCRDD$$anonfun$getConnector$1.apply(JDBCRDD.scala:181)
  15. at org.apache.spark.sql.execution.datasources.jdbc.JDBCRDD$.resolveTable(JDBCRDD.scala:121)
  16. at org.apache.spark.sql.execution.datasources.jdbc.JDBCRelation.<init>(JDBCRelation.scala:91)
  17. at org.apache.spark.sql.execution.datasources.jdbc.DefaultSource.createRelation(DefaultSource.scala:60)
  18. at org.apache.spark.sql.execution.datasources.ResolvedDataSource$.apply(ResolvedDataSource.scala:158)
  19. at org.apache.spark.sql.DataFrameReader.load(DataFrameReader.scala:119)
  20. at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  21. at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
  22. at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
  23. at java.lang.reflect.Method.invoke(Method.java:507)
  24. at py4j.reflection.MethodInvoker.invoke(MethodInvoker.java:231)
  25. at py4j.reflection.ReflectionEngine.invoke(ReflectionEngine.java:381)
  26. at py4j.Gateway.invoke(Gateway.java:259)
  27. at py4j.commands.AbstractCommand.invokeMethod(AbstractCommand.java:133)
  28. at py4j.commands.CallCommand.execute(CallCommand.java:79)
  29. at py4j.GatewayConnection.run(GatewayConnection.java:209)
  30. at java.lang.Thread.run(Thread.java:785)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement