最美情侣中文字幕电影,在线麻豆精品传媒,在线网站高清黄,久久黄色视频

歡迎光臨散文網(wǎng) 會員登陸 & 注冊

手寫數(shù)據(jù)庫連接池-C++11代碼實戰(zhàn)經(jīng)典-多線程和智能指針

2023-08-21 09:50 作者:每天3個拼課小技巧__  | 我要投稿

? public static void test01() throws Exception{ ? ? ? ?// 1. 創(chuàng)建一個Properties對象,讓其去讀取druid.properties文件 ? ? ? ?Properties properties = new Properties(); ? ? ? ?// 1.1 將druid.properties配置文件轉(zhuǎn)成字節(jié)輸入流// ? ? ? ?FileInputStream is = new FileInputStream("絕對路徑"); ? ? ? ?// 1.2 使用相對路徑來將配置文件轉(zhuǎn)成字節(jié)輸入流,可以使用類加載器來讀取類路徑下文件 ? ? ? ?// 獲取ClassLoader對象 ? ? ? ?ClassLoader classLoader = TestDataSource.class.getClassLoader(); ? ? ? ?InputStream is = classLoader.getResourceAsStream("druid.properties"); ? ? ? ?// 1.2 使用properties對象加載流 ? ? ? ?properties.load(is); ? ? ? ?// 2. 使用創(chuàng)建DruidDataSourceFactory創(chuàng)建Druid的連接池對象 ? ? ? ?DataSource dataSource = DruidDataSourceFactory.createDataSource(properties); ? ? ? ?// 3. 從連接池中取出一個連接使用 ? ? ? ?Connection connection1 = dataSource.getConnection();

手寫數(shù)據(jù)庫連接池-C++11代碼實戰(zhàn)經(jīng)典-多線程和智能指針的評論 (共 條)

分享到微博請遵守國家法律
平阳县| 诸暨市| 天长市| 拜泉县| 嵩明县| 彰化市| 祁门县| 龙口市| 博乐市| 崇左市| 玛纳斯县| 南平市| 股票| 雷波县| 宝坻区| 泸州市| 龙江县| 虎林市| 石狮市| 泰宁县| 新丰县| 平度市| 泾阳县| 潞城市| 中山市| 湘潭市| 巴马| 石阡县| 宜君县| 合江县| 聊城市| 若羌县| 湘潭市| 同仁县| 伊金霍洛旗| 巴林右旗| 峨边| 华阴市| 隆化县| 磴口县| 长武县|