当使用JDBC连接到postgres时,是否可以指定模式? [英] Is it possible to specify schema when connecting to postgres with JDBC?

查看:3590
本文介绍了当使用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.

根据此: http://web.archive.org/web/20141025044151/http:// postgresql.1045698.n5.nabble.com/Patch-to-allow-setting-schema-search-path-in-the-connectionURL-td2174512.html

你可以这样指定url:

You can specify the url like so:

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

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

Update As of 9.4 you can specify the url with the new currentSchema parameter like so:

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

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

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