我们希望使用Simba驱动程序从我们的BigQuery数据集中获取数据。由于我们的公司政策,我们必须使用私人服务连接来实现BigQuery API:https://bigquery-p.p.googleapis.com,而不是公共可用的https://bigquery-p.p.googleapis.com (https://bigquery.googleapis.com)。我们已经通过互连成功地连接了私有服务连接,并且能够通过curl使用端点,并且URL被正确地转换到私有服务连接的IP:
curl -v -H "Authorization: Bearer TOKEN" https://bigquery-p.p.googleapis.com/bigquery/v2/projects/OUR-PROJECT/datasets由于我们的应用程序依赖于Simba JDCB驱动程序(版本1.2.21.1025),所以我们尝试使用配置中的这个私有服务终结点,方法是:
jdbc:bigquery://https://bigquery-psc.p.googleapis.comRootURL设置为端点。使用以下代码:
DataSource ds = new com.simba.googlebigquery.jdbc.DataSource();
ds.setURL("jdbc:bigquery://https://bigquery-p.p.googleapis.com");
ds.setCustomProperty("RootURL", "http://bigquery-p.p.googleapis.com");但是,下面的堆栈跟踪导致连接失败:
Exception in thread "main" java.sql.SQLException: [Simba][BigQueryJDBCDriver](100004) HttpTransport IO error : Connection refused: connect.
at com.simba.googlebigquery.googlebigquery.client.BQClient.createAndTestClient(Unknown Source)
at com.simba.googlebigquery.googlebigquery.client.BQClient.serviceAccountOAuth(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 : Connection refused: connect.
... 6 more
Caused by: com.simba.googlebigquery.support.exceptions.GeneralException: EXEC_JOB_EXECUTION_ERR
at com.simba.googlebigquery.googlebigquery.client.BQClient.throwExecException(Unknown Source)
at com.simba.googlebigquery.googlebigquery.client.BQClient.insertJob(Unknown Source)
at com.simba.googlebigquery.googlebigquery.client.BQClient.prepare(Unknown Source)
... 6 more
Process finished with exit code 1如何为BigQuery配置Simba驱动程序以指向私有api端点?
发布于 2022-06-07 12:00:41
JDBC驱动程序上没有这样的配置。因此,我们必须通过使用代理来实现工作,并在系统级别上配置它:
System.setProperty("http.proxyHost", "IP_OF_THE_PROXY");
System.setProperty("http.nonProxyHosts", "*.p.googleapis.com");https://stackoverflow.com/questions/70687677
复制相似问题