我试过这是DBeaver和DataGrip。
使用Google Spanner Emulator本地运行(0.8.0(
export SPANNER_EMULATOR_HOST=localhost:9010
Executing: docker run -p 127.0.0.1:9010:9010 -p 127.0.0.1:9020:9020 gcr.io/cloud-spanner-emulator/emulator:0.8.0
[cloud-spanner-emulator] 2020/07/17 22:23:21 gateway.go:135: Cloud Spanner emulator running.
[cloud-spanner-emulator] 2020/07/17 22:23:21 gateway.go:136: REST server listening at 0.0.0.0:9020
[cloud-spanner-emulator] 2020/07/17 22:23:21 gateway.go:137: gRPC server listening at 0.0.0.0:9010
这将与谷歌JDBC扳手驱动程序一起工作吗?
在我的测试中,我的猜测是:
不,目前不支持此功能
我可以设法连接到扳手的GCP实例,但不能连接到模拟器。当我尝试使用端口9010或9020时,它基本上是挂起的。
我的jdbc连接字符串如下(项目、实例和数据库都已创建(:
gcloud spanner databases list --project=local-project --instance=local-instance --configuration=spanner-emulator --format json
[
{
"name": "projects/local-project/instances/local-instance/databases/myDatabase",
"state": "READY"
},
]
# 9010
jdbc:cloudspanner://localhost:9010/projects/local-project/instances/local-instance/databases/myDatabase
# 9020
jdbc:cloudspanner://localhost:9020/projects/local-project/instances/local-instance/databases/myDatabase
# just the host
jdbc:cloudspanner://localhost/projects/local-project/instances/local-instance/databases/myDatabase
模拟器不使用TLS,而JDBC驱动程序将默认使用TLS。您可以通过将usePlainText
连接属性设置为true
来关闭JDBC驱动程序的TLS。以下连接URL应该有效:
jdbc:cloudspanner://localhost:9010/projects/local-project/instances/local-instance/databases/myDatabase?usePlainText=true