postgresql - 未找到合适的驱动程序对于 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 的驱动程序
解决方案
推荐阅读
- java - 盒装与原始类型作为实体 id
- linux - 如何从 Linux 中的文件运行 Bash 'export' 命令?
- javascript - 我似乎无法让我的按钮在我的登录屏幕上提交信息
- hibernate - JPA @OneToMany & @ManyToOne 空
- three.js - 将人体 .obj 分割成碎片
- android - 如何将“微调器”放在按钮顶部
- email - SPF 永久错误:DNS 查找过多
- python - 如何放大cartopy
- python-3.x - 在 pandas 列上应用 MinMaxScaler()
- angular - 如何从 JQuery datepicker select 调用 typescript 函数