eal*_*nso 0 java postgresql jdbc
jdbc.postgresql 驱动程序表示它是纯 java 且与平台无关:
\n\n\nPostgreSQL\xc2\xae JDBC 驱动程序(简称 pgJDBC)允许 Java 程序使用标准的、独立于数据库的\nJava 代码连接到 PostgreSQL\xc2\xae 数据库。是一个用纯 Java (Type\n4) 编写的开源 JDBC 驱动程序,并使用 PostgreSQL\xc2\xae 本机网络协议进行通信。\n因此,该驱动程序是平台无关的;编译后,\n该驱动程序可在任何系统上使用。
\n
这看起来很棒。但是当我将 clojure 应用程序放入 docker 容器中时,jdbc posgresql 失败:
\norg.postgresql.util.PSQLException: ERROR: could not load library "/usr/lib/postgresql/13/lib/llvmjit.so": /lib/x86_64-\nlinux-gnu/libstdc++.so.6: version `GLIBCXX_3.4.30' not found (required by /lib/x86_64-linux-gnu/libz3.so.4)\n QueryExecutorImpl.java:2713 org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse\n QueryExecutorImpl.java:2401 org.postgresql.core.v3.QueryExecutorImpl.processResults\n QueryExecutorImpl.java:368 org.postgresql.core.v3.QueryExecutorImpl.execute \n PgStatement.java:498 org.postgresql.jdbc.PgStatement.executeInternal\n PgStatement.java:415 org.postgresql.jdbc.PgStatement.execute \n PgPreparedStatement.java:190 org.postgresql.jdbc.PgPreparedStatement.executeWithFlags\n PgPreparedStatement.java:134 org.postgresql.jdbc.PgPreparedStatement.executeQuery\n jdbc.clj:1090 clojure.java.jdbc/execute-query-with-params \n jdbc.clj:1084 clojure.java.jdbc/execute-query-with-params \n jdbc.clj:1113 clojure.java.jdbc/db-query-with-resultset* \n jdbc.clj:1093 clojure.java.jdbc/db-query-with-resultset* \n jdbc.clj:1182 clojure.java.jdbc/query \n jdbc.clj:1144 clojure.java.jdbc/query \n jdbc.clj:1160 clojure.java.jdbc/query \nRun Code Online (Sandbox Code Playgroud)\n如果 JDBC 驱动程序应该是纯 java 的,为什么它要尝试查找一些非 java 共享库?为什么它专门尝试加载 postgresql 13 共享对象库(我的系统只有 postgresql-15)?
\n这些查询似乎可以从本地 psql 客户端运行:
\n\xe2\x96\x88[debian-x1-7th][~][130]$ PGPASSWORD=REDACTED psql -h localhost -p 5432 REDACTED REDACTED\npsql (15.3 (Debian 15.3-0+deb12u1), server 13.10 (Debian 13.10-0+deb11u1))\nSSL connection (protocol: TLSv1.3, cipher: TLS_AES_256_GCM_SHA384, compression: off)\nType "help" for help.\n\nREDACTED=> select * from activity limit 10;\nREDACTED=> select * from activity limit 10;\nREDACTED=> select COUNT(*) from activity limit 10;\n count \n--------\n 742854\n(1 row)\n\nREDACTED=> \nRun Code Online (Sandbox Code Playgroud)\njdbc URI 参数:
\n(def pg-db {:dbtype "postgresql"\n :port 5432\n :host "localhost"\n :user "REDACTED"\n :dbname "REDACTED"\n :password "REDACTED"})\nRun Code Online (Sandbox Code Playgroud)\n编辑:返回少量行的简单查询实际上成功完成,但输出大小较大的较重查询会失败并出现此错误。
\nJDBC postgres 驱动程序文档不会骗你。该错误来自 postgres 服务器本身,而不是来自 JDBC 驱动程序。整个 postgres 安装已损坏(psql例如,尝试从命令行运行该工具,您将收到相同的错误)。
您的问题中没有足够的详细信息来提示您如何解决该错误。然而,实际的问题是:“为什么 postgres JDBC 驱动程序需要这个‘非 java 共享库’”,答案是:它不需要那个库;它不需要这个库。不过你的 postgres 服务器确实如此。
| 归档时间: |
|
| 查看次数: |
62 次 |
| 最近记录: |