首页 > 解决方案 > 未找到合适的驱动程序对于 postgress

问题描述

我已经在 eclipse (web-inf/lib) 文件夹中部署了 postgres 当前版本的 jar 文件,但仍然 Class.forName not laoded`,当我打开具有相同设置的透视图时,它连接打开 Perspectice 图像,请查看单击它

    Connection connect() throws SQLException,ClassNotFoundException {
    System.out.println("welcome to the world of database");
    Connection conn = null;

     try {
        Class.forName("org.postgresql.Driver");
        System.out.println("class loaded");
     }catch(ClassNotFoundException e){
         System.out.println("class not loaded");

     }
     conn=DriverManager.getConnection("jdbc:postgresql://localhost:2345/my_first_databse", "postgres","postgres");
        System.out.println("Connected to the PostgreSQL server successfully.");
        return conn;

}//eof connect

输出:欢迎来到未加载数据库类的世界 找不到适合 jdbc:postgresql://localhost:2345/my_first_databse 的驱动程序

标签: postgresqljdbcdriver

解决方案


推荐阅读