2

我在 Tomcat 中有一个连接到 PostgreSQL 数据库的 webapp。我已将 JDBC PostgreSQL 驱动程序包含在lib/我的 webapp 的文件夹中。我使用的 IDE 是 Eclipse。

我收到这个错误

java.lang.ClassNotFoundException: org.postgresql.driver

相关代码片段:

Class.forName("org.postgresql.driver");
String connectionUrlString = "jdbc:postgresql://server_addr:5432/db_name";
Connection dbConnection = null;
dbConnection = DriverManager.getConnection (connectionUrlString, username, password);
4

1 回答 1

7

尝试使用大写字母D

Class.forName("org.postgresql.Driver");
于 2013-08-28T16:03:43.847 回答