【问题标题】:Illegal character in authority for PostgreSql connection stringPostgreSql 连接字符串权限中的非法字符
【发布时间】:2016-05-18 02:39:23
【问题描述】:

我在我的应用程序中使用的 Postgresql 的连接字符串:

let dsn = "postgresql://me:somepassword$@localhost/my_db";

错误是

Connection error: Invalid connection parameters: Illegal character in authority'

其中有什么无效的?是“$”吗?但这是我密码的一部分。

【问题讨论】:

  • 这和java有什么关系?
  • @ScaryWombat,它是从我的 java 应用程序中使用的。

标签: java python postgresql


【解决方案1】:

答案引用自:

https://jdbc.postgresql.org/documentation/80/connect.html


您的 PostgreSQL URL 似乎语法错误。

不知道你是用什么方法连接数据库的,但假设你是用JDBC连接的,语法应该是这样的:

"jdbc:postgresql://host:port/database?user=username&password=password"

您的案例的一般 postgresql URL 示例:

"postgresql://localhost:5432/my_db?user=me&password=somepassword$"


里面有什么无效的?是“$”吗?但这是我密码的一部分。


如果您遵循我的示例 URL 的语法,“$”应该没有问题。请尝试一下,因为我也对结果感兴趣。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2013-11-09
    • 1970-01-01
    • 2010-10-02
    • 2020-12-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-09-13
    相关资源
    最近更新 更多