【295天】每日项目总结系列033(2017.11.27)
文章目录
叨叨两句
- ~
JDBC
1.注册驱动 DriverManager.registerDriver()
2.获得连接 DriverManager.getConnection(url,user,password)
3.创建执行SQL语句的对象 connection.prepareStatement(sql) prepareStatement.setString(index,value)
4.执行SQL语句 prepareStatement.excuteQuery/excuteUpdate()
5.关闭资源 close()
使用配置文件解决硬编码的问题
properties文件的读取方式
Properties properties = new Properties()
将文件转换成流的两种方式new FileInputStream(文件路径) classLoader.getResourceAsStream("文件名")
properties.load(inStream)
ResourceBundle bundle = ResouceBundle.getBundle('文件名不包含后缀')
bundle.getString(name)

评论
登录后参与技术讨论,分享你的经验与见解。
登录 / 注册暂无评论