test jdbc properties
来源:互联网 发布:c语言主函数的格式 编辑:程序博客网 时间:2024/05/16 11:34
public void test(){//classes\spring\db-config.properties/*jdbc.driverClassName=oracle.jdbc.driver.OracleDriverjdbc.url=jdbc:oracle:thin:@127.0.0.1:1521:zwfjdbc.username=11jdbc.password=11 */InputStream in = SysApplicationListener.class.getResourceAsStream("/spring/db-config.properties"); Properties p = new Properties(); try { p.load(in); String driverClassName = p.getProperty("jdbc.driverClassName"); String url = p.getProperty("jdbc.url"); String username = p.getProperty("jdbc.username"); String password = p.getProperty("jdbc.password"); } catch (IOException e) { e.printStackTrace(); }}
public void test(){//classes\spring\db-config.properties/*jdbc.driverClassName=oracle.jdbc.driver.OracleDriverjdbc.url=jdbc:oracle:thin:@127.0.0.1:1521:zwfjdbc.username=11jdbc.password=11 */ try {String path = SysApplicationListener.class.getResource("/spring/db-config.properties").getPath();System.out.println(path);//InputStream in = SysApplicationListener.class.getResourceAsStream("/spring/db-config.properties");InputStream in = new BufferedInputStream(new FileInputStream(path));Properties p = new Properties();//p.load(in);in.close();//String driverClassName = p.getProperty("jdbc.driverClassName");String url = p.getProperty("jdbc.url");String username = p.getProperty("jdbc.username");String password = p.getProperty("jdbc.password");String isUpdate = p.getProperty("isUpdate");//System.out.println(driverClassName);System.out.println(url);System.out.println(username);System.out.println(password);System.out.println(isUpdate);//if (isUpdate != null && isUpdate.equals("0")){//String path = SysApplicationListener.class.getResource("/spring/db-config.properties").getPath(); FileOutputStream out = new FileOutputStream(path);p.put("isUpdate", "1");p.store(out, "so boring. zengwenfeng.update");out.close();out.flush();//System.out.println("ok!");}} catch (IOException e) { e.printStackTrace(); }}
阅读全文
0 0
- test jdbc properties
- jdbc.properties
- jdbc.properties
- jdbc.properties
- jdbc.properties
- jdbc.properties
- JDBC.properties
- jdbc.properties
- jdbc.properties
- jdbc.properties
- jdbc.properties
- jdbc.properties
- jdbc.properties
- jdbc.properties
- jdbc.properties
- jdbc.properties
- jdbc.properties
- jdbc.properties
- 利用matplotlib画sigmoid函数
- 当变化来临,PM的心态和节奏如何把握?
- RSA实例详解
- 问答专场 | 我是蝉游记创始人纯银V,你有什么想问我?
- Markdown系列(8)- Markdown编辑器和常见的富文本编辑器有什么区别
- test jdbc properties
- 1027. 打印沙漏(20)
- 智能投顾 线下沙龙笔记
- 0-1背包问题
- Java基础知识(上)
- Android Studio 3.1 Preview DexArchiveBuilderException
- leetcode_492. Construct the Rectangle ? 待解决
- 2015年读书总结
- 由盛而衰的O2O,在明年还能笑傲江湖吗?