简体   繁体   English

spark和aws redshift:java.sql.SQLException:没有为jdbc找到合适的驱动程序:redshift://xxx.us-west-2.redshift.amazonaws.com:5439

[英]spark and aws redshift: java.sql.SQLException: No suitable driver found for jdbc:redshift://xxx.us-west-2.redshift.amazonaws.com:5439

os: centos os:centos

spark:1.6.1 火花:1.6.1

sbt: build.sbt 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"
         )

spark app: 火花应用:

val redshiftDriver = "com.amazon.redshift.jdbc4.Driver"
Class.forName(redshiftDriver)

I've specified the redshift driver, and updated to url etc., following AWS official documentation here: http://docs.aws.amazon.com/redshift/latest/mgmt/connecting-in-code.html 我已经在此处的AWS官方文档中指定了redshift驱动程序并更新为url等: http//docs.aws.amazon.com/redshift/latest/mgmt/connecting-in-code.html

But I'm still getting error below: 但我仍然得到以下错误:

java.sql.SQLException: No suitable driver found for jdbc:redshift://xxx.us-west-2.redshift.amazonaws.com:5439

I googled and someone said the jar should be added to classpath? 我用谷歌搜索,有人说罐子应该添加到classpath? Could anyone please help here? 有人可以帮忙吗? Thank you very much 非常感谢你

Solved : 解决了

just clean all cached stuff , and re-build everything from scratch, and then it's working 只需清理所有缓存的东西 ,然后从头开始重新构建所有内容,然后就可以了

Add on: 添加在:

Databricks implemented this lib, which could make our life much easier interacting redshift within Spark https://github.com/databricks/spark-redshift Databricks实现了这个lib,这可以让我们的生活更轻松地在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()

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 SQL 服务器的 JDBC 驱动程序(java.sql.SQLException:没有合适的驱动程序) - JDBC driver for SQL Server (java.sql.SQLException: No suitable driver) ssh:连接到主机xxx.us-west-2.compute.amazonaws.com端口22:aws中的连接被拒绝 - ssh: connect to host xxx.us-west-2.compute.amazonaws.com port 22: Connection refused in aws AWS Redshift sql 分组方式 - AWS Redshift sql grouping by 如何将redshift jdbc驱动程序添加到AWS Lambda函数 - how to add redshift jdbc driver to aws lambda function AWS S3 - java.net.UnknownHostException: repo-user-bucket.s3.us-west-2.amazonaws.com - AWS S3 - java.net.UnknownHostException: repo-user-bucket.s3.us-west-2.amazonaws.com 在不使用jdbc驱动程序的情况下查询Amazon Redshift - Query Amazon Redshift without using jdbc driver AWS Redshift SQL 相当于 Tableau - AWS Redshift SQL equivalent of Tableau Redshift ODBC 驱动程序测试失败:服务器是否在主机上运行并在端口 5439 上接受 TCP/IP 连接? - Redshift ODBC Driver test fails: Is the server running on host and accepting TCP/IP connections on port 5439? 使用 Zeppelin Spark 2.0 和 Pyspark 连接到 AWS Redshift - Connecting to AWS Redshift with Zeppelin Spark 2.0 and Pyspark 将 AWS Redshift 上的 Azure Databricks Spark 集群列入白名单 - Whitelisting Azure Databricks Spark Cluster on AWS Redshift
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM