报错:不能找到系统文件properties
来源:互联网 发布:exe软件看源码 编辑:程序博客网 时间:2024/06/07 00:37
public static Connection getConn(){
Connection conn=null;
try {
Properties ps = new Properties();
ps.load(new FileInputStream("D://Eclipse第二阶段//JSTLDemo//jdbc.properties"));
String driver = ps.getProperty("driverClass");
String url = ps.getProperty("url");
String user = ps.getProperty("userName");
String pwd = ps.getProperty("password");
System.out.println(driver);
System.out.println(url);
System.out.println(user);
System.out.println(pwd);
Class.forName(driver);
conn = DriverManager.getConnection(url, user, pwd);
} catch (Exception e) {
e.printStackTrace();
}
return conn;
Connection conn=null;
try {
Properties ps = new Properties();
ps.load(new FileInputStream("D://Eclipse第二阶段//JSTLDemo//jdbc.properties"));
String driver = ps.getProperty("driverClass");
String url = ps.getProperty("url");
String user = ps.getProperty("userName");
String pwd = ps.getProperty("password");
System.out.println(driver);
System.out.println(url);
System.out.println(user);
System.out.println(pwd);
Class.forName(driver);
conn = DriverManager.getConnection(url, user, pwd);
} catch (Exception e) {
e.printStackTrace();
}
return conn;
}
只需要把jdbc.properties的地址改成绝对地址值D://Eclipse第二阶段//JSTLDemo//jdbc.properties就可以了
阅读全文
0 0
- 报错:不能找到系统文件properties
- Oracle报错不能找到SID解决办法
- 手把手教你: Qt程序编译报错:moc...***.h文件不能找到
- QT4,从debug下运行.exe,系统报错。没有找到mingwm10.dll文件
- intelij 创建新的Application时没有AndroidManifest文件,并报不能找到java.exe
- dxtrans.h 文件不能找到
- oracle安装没有找到文件OCS4J.properties
- 内存不能为read。。。系统报错。
- Suse系统用户不能登录报错
- ant 命令打包报错 local.properties文件找不到
- 解决Spring引入properties文件报错问题
- Android - R资源未找到至java文件报错
- pom文件报错提示无法找到jar包
- 【linux问题集1】启动linux系统过程中报无法找到文件或目录
- 在SDN开发中遇到的python报错,不能找到simplejson
- 使用echarts不能找到ID.报错echarts is not defined.
- properties文件不能保存中文问题
- properties文件不能保存中文问题
- NOIP模拟赛 鸽巢原理 + 众数 + Trie
- Poj 3468 A Simple Problem with Integers
- C++集锦三 操作符重载
- Docker 使用指南 (四)—— 数据卷的使用
- HDFS结构介绍
- 报错:不能找到系统文件properties
- <学习html>第六天笔记-表单标签(input控件、label标签)
- Spring框架详解(1)
- 210串口控制台-210移植printf不好使
- HDU 1166 敌兵布阵
- 数位dp-R
- C++集锦四 MyString类
- BP神经网络
- 在liunx编译C语言程序出现Undefined reference to pthread_create in Linux 错误*