我在Tomcat中有一个连接到PostgreSQL数据库的webapp。我已将JDBC PostgreSQL驱动程序包含在我的webapp的lib/
文件夹中。我使用的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);
答案 0 :(得分:5)
尝试使用大写D
:
Class.forName("org.postgresql.Driver");