如何在Postgresql JDBC url中设置应用程序名称?

如何在Postgresql JDBC url中设置应用程序名称?,第1张

概述我想设置应用程序的连接的应用程序名称.所以当我列出pg_stat_activity中的行时,我可以有一个非空的application_name列. 我已经设置了以下JDBC url来连接到我的Postgresql数据库: jdbc:postgresql://localhost:5435/MyDB?application-name=MyApp 我也试过这个url,没有更多的成功. jdbc:post 我想设置应用程序的连接的应用程序名称.所以当我列出pg_stat_activity中的行时,我可以有一个非空的application_name列.

我已经设置了以下JDBC url来连接到我的Postgresql数据库:

jdbc:postgresql://localhost:5435/MyDB?application-name=MyApp

我也试过这个url,没有更多的成功.

jdbc:postgresql://localhost:5435/MyDB?application_name=MyApp

什么是正确的参数名称?

这是我的JDBC驱动程序版本:9.1-901.jdbc4

查看 PostgreSQL JDBC 9.1 documentation,connection parameters,JDBC URL中正确的属性名称为Applicationname:

Applicationname = String

SpecifIEs the name of the application that is using the connection. This allows a database administrator to see what applications are connected to the server and what resources they are using through vIEws like pg_stat_activity

所以尝试:

jdbc:postgresql://localhost:5435/MyDB?Applicationname=MyApp
总结

以上是内存溢出为你收集整理的如何在Postgresql JDBC url中设置应用程序名称?全部内容,希望文章能够帮你解决如何在Postgresql JDBC url中设置应用程序名称?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://www.54852.com/sjk/1169731.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-06-02
下一篇2022-06-02

发表评论

登录后才能评论

评论列表(0条)

    保存