What is JDBC counterpart of Postgres' “\connect” command?

后端 未结 1 1294
被撕碎了的回忆
被撕碎了的回忆 2020-12-07 04:41

I\'m trying to execute following Postgres 9.6 commands over JDBC connection

CREATE USER my_db WITH SUPERUSER PASSWORD \'my_db\';
CREATE DATABASE my_db;
GRANT         


        
相关标签:
1条回答
  • 2020-12-07 05:05

    Backslash commands are not PostgreSQL SQL commands, they're commands in the psql command-line utility. Behind the scenes, \connect just closes the connection and opens a new one.

    PostgreSQL its self does not have any way to switch databases on a connection.

    Disconnect and reconnect to the other DB.

    0 讨论(0)
提交回复
热议问题