simba jdbc上的databricks spark连接问题

3okqufwl  于 2021-07-14  发布在  Spark
关注(0)|答案(0)|浏览(346)

我正在尝试通过simba jdbc(databricks推荐的方式)从perl代码连接spark databrickshttps://databricks-bi-artifacts.s3.us-east-2.amazonaws.com/simbaspark-drivers/jdbc/2.6.17/simbasparkjdbc42-2.6.17.1021.zip
到目前为止,我成功地设置了perl和所有与perl相关的模块config,下面的问题与我坚信的perl无关。
我有下面的代码试图连接Spark数据库


# !/usr/bin/perl

use strict;
use DBI;

my $user = "token";
my $pass = "replaceme";
my $host = "DBhost.azuredatabricks.net";
my $port = 9001;
my $url = "jdbc:spark://DBhost.azuredatabricks.net:443/default;transportMode=http;ssl=1;httpPath=sql/protocolv1/o/853imaskedthis14/1005-imaskedthis-okra138;AuthMech=3;UID=token;PWD=replaceme";  # Get this URL from JDBC data src

my %properties = ('user' => $user, 
                  'password' => $pass, 
                  'host.name' => $host, 
                  'host.port' => $port);

my $dsn = "dbi:JDBC:hostname=localhost;port=$port;url=$url";
my $dbh = DBI->connect($dsn, undef, undef, 
          { PrintError => 0, RaiseError => 1, jdbc_properties => \%properties })
          or die "Failed to connect: ($DBI::err) $DBI::errstr\n";
my $sql = qq/select * from table/;
my $sth = $dbh->prepare($sql);
$sth->execute();
my @row;
while (@row = $sth->fetchrow_array) {
 print join(", ", @row), "\n";
}

我结束以下问题和错误与辛巴驱动程序连接到spark thrift服务器作为身份验证问题。

failed: [Simba][SparkJDBCDriver](500164) Error initialized or created transport for authentication: Invalid status 21
Also, could not send response: com.simba.spark.jdbc42.internal.apache.thrift.transport.TTransportException: java.net.SocketException: Broken pipe (Write failed). at ./perldatabricksconntest.pl line 18.

记录器记录了以下java堆栈跟踪:

[Thread-1] 05:40:16,718 WARN  - Error
java.sql.SQLException: [Simba][SparkJDBCDriver](500164) Error initialized or created transport for authentication: Invalid status 21
Also, could not send response: com.simba.spark.jdbc42.internal.apache.thrift.transport.TTransportException: java.net.SocketException: Broken pipe (Write failed).
        at com.simba.spark.hivecommon.api.HiveServer2ClientFactory.createTransport(Unknown Source)
        at com.simba.spark.hivecommon.api.ServiceDiscoveryFactory.createClient(Unknown Source)
        at com.simba.spark.hivecommon.core.HiveJDBCCommonConnection.establishConnection(Unknown Source)
        at com.simba.spark.spark.core.SparkJDBCConnection.establishConnection(Unknown Source)
        at com.simba.spark.jdbc.core.LoginTimeoutConnection.connect(Unknown Source)
        at com.simba.spark.jdbc.common.BaseConnectionFactory.doConnect(Unknown Source)
        at com.simba.spark.jdbc.common.AbstractDriver.connect(Unknown Source)
        at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:677)
        at java.sql/java.sql.DriverManager.getConnection(DriverManager.java:189)
        at com.vizdom.dbd.jdbc.Connection.handleRequest(Connection.java:417)
        at com.vizdom.dbd.jdbc.Connection.run(Connection.java:211)
Caused by: com.simba.spark.support.exceptions.GeneralException: [Simba][SparkJDBCDriver](500164) Error initialized or created transport for authentication: Invalid status 21
Also, could not send response: com.simba.spark.jdbc42.internal.apache.thrift.transport.TTransportException: java.net.SocketException: Broken pipe (Write failed).
        ... 11 more

同样根据simbajdbc连接器文档,我尝试了无身份验证模式,用户名,用户名/密码,它们都不起作用。
所以想知道传输层的身份验证问题在哪里。注意,我已经创建了令牌,并在启动时在密码部分提到了这一点jdbc:spark call .

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题