将 psql 连接到 PostgreSQL 方言数据库
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
本页面介绍了如何将 psql
连接到 Spanner 中的 PostgreSQL 方言数据库。psql
是 PostgreSQL 的命令行前端。
确保 PGAdapter 与 psql
命令在同一机器上运行。
如需了解详情,请参阅启动 PGAdapter。
在终端窗口中,启动 psql
并将 localhost
指定为数据库服务器主机。
- (可选)如果 PGAdapter 配置为在默认 PostgreSQL 端口 (5432) 以外的端口上进行监听,则请指定端口号。
- (可选)指定一个或多个要发送到数据库或驱动程序的命令(例如,JDBC 驱动程序)。每次出现
-c
选项时,您都可以指定单个命令或一批命令(以英文分号 (;) 分隔)。如需了解详情,请参阅 psql 命令行工具。
psql -h localhost [-p PORT] [-c "COMMAND; ..."] ...
可选:通过提交以下查询,验证 psql
是否已成功连接到 PostgreSQL 方言数据库:
SELECT 1::bigint;
此查询与 GoogleSQL 方言数据库不兼容。
后续步骤
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-02-01。
[{
"type": "thumb-down",
"id": "hardToUnderstand",
"label":"Hard to understand"
},{
"type": "thumb-down",
"id": "incorrectInformationOrSampleCode",
"label":"Incorrect information or sample code"
},{
"type": "thumb-down",
"id": "missingTheInformationSamplesINeed",
"label":"Missing the information/samples I need"
},{
"type": "thumb-down",
"id": "translationIssue",
"label":"翻译问题"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"其他"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"易于理解"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"解决了我的问题"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"其他"
}]