火花和AWS红移:java.sql.SQLException中:红移://xxx.us-west-2.redshift.amazonaws.com:5439
问题描述:
操作系统:CentOS的火花和AWS红移:java.sql.SQLException中:红移://xxx.us-west-2.redshift.amazonaws.com:5439
火花:1.6找到JDBC没有合适的驱动程序0.1
SBT:build.sbt
libraryDependencies ++= {
Seq(
"org.apache.spark" %% "spark-core" % "1.6.1" % "provided",
"com.amazonaws" % "aws-java-sdk" % "1.10.75",
"com.amazonaws" % "amazon-kinesis-client" % "1.1.0",
"com.amazon.redshift" % "jdbc4" % "1.1.7.1007" % "test"
)
}
resolvers ++= Seq(
"redshift" at "https://s3.amazonaws.com/redshift-downloads/drivers/RedshiftJDBC4-1.1.7.1007.jar"
)
火花应用:
val redshiftDriver = "com.amazon.redshift.jdbc4.Driver"
Class.forName(redshiftDriver)
我指定的红移驱动程序,并更新到网址等。,以下AWS官方文档在这里:http://docs.aws.amazon.com/redshift/latest/mgmt/connecting-in-code.html
但我仍然得到以下错误:
java.sql.SQLException: No suitable driver found for jdbc:redshift://xxx.us-west-2.redshift.amazonaws.com:5439
我一派,有人说瓶子应该被加入到classpath中?任何人都可以帮忙吗?非常感谢您
答
解决:
只是清理所有缓存的东西,并重新建立一切从头开始,然后它的工作
添加上:
Databricks实现了这个库,这可以使我们的生活更容易在Spark内部互动红移 https://github.com/databricks/spark-redshift
// Get some data from a Redshift table
val df: DataFrame = sqlContext.read
.format("com.databricks.spark.redshift")
.option("url", "jdbc:redshift://redshifthost:5439/database?user=username&password=pass")
.option("dbtable", "my_table")
.option("tempdir", "s3n://path/for/temp/data")
.load()