您当前的位置: 首页 >  sql

科技D人生

暂无认证

  • 0浏览

    0关注

    1550博文

    0收益

  • 0浏览

    0点赞

    0打赏

    0留言

私信
关注
热门博文

Spring Boot学习总结(28)—— springboot连接postgresql 指定模式Schema

科技D人生 发布时间:2021-07-28 09:36:25 ,浏览量:0

springboot 连接 postgresql 指定模式Schema 一般的连接方式,我们创建数据库之后,在public 的Schema(模式)下建表,这时使用连接方式

jdbc:postgresql://localhost:5432/postgresql1、在这种连接方式下,默认连接使用的是postgresql数据库的public 模式 2、在业务场景中有时允许多个用户使用一个数据库并且不会互相干扰。这时需要在使用同一个数据库新建其他模式进行连接。这时在springboot的数据源jdbc配置时注意。

postgresql-> 9.3 及以前的版本指定方式 spring.datasource.url=jdbc:postgresql://localhost:5432/postgresql?searchpath=newschema

postgresql-> 9.4 及以后的版本指定方式 spring.datasource.url=jdbc:postgresql://localhost:5432/postgresql?currentSchema=newschema

关注
打赏
1662604032
查看更多评论
立即登录/注册

微信扫码登录

0.0422s