mybatis的properties的url属性怎么配置
1个回答
展开全部
mybatis jdbc.properties是默认的数据库配置文件
public void writeVaule()
{
Properties pro=new Properties();
InputStream in=pro.getClass().getResourceAsStream("/dbConfig/dbsqlsever.properties");
try {
pro.load(in);
pro.setProperty("driver", "mysql");
pro.setProperty("url", "jdbce");
pro.setProperty(username, "lijia");
pro.setProperty("password", "125487");OutputStream os = null;
os = new FileOutputStream(new File(pro.getClass().getResourceAsStream("/dbConfig/dbsqlsever.properties").toURI()));
pro.store(os, null);
os.flush();
os.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public void writeVaule()
{
Properties pro=new Properties();
InputStream in=pro.getClass().getResourceAsStream("/dbConfig/dbsqlsever.properties");
try {
pro.load(in);
pro.setProperty("driver", "mysql");
pro.setProperty("url", "jdbce");
pro.setProperty(username, "lijia");
pro.setProperty("password", "125487");OutputStream os = null;
os = new FileOutputStream(new File(pro.getClass().getResourceAsStream("/dbConfig/dbsqlsever.properties").toURI()));
pro.store(os, null);
os.flush();
os.close();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询