gpt4 book ai didi

Java GCP bigquery simba jdbc connection timeout(Java GCP BigQuery Simba JDBC连接超时)

转载 作者:bug小助手 更新时间:2023-10-26 21:07:17 30 4
gpt4 key购买 nike



I am trying to connect GCP bigQuery from local using simba jdbc but getting error. Previously I had got Service account role permission issue , those were resolved by adding necessary roles for service account

我正在尝试使用Simba JDBC从本地连接GCP BigQuery,但收到错误。之前我遇到了服务帐户角色权限问题,这些问题已通过为服务帐户添加必要的角色来解决


java.sql.SQLException: [Simba][BigQueryJDBCDriver](100004) HttpTransport IO error : Error getting access token for service account: connect timed out, iss: [email protected].
at com.simba.googlebigquery.googlebigquery.client.BQClient.createAndTestClient(Unknown Source)
at com.simba.googlebigquery.googlebigquery.client.BQClient.authenticateAndTest(Unknown Source)
at com.simba.googlebigquery.googlebigquery.core.BQConnection.connect(Unknown Source)
at com.simba.googlebigquery.jdbc.common.BaseConnectionFactory.doConnect(Unknown Source)
at com.simba.googlebigquery.jdbc.common.AbstractDataSource.getSimbaConnection(Unknown Source)
at com.simba.googlebigquery.jdbc.common.AbstractDataSource.getConnection(Unknown Source)
Caused by: com.simba.googlebigquery.support.exceptions.GeneralException: [Simba][BigQueryJDBCDriver](100004) HttpTransport IO error : Error getting access token for service account: connect timed out, iss: [email protected].
... 6 more
Caused by: com.simba.googlebigquery.googlebigquery.client.exceptions.JobExecutionErrorException: EXEC_JOB_EXECUTION_ERR
at com.simba.googlebigquery.googlebigquery.client.requests.jobs.JobsInsertRequest.throwException(Unknown Source)
at com.simba.googlebigquery.googlebigquery.client.requests.AbstractRequestWithRetry.executeWithRetry(Unknown Source)
at com.simba.googlebigquery.googlebigquery.client.queryclient.QueryClient.executeDryRun(Unknown Source)
at com.simba.googlebigquery.googlebigquery.client.BQClient.prepare(Unknown Source)
at com.simba.googlebigquery.googlebigquery.client.BQClient.createAndTestClient(Unk

import com.simba.googlebigquery.jdbc42.DataSource;

import java.sql.Connection;
import java.sql.SQLException;

public class TEstConnection {
public static void main(String[] args) {
System.out.println("Connection check");

Connection connection = null;
DataSource ds = new
com.simba.googlebigquery.jdbc42.DataSource();
ds.setProjectId("xxx");
ds.setOAuthPvtKeyFilePath("C:\\Users\\xx\\UI\\GCP\\devgcp.json");
ds.setOAuthType(0);
ds.setOAuthServiceAcctEmail("[email protected]");
ds.setURL("jdbc:bigquery://https://www.googleapis.com/bigquery/v2:443");
ds.setTimeout(40000000L);
try {
connection = ds.getConnection();
} catch (SQLException e) {
e.printStackTrace();
}
}
}

The service account has required role permission but still I am getting error

服务帐户需要角色权限,但我仍收到错误


更多回答
优秀答案推荐

There are two ways authenticating your service account. You might have done either of the two: OAuth 2.0 and Service Account based authentication
And you might want to do the authentication again.

有两种方法可以验证您的服务帐户。您可能已经执行了以下两种身份验证之一:OAuth 2.0和基于服务帐户的身份验证,并且您可能希望再次执行身份验证。


Here is a URL to use to connect to Google BigQuery using Progress DataDirect BigQuery JDBC Connector using Service Account based authentication.

以下是使用Progress DataDirect BigQuery JDBC连接器使用基于服务帐户的身份验证连接到Google BigQuery的URL。


jdbc:datadirect:googlebigquery:AuthenticationMethod=serviceaccount;Project=your-project-id;Dataset=your-dataset;[email protected];ServiceAccountPrivateKey=/path/to/json-key-file

To authenticate the service account via OAuth 2.0, access and refresh tokens are needed. To get the tokens, OAuth ClientID must be created to get ClientID and Client Secret needed to get the authorization code. Here is the complete and detailed guide on how to authenticate via OAuth 2.0.

要通过OAuth 2.0对服务帐户进行身份验证,需要访问和刷新令牌。要获取令牌,必须创建OAuth客户端ID以获取获取授权码所需的客户端ID和客户端机密。下面是关于如何通过OAuth 2.0进行身份验证的完整而详细的指南。


更多回答

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com