【295天】每日项目总结系列033(2017.11.27)

叨叨两句

  1. ~

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()sql

使用配置文件解决硬编码的问题

properties文件的读取方式
Properties properties = new Properties()
将文件转换成流的两种方式new FileInputStream(文件路径) classLoader.getResourceAsStream("文件名")
properties.load(inStream)编码

ResourceBundle bundle = ResouceBundle.getBundle('文件名不包含后缀')
bundle.getString(name)url

相关文章
相关标签/搜索