日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時(shí)間:8:30-17:00
你可能遇到了下面的問(wèn)題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營(yíng)銷(xiāo)解決方案
使用組件實(shí)現(xiàn)JAVA連接Oracle數(shù)據(jù)庫(kù)

下面介紹JAVA連接Oracle數(shù)據(jù)庫(kù)的方法主要以Commons DbUtils組件來(lái)連接數(shù)據(jù)庫(kù)。該JAVA連接Oracle數(shù)據(jù)庫(kù)得方法供您參考,希望對(duì)您能有所幫助。

它將JDBC中的一些類(lèi)進(jìn)行了二次封裝,它不象hibernate(ORMapping)那樣將JAVA對(duì)象與數(shù)據(jù)庫(kù)映射。首先將oracle驅(qū)動(dòng)類(lèi)文件與Commons DbUtils組件的JAR文件一起引入到項(xiàng)目中。

 
 
 
  1. String sql = "insert into users(username,password) values(?,?)";
  2. String username = request.getParameter("username");
  3.     String param[]={StringUtil.filterHtml(username),StringUtil.filterHtml(request.getParameter("password"))
  4.     };
  5. try {
  6.     Context initContext = new InitialContext();
  7. DataSource ds = (DataSource) initContext.lookup("java:/comp/env/jdbc/oracleds");
  8. QueryRunner qr = new QueryRunner(ds);
  9. result = qr.update(sql, param);
  10.    } catch (NamingException e) {
  11.  // TODO Auto-generated catch block
  12.  e.printStackTrace();
  13. } catch (SQLException e) {
  14.    e.printStackTrace();
  15.     }

文章標(biāo)題:使用組件實(shí)現(xiàn)JAVA連接Oracle數(shù)據(jù)庫(kù)
本文地址:http://www.5511xx.com/article/dhodpji.html