日期:2014-05-16  浏览次数:20555 次

Java ----JDBC

銆€杩欑瘒鏂囩珷閲岋紝鎴戜滑鏉ヨ璁轰竴浜涘拰JDBC鐩稿叧鐨勮瘽棰樸€?/p>

銆€銆€姒傝堪

銆€銆€灏界鍦ㄥ疄闄呭紑鍙戣繃绋嬩腑锛屾垜浠竴鑸娇鐢∣RM妗嗘灦鏉ヤ唬鏇夸紶缁熺殑JDBC锛屼緥濡侶ibernate鎴栬€卛Batis锛屼絾JDBC鏄疛ava鐢ㄦ潵瀹炵幇鏁版嵁璁块棶鐨勫熀纭€锛屾帉鎻″畠瀵逛簬鎴戜滑鐞嗚ВJava鐨勬暟鎹搷浣滄祦绋嬪緢鏈夊府鍔┿€?/p>

銆€銆€JDBC鐨勫叏绉版槸Java Database Connectivity銆?/p>

銆€銆€JDBC瀵规暟鎹簱杩涜鎿嶄綔鐨勬祦绋嬶細

  • 杩炴帴鏁版嵁搴?/li>
  • 鍙戦€佹暟鎹姹傦紝鍗充紶缁熺殑CRUD鎸囦护
  • 杩斿洖鎿嶄綔缁撴灉闆?/li>

銆€銆€JDBC涓父鐢ㄧ殑瀵硅薄鍖呮嫭锛?/p>

  • ConnectionManager
  • Connection
  • Statement
  • CallableStatement
  • PreparedStatement
  • ResultSet
  • SavePoint

銆€銆€涓€涓畝鍗曠ず渚?/h2>

銆€銆€鎴戜滑鏉ョ湅涓嬮潰涓€涓畝鍗曠殑绀轰緥锛屽畠浣跨敤JDK鑷甫鐨凞erby鏁版嵁搴擄紝鍒涘缓涓€寮犺〃锛屾彃鍏ヤ竴浜涜褰曪紝鐒跺悗灏嗚褰曡繑鍥烇細

澶嶅埗浠g爜
 1 private static void test1() throws SQLException
 2 {
 3     St