使用JDBC连接到postgres时是否可以指定架构? [英] Is it possible to specify the schema when connecting to postgres with JDBC?

查看:132
本文介绍了使用JDBC连接到postgres时是否可以指定架构?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有可能吗?我可以在连接URL上指定它吗?该怎么做?

Is it possible? Can i specify it on the connection URL? How to do that?

推荐答案

我知道这已经得到了解答,但我只是遇到了同样的问题,试图指定架构用于liquibase命令行。

I know this was answered already, but I just ran into the same issue trying to specify the schema to use for the liquibase command line.

更新
自JDBC v 9.4 您可以使用新的currentSchema参数指定网址,如下所示:

Update As of JDBC v9.4 you can specify the url with the new currentSchema parameter like so:

jdbc:postgresql://localhost:5432/mydatabase?currentSchema=myschema

根据早期补丁显示:

http://web.archive。组织/网络/ 20141025044151 / HTTP://postgresql.1045698.n5.nabble.com/Patch-to-allow-setting-schema-search-path-in-the-connectionURL-td2174512.html

建议的网址是这样的:

Which proposed url's like so:

jdbc:postgresql://localhost:5432/mydatabase?searchpath=myschema

这篇关于使用JDBC连接到postgres时是否可以指定架构?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆