- ~
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