這篇文章主要講解了“jdbc怎么讓連接關(guān)閉”,文中的講解內(nèi)容簡單清晰,易于學(xué)習(xí)與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學(xué)習(xí)“jdbc怎么讓連接關(guān)閉”吧!
成都創(chuàng)新互聯(lián)公司基于分布式IDC數(shù)據(jù)中心構(gòu)建的平臺為眾多戶提供川西大數(shù)據(jù)中心 四川大帶寬租用 成都機柜租用 成都服務(wù)器租用。
public Boolean exeUpdateSql(String sql){ // log.info("cliockhouse 執(zhí)行更新sql:" + sql); Connection connection = getConn(); Statement statement = null; ResultSet results=null; try { statement = connection.createStatement(); results = statement.executeQuery(sql); return true; } catch (Exception e) { e.printStackTrace(); MyExceptionUtils.getExceptionInfo(e); return false; }finally { if(connection!=null){ try { connection.close(); } catch (SQLException e) { e.printStackTrace(); return false; } connection = null; } if(results!=null){ try { results.close(); } catch (SQLException e) { e.printStackTrace(); return false; } results = null; } if(statement!=null){ try { statement.close(); } catch (SQLException e) { e.printStackTrace(); return false; } statement = null; } } }
感謝各位的閱讀,以上就是“jdbc怎么讓連接關(guān)閉”的內(nèi)容了,經(jīng)過本文的學(xué)習(xí)后,相信大家對jdbc怎么讓連接關(guān)閉這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是創(chuàng)新互聯(lián),小編將為大家推送更多相關(guān)知識點的文章,歡迎關(guān)注!
名稱欄目:jdbc怎么讓連接關(guān)閉
URL標(biāo)題:http://bm7419.com/article28/psdccp.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供軟件開發(fā)、外貿(mào)建站、網(wǎng)站收錄、、動態(tài)網(wǎng)站、網(wǎng)站設(shè)計
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)