[JavaBean] 路径问题 在jb中添加进test.ini就没问题了。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 添加了,然后程序是这样的InputStream ins = new FileInputStream("DBConnString.ini");可是找不到文件?还需要做什么? 这个例子看看有没有用:Properties prop = new Properties();try { InputStream is = getClass().getResourceAsStream("db.properties"); prop.load(is); if( is != null ) is.close();} catch (IOException e) { System.out.println("[DbConnection] 打开文件时出现错误");}String jdbc = prop.getProperty("driver");String url = prop.getProperty("url");String user = prop.getProperty("user");String password = prop.getProperty("password"); to RobinHZ(熊掌):请问你的db.properties是放在什么文件夹? java调用FlashPaper2.2将docx转化pdf问题 js中的geturl取值的内容 关于JSP显示在主页信列表的问题 Hibernate中文删除乱码 session注销问题 求助:jsp页面和后台程序的数据交换 struts标签问题 spring整合hibernate时出现的问题 关于连接池的关闭问题 有很多问题等待解决,JSP高手请进!(急!!!!!!) 一个小问题 连接数据库成功,sql语句也可通过,却抛出no data found异常?
InputStream ins = new FileInputStream("DBConnString.ini");可是找不到文件?还需要做什么?
Properties prop = new Properties();try {
InputStream is = getClass().getResourceAsStream("db.properties");
prop.load(is);
if( is != null ) is.close();
} catch (IOException e) {
System.out.println("[DbConnection] 打开文件时出现错误");
}String jdbc = prop.getProperty("driver");
String url = prop.getProperty("url");
String user = prop.getProperty("user");
String password = prop.getProperty("password");
请问你的db.properties是放在什么文件夹?