站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > MySQL 5.1参考手册中文版

Chapter聽26.聽 Connectors - MySQL 5.1参考手册中文版

绗26绔狅細杩炴帴鍣

鐩綍

26.1. MySQL Connector/ODBC
26.1.1. MyODBC浠嬬粛
26.1.2. 鍏充簬ODBC鍜孧yODBC鐨勪竴鑸俊鎭
26.1.3. 濡備綍瀹夎MyODBC
26.1.4. 鍦╓indows骞冲彴涓婁粠浜岃繘鍒剁増鏈畨瑁匨yODBC
26.1.5. I鍦║nix骞冲彴涓婁粠浜岃繘鍒剁増鏈畨瑁匨yODBC
26.1.6. 鍦╓indows骞冲彴涓婁粠婧愮爜鐗堟湰瀹夎MyODBC
26.1.7. 鍦║nix骞冲彴涓婁粠婧愮爜鐗堟湰瀹夎MyODBC
26.1.8. 浠嶣itKeeper寮鍙戞簮鐮佹爲瀹夎MyODBC
26.1.9. MyODBC閰嶇疆
26.1.10. 涓嶮yODBC杩炴帴鐩稿叧鐨勪簨瀹
26.1.11. MyODBC鍜孧icrosoft Access
26.1.12. MyODBC鍜孧icrosoft VBA鍙夾SP
26.1.13. MyODBC鍜岀涓夋柟ODBC宸ュ叿
26.1.14. MyODBC閫氱敤鍔熻兘
26.1.15. 鍩烘湰鐨凪yODBC搴旂敤姝ラ
26.1.16. MyODBC API寮曠敤
26.1.17. MyODBC鏁版嵁绫诲瀷
26.1.18. MyODBC閿欒浠g爜
26.1.19. MyODBC涓嶸B锛欰DO銆丏AO鍜孯DO
26.1.20. MyODBC涓嶮icrosoft.NET
26.1.21. 鎰熻阿
26.2. MySQL Connector/NET
26.2.1. 鍓嶈█
26.2.2. 涓嬭浇骞跺畨瑁匨ySQL Connector/NET
26.2.3. Connector/NET浣撶郴缁撴瀯
26.2.4. 浣跨敤MySQL Connector/NET
26.2.5. MySQL Connector/NET鍙樻洿鍙
26.3. MySQL Connector/J
26.3.1. 鍩烘湰鐨凧DBC姒傚康
26.3.2. 瀹夎 Connector/J
26.3.3. JDBC寮曠敤
26.3.4. 涓嶫2EE鍜屽叾浠朖ava妗嗘灦涓璧蜂娇鐢 Connector/J
26.3.5. 璇婃柇 Connector/J鏂归潰鐨勯棶棰
26.3.6. Changelog
26.4. MySQL Connector/MXJ
26.4.1. 鍓嶈█
26.4.2. 鏀寔骞冲彴锛
26.4.3. Junit娴嬭瘯瑕佹眰
26.4.4. 杩愯Junit娴嬭瘯
26.4.5. 浣滀负JDBC椹卞姩绋嬪簭鐨勪竴閮ㄥ垎杩愯
26.4.6. 鍦↗ava瀵硅薄涓繍琛
26.4.7. MysqldResource API
26.4.8. 鍦↗MX浠g悊(custom)涓繍琛
26.4.9. 閮ㄧ讲鍦ㄦ爣鍑嗙殑JMX浠g悊鐜涓 (JBoss)
26.4.10. 瀹夎
鍦ㄦ湰绔犱腑锛屼粙缁嶄簡MySQL杩炴帴鍣紝鎵璋撹繛鎺ュ櫒锛屾槸涓哄鎴风绋嬪簭鎻愪緵涓嶮ySQL鏈嶅姟鍣ㄨ繛鎺ユх殑椹卞姩绋嬪簭銆

26.1.聽MySQL Connector/ODBC

閫氳繃MySQL Connector/ODBC锛圡yODBC椹卞姩绋嬪簭绯诲垪锛夛紝MySQL涓篛DBC鎻愪緵浜嗘敮鎸併傝繖鏄拡瀵筂yODBC椹卞姩绋嬪簭涓瑿onnector/ODBC浜у搧绯诲垪鐨勫弬鑰冿紝瀹冩彁渚涗簡瀵筂ySQL鏁版嵁搴撶郴缁熺殑ODBC 3.5x鍏煎璁块棶銆備粙缁嶄簡瀹夎MyODBC鍜屼娇鐢∕yODBC鐨勬柟寮忋傛澶栵紝鍦ㄦ湰绔犱腑杩樹粙缁嶄簡鑳藉涓嶮yODBC涓璧峰伐浣滅殑鍏敤绋嬪簭淇℃伅锛屽苟鍥炵瓟浜嗕竴浜涘叧浜嶮yODBC鐨勫父瑙侀棶棰樸

鏈弬鑰冮傜敤浜嶮yODBC 3.51銆傚浜庣浉搴旂殑鐗堟湰锛屼綘鍙互鎵惧埌鏃х殑浜岃繘鍒剁増鎴栨簮鐮佺増MyODBC鎵嬪唽銆

杩欐槸鍏充簬MySQL ODBC椹卞姩绋嬪簭鐨勫弬鑰冩墜鍐岋紝鑰屼笉鏄氱敤ODBC鍙傝冦傚叧浜嶰DBC鐨勬洿澶氫俊鎭紝璇峰弬闃http://www.microsoft.com/data/

瀵逛簬鏈弬鑰冪殑搴旂敤绋嬪簭寮鍙戦儴鍒嗭紝鍋囧畾鐢ㄦ埛鍦–璇█鏂归潰鏈夌潃鑹ソ鐨勫疄璺电煡璇嗭紝瀵笵BMS鏈変竴鑸簡瑙o紝鏈鍚庯紝杩樺簲鐔熸倝MySQL銆傚叧浜嶮ySQL鍔熻兘鍙婂叾璇硶鐨勬洿澶氫俊鎭紝璇峰弬闃http://dev.mysql.com/doc/

濡傛灉浣犵殑闂鏈兘鍦ㄦ湰鏂囨。涓緱鍒拌В绛旓紝璇峰彂閫佺數瀛愰偖浠惰嚦myodbc@lists.mysql.com

26.1.1.聽MyODBC浠嬬粛

26.1.1.1. 浠涔堟槸ODBC锛

ODBC锛堝紑鏀惧紡鏁版嵁搴撹繛鎺ユэ級涓哄鎴风绋嬪簭鎻愪緵浜嗚闂紬澶氭暟鎹簱鎴栨暟鎹簮鐨勪竴绉嶆柟寮忋侽DBC鏄爣鍑嗗寲鐨凙PI锛屽厑璁镐笌SQL鏁版嵁搴撴湇鍔″櫒杩涜杩炴帴銆傚畠鏄牴鎹甋QL Access Group鐨勮鑼冨紑鍙戠殑锛屽畠瀹氫箟浜嗕竴濂楀嚱鏁拌皟鐢ㄣ侀敊璇唬鐮佸拰鏁版嵁绫诲瀷锛屽彲灏嗗叾鐢ㄤ簬寮鍙戠嫭绔嬩簬鏁版嵁搴撶殑搴旂敤绋嬪簭銆傞氬父鎯呭喌涓嬶紝褰撻渶瑕佹暟鎹簱鐙珛鎴栭渶瑕佸悓鏃惰闂笉鍚岀殑鏁版嵁婧愭椂锛屽皢鐢ㄥ埌ODBC銆

鍏充簬ODBC鐨勬洿澶氫俊鎭紝璇峰弬闃http://www.microsoft.com/data/

26.1.1.2. 浠涔堟槸Connector/ODBC锛

Connector/ODBC鏄弿杩癕ySQL ODBC椹卞姩绋嬪簭MySQL AB浜у搧绯诲垪鐨勫悕绉般傚畠浠篃绉颁负MyODBC椹卞姩绋嬪簭銆

26.1.1.3. 浠涔堟槸MyODBC 2.50锛

MyODBC 2.50鏄疢ySQL AB鐨32浣峅DBC椹卞姩绋嬪簭锛屽畠鍩轰簬ODBC 2.50瑙勮寖灞傛0锛堝叿鏈夊眰娆1鍜屽眰娆2鐨勭壒鎬э級銆傝繖鏄紑鏀炬簮鐮佸競鍦烘渶娴佽鐨凮DBC椹卞姩绋嬪簭涔嬩竴锛屽緢澶氱敤鎴烽兘浣跨敤瀹冩潵璁块棶MySQL鎻愪緵鐨勫姛鑳姐

26.1.1.4. 浠涔堟槸MyODBC 2.50锛

MyODBC 3.51鏄竴绉32浣峅DBC椹卞姩绋嬪簭锛屼篃绉颁负MySQL ODBC 3.51椹卞姩绋嬪簭銆備笌宸叉湁鐨凪yODBC 2.50椹卞姩绋嬪簭鐩告瘮锛岃鐗堟湰鏈夋墍澧炲己銆傚畠鏀寔ODBC 3.5x瑙勮寖灞傛1锛堝叏閮ㄦ牳蹇傾PI +灞傛2鐗规э級锛屼互渚胯兘澶熶负璁块棶MySQL鎻愪緵鎵鏈夌殑ODBC鍔熻兘銆

26.1.1.5. 浠庡摢鑾峰彇MyODBC

MySQL AB渚滸PL锛堥氱敤鍏叡璁稿彲锛夊彂甯冨叾鎵鏈変骇鍝併備綘鍙互浠嶮ySQL AB鐨勭綉绔欒幏鍙栨渶鏂扮殑MyODBC浜岃繘鍒剁増鍜屾簮鐮佺増锛http://dev.mysql.com/downloads/

鍏充簬MyODBC鐨勬洿澶氫俊鎭紝璇疯闂http://www.mysql.com/products/myodbc/

鍏充簬璁稿彲鐨勬洿澶氫俊鎭紝璇疯闂http://www.mysql.com/company/legal/licensing/

26.1.1.6. 鏀寔鐨勫钩鍙

MyODBC鍙敤浜嶮ySQL鏀寔鐨勬墍鏈変富瑕佸钩鍙帮紝濡傦細

         Windows 95, 98, Me, NT, 2000, XP鍜2003

         鎵鏈塙nix鎿嶄綔绯荤粺

o        AIX

o        Amiga

o        BSDI

o        DEC

o        FreeBSD

o        HP-UX 10, 11

o        Linux

o        Mac OS X Server

o        Mac OS X

o        NetBSD

o        OpenBSD

o        OS/2

o        SGI Irix

o        Solaris

o        SunOS

o        SCO OpenServer

o        SCO UnixWare

o        Tru64 Unix

瀵逛簬鐗瑰畾骞冲彴锛屽鏋滄棤娉曚笅杞戒簩杩涘埗鐗堟湰锛屽彲閫氳繃涓嬭浇椹卞姩绋嬪簭婧愮爜鑷鍒涘缓椹卞姩绋嬪簭銆備綘涔熷彲浠ヤ负MySQL璐$尞浜岃繘鍒朵唬鐮侊紝鏂瑰紡鏄彂閫侀偖浠惰嚦myodbc@lists.mysql.com锛岃繖鏍峰叾浠栫敤鎴峰氨鑳戒娇鐢ㄤ綘璐$尞鐨勫唴瀹广

26.1.1.7. MyODBC閭欢鍒楄〃

MySQL AB閫氳繃鍏堕偖浠跺垪琛ㄤ负鐢ㄦ埛绀惧尯鎻愪緵甯姪銆傚浜庝笌MyODBC鏈夊叧鐨勪簨瀹滐紝鍙娇鐢myodbc@lists.mysql.com閭欢鍒楄〃锛屼粠鏈夌粡楠岀殑鐢ㄦ埛澶勮幏寰楀府鍔┿

鍏充簬璁㈤槄MySQL閭欢鍒楄〃鎴栨祻瑙堝垪琛ㄦ。妗堢殑鏇村淇℃伅锛岃璁块棶http://lists.mysql.com/

鍏朵腑锛屽叧娉ㄧ▼搴︽渶楂樼殑鏄鍧汳ySQL杩炴帴鍣ㄩ儴鍒嗙殑ODBC璁哄潧銆

26.1.1.8. MyODBC璁哄潧

閫氳繃MySQL璁哄潧锛堜綅浜http://forums.mysql.com锛夛紝鍙幏寰楁湁缁忛獙鐢ㄦ埛鐨勬敮鎸佸拰甯姪銆

26.1.1.9. 濡備綍閫氭姤MyODBC闂鎴栫己闄

濡傛灉閬囧埌涓嶮yODBC鏈夊叧鐨勫洶闅炬垨闂锛岄鍏堝簲浣跨敤ODBC绠$悊鍣ㄥ拰MyODBC鐢熸垚涓浠芥棩蹇楁枃浠锛堣姹傛潵鑷狾DBC ADMIN鐨勬棩蹇楁椂鑾峰緱鐨勬棩蹇楁枃浠讹級銆鍏充簬瀹屾垚璇ユ楠ょ殑鏂瑰紡锛岃鍙傝26.1.9.7鑺傦紝鈥滆幏鍙朞DBC璺熻釜鏂囦欢鈥

妫鏌yODBC璺熻釜鏂囦欢锛屾壘鍑哄彲鑳藉嚭閿欑殑鍦版柟銆傞氳繃鍦myodbc.log鏂囦欢涓悳绱㈠瓧绗︿覆>mysql_real_query锛屽彲纭畾宸叉墽琛岀殑璇彞銆

姝ゅ锛屼綘杩樺簲灏濊瘯浠mysql瀹㈡埛绔▼搴忔垨admndemo鎵ц璇彞銆傝繖鏍凤紝灏辫兘甯姪浣犵‘瀹氶敊璇殑鍑哄锛孧yODBC鎴朚ySQL銆

濡傛灉浣犲彂鐜颁簡涓嶆纭殑浜嬮」锛岃灏嗙浉鍏宠锛堟渶澶40琛岋級鍙戦佺粰MyODBC閭欢鍒楄〃銆傝鍙傝1.7.1.1鑺傦紝鈥淢ySQL閭欢鍒楄〃鈥銆傝鍕垮彂閫佹暣涓狹yODBC鎴朞DBC鏃ュ織鏂囦欢锛

濡傛灉浣犳棤娉曟壘鍑洪敊璇箣鎵鍦紝鏈鍚庣殑閫夋嫨鏄紝浠ar鎴杬ip鏍煎紡鍒涘缓鍖呭惈MyODBC璺熻釜鏂囦欢銆丱DBC鏃ュ織鏂囦欢鍜孯EADME鏂囦欢锛堥槓鏄庨棶棰橈級鐨勬。妗堛備綘鍙互灏嗚妗f鏂囦欢鍙戦佽嚦ftp://ftp.mysql.com/pub/mysql/upload/銆傚彧鏈変綅浜嶮ySQL AB鐨勬垜浠墠鑳借闂綘涓婁紶鐨勬枃浠讹紝鑰屼笖鎴戜滑浼氬崄鍒嗚皑鎱庡湴瀵瑰緟杩欑被鏁版嵁銆

濡傛灉浣犲垱寤轰簡浠嶅嚭鐜伴棶棰樼殑绋嬪簭锛岃灏嗚绋嬪簭涔熷寘鍚湪妗f鏂囦欢涓

濡傛灉绋嬪簭鑳藉涓庢煇浜涘叾浠朣QL鏈嶅姟鍣ㄤ竴璧峰伐浣滐紝妗f涓繕搴斿寘鍚湪杩欑被鍏朵粬SQL鏈嶅姟鍣ㄤ笅宸ヤ綔鐨凮DBC鏃ュ織鏂囦欢銆

璇疯浣忥紝浣犳彁渚涚粰鎴戜滑鐨勪俊鎭秺澶氾紝鎴戜滑鏇存闂鐨勬満浼氬氨瓒婂ぇ銆

26.1.1.10. 濡備綍鎻愪氦MyODBC琛ヤ竵

浣犲彲浠ラ氳繃鐢靛瓙閭欢锛屽氨宸叉湁浠g爜鎴栭棶棰樺彂閫佽ˉ涓佹垨鎻愬嚭鏇村ソ鐨勮В鍐虫柟妗堬細myodbc@lists.mysql.com

26.1.2. 鍏充簬ODBC鍜孧yODBC鐨勪竴鑸俊鎭

26.1.2.1. ODBC浠嬬粛

寮鏀惧紡鏁版嵁搴撹繛鎺ユэ紙ODBC锛夋槸骞挎硾鎺ュ彈鐨勭敤浜庢暟鎹簱璁块棶鐨勫簲鐢ㄧ▼搴忕紪绋嬫帴鍙o紙API锛夈傚畠鍩轰簬閽堝鏁版嵁搴揂PI鐨凜LI锛堣皟鐢ㄥ眰鎺ュ彛锛夎鑼冿紙鏉ヨ嚜X/Open鍜孖SO/IEC锛夛紝骞堕噰鐢ㄤ簡缁撴瀯鍖栨煡璇㈣瑷锛圫QL锛変綔涓哄叾鏁版嵁搴撹闂瑷銆

26.1.16鑺傦紝鈥淢yODBC API寮曠敤鈥涓紝姒傝浠嬬粛浜哅yODBC鏀寔鐨凮DBC鍔熻兘銆傚叧浜嶰DBC鐨勬洿澶氫俊鎭紝璇峰弬闃http://www.microsoft.com/data/

26.1.2.2.聽MyODBC浣撶郴缁撴瀯

MyODBC浣撶郴缁撴瀯寤虹珛鍦5涓粍浠朵笂锛屽涓嬪浘鎵绀猴細

MyODBC Architecture

         搴旂敤绋嬪簭锛

搴旂敤绋嬪簭鎸囩殑鏄氳繃璋冪敤ODBC API鏉ヨ闂甅ySQL鏈嶅姟鍣ㄤ笂鏁版嵁鐨勭▼搴忋傚簲鐢ㄧ▼搴忎娇鐢ㄦ爣鍑嗙殑ODBC璋冪敤涓庨┍鍔ㄧ鐞嗗櫒杩涜閫氫俊銆傚簲鐢ㄧ▼搴忎笉鍏冲績鏁版嵁鐨勫瓨鍌ㄤ綅缃紝瀛樺偍鏂瑰紡锛岀敋鑷充笉鍏冲績涓鸿闂暟鎹岃繘琛岀殑绯荤粺閰嶇疆鏂瑰紡銆傚畠浠呴渶瑕佺煡閬撴暟鎹簮鍚嶏紙DSN锛夈

瀵逛簬鎵鏈夌殑搴旂敤绋嬪簭锛屾棤璁哄畠浠娇鐢∣BDC鐨勬柟寮忔槸浠涔堬紝寰堝浠诲姟鏄叡鍚岀殑銆傝繖浜涗换鍔″寘鎷細

o        閫夋嫨MySQL鏈嶅姟鍣紝骞朵笌涔嬭繛鎺ャ

o        鎻愪氦灏嗚鎵ц鐨凷QL璇彞銆

o        妫绱㈢粨鏋滐紙濡傛灉鏈夌殑璇濓級銆

o        澶勭悊閿欒銆

o        鎻愪氦鎴栧洖婊氬寘鍚玈QL璇彞鐨勪簨鍔°

o        鏂紑涓嶮ySQL鏈嶅姟鍣ㄧ殑杩炴帴銆

鐢变簬澶у鏁版暟鎹闂伐浣滄槸浣跨敤SQL瀹屾垚锛屽浜庝娇鐢∣BDC鐨勫簲鐢ㄧ▼搴忔潵璇达紝鍏朵富瑕佷换鍔℃槸鎻愪氦SQL璇彞锛屽苟妫绱㈢敱杩欎簺璇彞鐢熸垚鐨勭粨鏋溿

         椹卞姩绠$悊鍣細

椹卞姩绠$悊鍣ㄦ槸鐢ㄤ簬绠$悊搴旂敤绋嬪簭鍜岄┍鍔ㄧ▼搴忛棿閫氫俊鐨勫簱銆傚畠璐熻矗鎵ц涓嬭堪浠诲姟锛

o        瑙f瀽鏁版嵁婧愬悕锛圖SN锛夈

o        鍔犺浇鍜屽嵏杞介┍鍔ㄧ▼搴忋

o        澶勭悊ODBC璋冪敤锛屾垨灏嗗叾浼犻掔粰椹卞姩绋嬪簭銆

         MyODBC椹卞姩绋嬪簭锛

MyODBC椹卞姩绋嬪簭鏄敤浜庡疄鏂絆DBC API鎵鎻愪緵鍔熻兘鐨勫簱銆傚畠璐熻矗澶勭悊ODBC鍑芥暟璋冪敤锛屽皢SQL璇锋眰鎻愪氦缁橫ySQL鏈嶅姟鍣紝骞跺皢缁撴灉杩斿洖缁欏簲鐢ㄧ▼搴忋傚鏈夊繀瑕侊紝椹卞姩绋嬪簭浼氭洿鏀瑰簲鐢ㄧ▼搴忕殑璇锋眰锛屼互渚胯璇锋眰绗﹀悎MySQL鏀寔鐨勮娉曘

         ODBC.INI锛

ODBC.INI鏄疧DBC閰嶇疆鏂囦欢锛屽叾涓繚瀛樹簡杩炴帴鍒版湇鍔″櫒鎵闇鐨勯┍鍔ㄤ俊鎭拰鏁版嵁搴撲俊鎭傞┍鍔ㄧ鐞嗗櫒灏嗕娇鐢ㄥ畠鏉ョ‘瀹氬姞杞藉摢涓┍鍔ㄧ▼搴忥紙浣跨敤鏁版嵁婧愬悕锛夈傞┍鍔ㄧ▼搴忓皢鏍规嵁鎸囧畾鐨凞SN浣跨敤瀹冩潵璇诲彇杩炴帴鍙傛暟銆傛洿澶氫俊鎭紝璇峰弬瑙26.1.9鑺傦紝鈥淢yODBC閰嶇疆鈥

         MySQL鏈嶅姟鍣細

MySQL鏈嶅姟鍣ㄦ槸鏁版嵁婧愩侻ySQL鏄細

o        涓绉嶆暟鎹簱绠$悊绯荤粺锛圖BMS锛

o        涓绉嶅叧鑱旀暟鎹簱绠$悊绯荤粺锛圧DBMS锛

o        寮鏀炬簮鐮佽蒋浠

26.1.2.3. ODBC椹卞姩绠$悊鍣

ODBC椹卞姩绠$悊鍣ㄦ槸鐢ㄤ簬绠$悊ODBC搴旂敤绋嬪簭鍜岄┍鍔ㄧ▼搴忛棿閫氫俊鐨勫簱銆傚叾涓昏鍔熻兘鍖呮嫭锛

         瑙f瀽鏁版嵁婧愬悕锛圖SN锛夈

         鍔犺浇鍜屽嵏杞介┍鍔ㄧ▼搴忋

         澶勭悊ODBC鍑芥暟璋冪敤锛屾垨灏嗗叾浼犻掔粰椹卞姩绋嬪簭銆

涓嬮潰缁欏嚭浜嗕竴浜涘父鐢ㄧ殑椹卞姩绋嬪簭锛

         Microsoft Windows ODBC椹卞姩绠$悊鍣紙odbc32.dll锛夛紝http://www.microsoft.com/data/

         unixODBC Unix椹卞姩绠$悊鍣紙libodbc.so锛夛紝http://www.unixodbc.org

         iODBC ODBC Unix椹卞姩绠$悊鍣紙libiodbc.so锛夛紝http://www.iodbc.org

浠2.1.2鐗堝紑濮嬶紝UnixODBC涔熸彁渚汳yODBC 3.51銆

26.1.2.4. MySQL ODBC椹卞姩绋嬪簭鐨勭被鍨

MySQL AB鏀寔涓ょ閫氳繃ODBC API璁块棶MySQL鍔熻兘鐨勫紑鏀炬簮鐮丱DBC椹卞姩绋嬪簭锛 MyODBC (MyODBC 2.50)鍜孧ySQL ODBC 3.51椹卞姩(MyODBC 3.51)銆

娉ㄩ噴锛 浠庢湰鑺傝捣锛屾垜浠皢杩欎袱绫婚┍鍔ㄧ▼搴忕粺绉颁负MyODBC銆備絾褰撳瓨鍦ㄥ樊寮傛椂锛屾垜浠皢浣跨敤瀹冧滑鐨勬湰鍚嶃

26.1.3. 濡備綍瀹夎MyODBC

MyODBC鑳藉宸ヤ綔鍦╓indows 9x, Me, NT, 2000, XP鍜2003锛屼互鍙婂ぇ澶氭暟Unix骞冲彴涓娿

MyODBC鏄紑鏀炬簮鐮佽蒋浠躲備綘鍙互鍦ㄧ綉绔http://dev.mysql.com/downloads/connector/odbc/涓婃壘鍒板畠鐨勬渶鏂扮増鏈傝娉ㄦ剰锛2.50.x鐗堥噰鐢ㄧ殑鏄疞GPL璁稿彲锛岃3.51.x鐗堥噰鐢ㄧ殑鏄疓PL璁稿彲銆

濡傛灉浣跨敤MyODBC鏃跺嚭鐜颁簡闂锛岃屼笖浣犵殑绋嬪簭杩樿兘涓嶰LEDB涓璧峰伐浣滐紝搴斿皾璇曚娇鐢∣LEDB椹卞姩绋嬪簭銆

姝e父鎯呭喌涓嬶紝鍦╓indows鏈哄櫒涓婁粎闇瀹夎MyODBC銆備粎褰撲綘鎷ユ湁杩愯鍦║nix鏈哄櫒涓婄殑绋嬪簭锛堝ColdFusion锛夛紝鑰屼笖璇ョ▼搴忓皢浣跨敤ODBC鏉ヨ闂暟鎹簱鏃讹紝鎵嶉渶瀹夎鐢ㄤ簬Unix鐨凪yODBC銆

濡傛灉浣犳墦绠楀湪Unix鏈哄櫒涓婂畨瑁匨yODBC锛岃繕闇瑕1涓狾DBC绠$悊鍣ㄣ侻yODBC鑳藉涓庡ぇ澶氭暟Unix ODBC绠$悊鍣ㄤ竴璧峰伐浣溿

         瑕佹兂浣跨敤ODBC搴旂敤绋嬪簭锛堜笉鏀寔MySQL鐨勫簲鐢ㄧ▼搴忥級锛屽缓绔嬩粠Windows骞冲彴鍒癠nix骞冲彴鐨勮繛鎺ワ紝棣栧厛蹇呴』鍦╓indows鏈哄櫒涓婂畨瑁匨yODBC銆

         鐢ㄦ埛鍜學indows鏈哄櫒蹇呴』鍏锋湁璁块棶浣嶄簬Unix鏈哄櫒涓婄殑MySQL鏈嶅姟鍣ㄧ殑鏉冮檺銆傝繖鍙氳繃GRANT鍛戒护璁剧疆銆傝鍙傝13.5.1.3鑺傦紝鈥淕RANT鍜孯EVOKE璇硶鈥

         蹇呴』鍒涘缓ODBC DSN鏉$洰锛屾柟寮忓涓嬶細

1.    鎵撳紑Windows鏈哄櫒涓婄殑鎺у埗闈㈡澘銆

2.    鍙屽嚮ODBC鏁版嵁婧32浣嶅浘鏍囥

3.    鐐瑰嚮閫夐」鍗♀滅敤鎴稤SN鈥濄

4.    鐐瑰嚮鈥滄坊鍔犫濇寜閽

5.    鍦ㄢ滃垱寤烘柊鏁版嵁婧愨濆睆骞曚笂閫夋嫨MySQL锛屽苟鐐瑰嚮鈥滃畬鎴愨濇寜閽

6.    鏄剧ずMySQL椹卞姩绋嬪簭鐨勯粯璁ら厤缃睆骞曘傝鍙傝26.1.9.2鑺傦紝鈥滃湪Windows涓婇厤缃甅yODBC DSN鈥

         鍚姩搴旂敤绋嬪簭锛屽苟浣跨敤鍦∣DBC绠$悊鍣ㄤ腑鎸囧畾鐨凞SN閫夋嫨ODBC椹卞姩绋嬪簭銆

娉ㄦ剰锛屽湪MySQL灞忓箷涓婅繕鏄剧ず浜嗗叾浠栭夐」锛屽鏋滈亣鍒伴棶棰橈紝鍙皾璇曡繖浜涢夐」锛堝璺熻釜銆佽繛鎺ユ椂涓嶆彁绀虹瓑锛夈

26.1.4. 鍦╓indows骞冲彴涓婁粠浜岃繘鍒剁増鏈畨瑁匨yODBC

瑕佹兂鍦╓indows骞冲彴涓婂畨瑁匨yODBC锛屽簲浠庝笅杩扮珯鐐逛笅杞芥伆褰撶殑鍒嗗彂鏂囦欢锛http://dev.mysql.com/downloads/connector/odbc/锛岃В鍘嬭鏂囦欢锛屽苟鎵цMyODBC-VERSION.exe鏂囦欢銆

鍦╓indows骞冲彴涓婏紝瀹夎杈冩棫鐨凪yODBC 2.50椹卞姩鏃讹紝鍙兘浼氶亣鍒颁笅杩伴敊璇細

鎷疯礉C:\WINDOWS\SYSTEM\MFC30.DLL鏃跺嚭鐜伴敊璇

 
閲嶅惎Windows锛屽苟鍐嶆瀹夎锛堝湪杩愯浠讳綍浣跨敤ODBC鐨勫簲鐢ㄧ▼搴忎箣鍓嶏級銆

闂鍦ㄤ簬鍏朵粬绋嬪簭姝d娇鐢∣DBC銆傜敱浜嶹indows鐨勮璁℃柟寮忥紝鍦ㄨ繖绉嶆儏鍐典笅锛屼綘鍙兘鏃犳硶浣跨敤Microsoft鐨凮DBC璁剧疆绋嬪簭瀹夎鏂扮殑ODBC椹卞姩銆傚湪澶у鏁版儏鍐典笅锛屽彲浠ラ氳繃杩炵画鎸夆滃拷鐣モ濋敭鎷疯礉鍓╀綑鐨凪yODBC鏂囦欢锛屾渶缁堝畨瑁呭簲浠嶈兘宸ヤ綔銆傚涓嶇劧锛岃В鍐虫柟妗堟槸鍦ㄢ滃畨鍏ㄦā寮忊濅笅閲嶆柊鍚姩璁$畻鏈恒傚湪閲嶅惎鐨勮繃绋嬩腑锛屽湪鏈哄櫒鍚姩Windows鍓嶆寜F8锛岄夋嫨鈥滃畨鍏ㄦā寮忊濓紝瀹夎MyODBC锛岀劧鍚庡湪姝e父妯″紡涓嬮噸鏂板惎鍔ㄨ绠楁満銆

26.1.5. I鍦║nix骞冲彴涓婁粠浜岃繘鍒剁増鏈畨瑁匨yODBC

26.1.5.1. 浠嶳PM鍒嗗彂鐗堝畨瑁匨yODBC

瑕佹兂浣跨敤RPM鍒嗗彂鐗堝湪Linux骞冲彴涓婂畨瑁呮垨鍗囩骇MyODBC锛屽彲绠鍗曞湴涓嬭浇鏈鏂癕yODBC鐨凴PM鍒嗗彂鐗堬紝骞舵寜鐓т笅闈粙缁嶇殑鏂瑰紡鎿嶄綔銆備娇鐢su root鎴愪负鏍圭敤鎴凤紝鐒跺悗瀹夎RPM鏂囦欢銆

濡傛灉鏄娆″畨瑁咃細

shell> su root
shell> rpm -ivh MyODBC-3.51.01.i386-1.rpm

濡傛灉椹卞姩绋嬪簭宸插瓨鍦紝鍙寜鐓т笅杩版柟寮忓崌绾у畠锛

shell> su root
shell> rpm -Uvh MyODBC-3.51.01.i386-1.rpm

濡傛灉瀛樺湪鍏充簬MySQL瀹㈡埛绔簱libmysqlclient鐨勪换浣曚緷瀛橀敊璇紝鍙娇鐢-nodeps閫夐」绠鍗曞湴蹇界暐瀹冿紝鐒跺悗纭繚MySQL瀹㈡埛绔叡浜簱浣嶄簬璺緞涓垨閫氳繃LD_LIBRARY_PATH杩涜浜嗚缃

杩欐牱锛屽氨浼氬皢椹卞姩绋嬪簭搴撳拰鐩稿叧鏂囦欢鍒嗗埆瀹夎鍒/usr/local/lib/usr/share/doc/MyODBC鐩綍涓嬨傝杞嚦26.1.9.3鑺傦紝鈥滃湪Unix骞冲彴涓婇厤缃甅yODBC DSN鈥

瑕佹兂鍗歌浇椹卞姩绋嬪簭锛岃棣栧厛鎴愪负鏍圭敤鎴凤紝鐒跺悗鎵цrpm鍛戒护锛

shell> su root
shell> rpm -e MyODBC

26.1.5.2. 浠庝簩杩涘埗Tarball鍒嗗彂鐗堝畨瑁匨yODBC

瑕佹兂浠巘arball鍒嗗彂鐗堬紙.tar.gz鏂囦欢锛夊畨瑁呴┍鍔ㄧ▼搴忥紝璇蜂笅杞介拡瀵逛綘鎵浣跨敤鎿嶄綔绯荤粺鐨勬渶鏂扮増椹卞姩绋嬪簭锛岀劧鍚庢寜鐓т笅杩版楠ゆ搷浣滐細

shell> su root
shell> gunzip MyODBC-3.51.01-i686-pc-linux.tar.gz
shell> tar xvf MyODBC-3.51.01-i686-pc-linux.tar
shell> cd MyODBC-3.51.01-i686-pc-linux

璇烽槄璇INSTALL-BINARY鏂囦欢涓殑瀹夎璇存槑锛屽苟鎵ц涓嬭堪鍛戒护锛

shell> cp libmyodbc* /usr/local/lib
shell> cp odbc.ini /usr/local/etc
shell> export ODBCINI=/usr/local/etc/odbc.ini

鐒跺悗锛岃璺宠嚦26.1.9.3鑺傦紝鈥滃湪Unix骞冲彴涓婇厤缃甅yODBC DSN鈥涓篗yODBC閰嶇疆DSN銆傛洿澶氫俊鎭紝璇峰弬瑙佷笌鍙戝竷鐗堜竴璧锋彁渚涚殑INSTALL-BINARY鏂囦欢銆

26.1.6. 鍦╓indows骞冲彴涓婁粠婧愮爜鐗堟湰瀹夎MyODBC

26.1.6.1. 瑕佹眰

         MDAC, Microsoft Data Access SDK锛http://www.microsoft.com/data/

         MySQL瀹㈡埛绔簱浠ュ強MySQL 4.0.0鎴栨洿楂樼増鏈殑鍖呭惈鏂囦欢銆傦紙鏈濂芥槸MySQL 4.0.16鎴栨洿楂樼増鏈級銆傚簲婊¤冻涓婅堪瑕佹眰锛岃繖鏄洜涓篗yODBC闇瑕佺敤鍒拌鐗堟湰浠ヤ笂鐨勫簱鎵嶆彁渚涚殑鏂拌皟鐢ㄥ拰缁撴瀯銆傝鎯宠幏寰楀鎴风搴撳拰鍖呭惈鏂囦欢锛岃璁块棶http://dev.mysql.com/downloads/

26.1.6.2. 鏋勫缓MyODBC 3.51

MyODBC 3.51婧愮爜鍒嗗彂鐗堝寘鎷娇鐢nmakeMakefiles銆傚湪鍒嗗彂鐗堜腑锛屼綘鍙互鎵惧埌鐢ㄤ簬鍒涘缓鍙戝竷鐗堢殑Makefile锛屼互鍙婄敤浜庡垱寤洪┍鍔ㄥ簱鍜孌LL璋冭瘯鐗堢殑Makefile_debug

瑕佹兂鍒涘缓椹卞姩绋嬪簭锛岃閲囧彇涓嬭堪姝ラ锛

1.    涓嬭浇骞跺皢婧愮爜灞曞紑鍒版枃浠跺す锛岀劧鍚庡皢浣嶇疆鍒囨崲鍒拌鏂囦欢澶广傚湪涓嬭堪鍛戒护涓紝鍋囧畾鏂囦欢澶逛负myodbc3-src锛

2.           C:\> cd myodbc3-src

3.    缂栬緫Makefile锛屼负MySQL瀹㈡埛绔簱鍜屽ご鏂囦欢鎸囧畾姝g‘鐨勮矾寰勩傜劧鍚庝娇鐢ㄤ笅杩板懡浠ゅ垱寤哄苟瀹夎鍙戝竷鐗堛

4.           C:\> nmake -f Makefile
5.           C:\> nmake -f Makefile install

nmake -f Makefile鐢ㄤ簬鍒涘缓椹卞姩绋嬪簭鐨勫彂甯冪増骞跺皢浜岃繘鍒剁爜鏀惧叆鍚嶄负Release鐨勫瓙鐩綍涓嬨

nmake -f Makefile install鐢ㄤ簬灏嗛┍鍔ㄧ▼搴廌LL鍜屽簱锛myodbc3.dll, myodbc3.lib锛夊畨瑁咃紙鎷疯礉锛夊埌绯荤粺鐩綍涓嬨

6.    瑕佹兂鍒涘缓璋冭瘯鐗堬紝璇蜂娇鐢Makefile_Debug鑰屼笉鏄疢akefile锛屽涓嬫墍绀猴細

7.           C:\> nmake -f Makefile_debug
8.           C:\> nmake -f Makefile_debug install

9.    浣跨敤涓嬭堪鍛戒护锛屽彲娓呴櫎骞堕噸鏂板垱寤洪┍鍔ㄧ▼搴忥細

10.       C:\> nmake -f Makefile clean
11.       C:\> nmake -f Makefile install

娉ㄩ噴锛

         纭繚鍦∕akefiles涓寚瀹氫簡姝g‘鐨凪ySQL瀹㈡埛绔簱鍜屽ご鏂囦欢璺緞锛堣缃MYSQL_LIB_PATHMYSQL_INCLUDE_PATH鍙橀噺锛夈傞粯璁ょ殑澶存枃浠惰矾寰勬槸C:\mysql\include銆傚浜庡彂甯冪増DLL锛岄粯璁ょ殑搴撹矾寰勬槸C:\mysql\lib\opt锛屽浜庤皟璇曠増锛岄粯璁よ矾寰勬槸C:\mysql\lib\debug銆

         鍏充簬nmake鐨勫畬鏁寸敤娉曪紝璇峰弬瑙http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vcce4/html/evgrfRunningNMAKE.asp

         濡傛灉浣犳鍦ㄤ娇鐢˙itKeeper鏍戞潵杩涜缂栬瘧锛屾墍鏈夌殑閽堝Windows鐨Makefiles鍧囧皢琚懡鍚嶄负Win_Makefile*

26.1.6.3. 娴嬭瘯

灏嗛┍鍔ㄧ▼搴忓簱鎷疯礉锛忓畨瑁呭埌绯荤粺鐩綍鍚庯紝鍙娇鐢ㄧず渚嬪瓙鐩綍涓嬫彁渚涚殑绀轰緥娴嬭瘯杩欎簺搴撴槸鍚﹀凡姝g‘鍒涘缓锛
C:\> cd samples
C:\> nmake -f Makefile all

26.1.6.4. 鏋勫缓MyODBC 2.50

MyODBC 2.50婧愮爜鍒嗗彂鐗堝寘鍚玍C宸ヤ綔绌洪棿鏂囦欢銆傞氳繃鍦∕icrosoft Visual Studio 6.0涓姞杞借繖浜涙枃浠讹紙.dsp.dsw锛夛紝鍙娇鐢ㄥ畠浠洿鎺ュ垱寤洪┍鍔ㄧ▼搴忋

26.1.7. 鍦║nix骞冲彴涓婁粠婧愮爜鐗堟湰瀹夎MyODBC

26.1.7.1. 瑕佹眰

         MySQL瀹㈡埛绔簱浠ュ強MySQL 4.0.0鎴栨洿楂樼増鏈殑鍖呭惈鏂囦欢銆傦紙鏈濂芥槸MySQL 4.0.16鎴栨洿楂樼増鏈級銆傚簲婊¤冻涓婅堪瑕佹眰锛岃繖鏄洜涓篗yODBC闇瑕佺敤鍒拌鐗堟湰浠ヤ笂鐨勫簱鎵嶆彁渚涚殑鏂拌皟鐢ㄥ拰缁撴瀯銆傝鎯宠幏寰楀鎴风搴撳拰鍖呭惈鏂囦欢锛岃璁块棶http://dev.mysql.com/downloads/

         蹇呴』浣跨敤鈥--enable-thread-safe-client鈥濋夐」閰嶇疆MySQL搴撱侺ibmysqlclient鏄綔涓哄叡浜簱瀹夎鐨勩

         蹇呴』瀹夎涓嬭堪Unix ODBC椹卞姩绠$悊鍣ㄤ箣涓锛

o        iodbc 3.0鎴栨洿楂樼増鏈紙http://www.iodbc.org

o        unixodbc Alpha 3鎴栨洿楂樼増鏈紙http://www.unixodbc.org

         濡傛灉浣跨敤浜嗘湭缂栬瘧鍦∕ySQL瀹㈡埛绔簱涓殑瀛楃闆嗭紙榛樿瀛楃闆嗕负锛 latin1 big5 czech euc_kr gb2312 gbk sjis tis620 ujis锛夛紝灏遍渶瑕佷粠瀛楃闆嗙洰褰曚笅灏唌ysql瀛楃瀹氫箟瀹夎鍒SHAREDIR涓紙榛樿鎯呭喌涓嬩綅浜/usr/local/mysql/share/mysql/charsets锛夈傚鏋滃湪鐩稿悓鏈哄櫒涓婂畨瑁呬簡MySQL锛屽畠浠簲浣嶄簬鎭板綋浣嶇疆銆

涓鏃﹀畬鎴愪簡鎵鏈夋墍闇鏂囦欢鐨勫畨瑁咃紝灏嗘簮鐮佹枃浠惰В鍖呭埌鍗曠嫭鐩綍涓嬶紝骞舵寜鐓т笅闈㈢粰鍑虹殑璇存槑杩涜鎿嶄綔銆

26.1.7.2. 鍏稿瀷閰嶇疆閫夐」

浣跨敤configure鑴氭湰锛岃兘澶熷浣犳墍鍒涘缓MyODBC鐨勯厤缃柟寮忚繘琛屽绉嶆帶鍒躲傚吀鍨嬫儏鍐典笅锛屽彲鍦ㄢconfigure鈥濆懡浠よ浣跨敤閫夐」瀹屾垚璇ラ厤缃搷浣溿備篃鍙互浣跨敤鐜鍙橀噺鏉ュ奖鍝嶉厤缃傝鎯充簡瑙bconfigure鈥濆懡浠ゆ敮鎸佺殑閫夐」鍒楄〃鍜岀幆澧冨彉閲忥紝鍙繍琛屼笅杩板懡浠わ細
shell> ./configure --help

涓嬮潰浠嬬粛浜嗕竴浜涘父鐢ㄧ殑鈥configure鈥濋夐」銆

1.    瑕佹兂缂栬瘧MyODBC锛岄』浣跨敤鈥--with-mysql-path=DIR鈥濋夐」鏉ユ彁渚汳ySQL瀹㈡埛绔簱鏂囦欢鍜屽寘鍚枃浠惰矾寰勶紝鍏朵腑锛屸DIR鈥濇槸MySQL鐨勫畨瑁呯洰褰曘

鍙氳繃杩愯鈥DIR/bin/mysql_config鈥濇潵纭畾MySQL缂栬瘧閫夐」銆

2.    涓篛DBC椹卞姩绠$悊鍣紙iodbcunixobc锛夋彁渚涙爣鍑嗙殑澶存枃浠跺拰搴撴枃浠惰矾寰勩

         濡傛灉浣犳鍦ㄤ娇鐢iodbc锛岃屼笖iodbc鏈畨瑁呭湪鍏堕粯璁や綅缃/usr/local锛夛紝鍙兘闇瑕佷娇鐢--with-iodbc=DIR鈥濋夐」锛屽叾涓紝鈥DIR鈥濇槸iodbc鐨勫畨瑁呯洰褰曘

濡傛灉iodbc澶存枃浠舵湭浣嶄簬DIR/include鐩綍涓嬶紝鍙娇鐢--with-iodbc-includes=INCDIR閫夐」鎸囧畾瀹冧滑鐨勪綅缃

涓婇潰鎵杩颁篃閫傜敤浜庡簱鏂囦欢銆傚鏋滃簱鏂囦欢鏈綅浜DIR/lib鐩綍涓嬶紝鍙娇鐢ㄢ--with-iodbc-libs=LIBDIR鈥濋夐」銆

         濡傛灉浣犳鍦ㄤ娇鐢unixODBC锛屽彲浣跨敤--with-unixODBC=DIR鈥濋夐」锛堝尯鍒嗗ぇ灏忓啓锛夛紝璁configure瀵绘壘unixODBC鑰屼笉鏄粯璁ょ殑iodbc锛屽叾涓紝鈥DIR鈥濇槸unixODBC鐨勫畨瑁呯洰褰曘

濡傛灉unixODBC澶存枃浠跺拰搴撴枃浠舵湭浣嶄簬鐩綍DIR/includeDIR/lib涓嬶紝鍙娇鐢--with-unixODBC-includes=INCDIR鈥濆拰鈥--with-unixODBC-libs=LIBDIR鈥濋夐」銆

3.    鎴栬浣犱篃甯屾湜鎸囧畾涓嶅悓浜庘/usr/local鈥濈殑瀹夎鍓嶇紑銆備緥濡傦紝瑕佹兂灏哅yODBC椹卞姩瀹夎鍒扳/usr/local/odbc/lib鈥濈洰褰曚笅锛屽彲浣跨敤鈥--prefix=/usr/local/odbc鈥濋夐」銆

鏈缁堢殑閰嶇疆鍛戒护搴斾笌涓嬮潰缁欏嚭鐨勭浉浼硷細

shell> ./configure --prefix=/usr/local \
         --with-iodbc=/usr/local \
         --with-mysql-path=/usr/local/mysql

26.1.7.3. 绾跨▼瀹夊叏瀹㈡埛绔

涓轰簡灏嗛┍鍔ㄧ▼搴忎笌MySQL绾跨▼瀹夊叏瀹㈡埛绔簱libmysqlclient_r.solibmysqlclient_r.a閾炬帴璧锋潵锛屽繀椤绘寚瀹氫笅杩configure閫夐」锛
--enable-thread-safe

涔熷彲浠ヤ娇鐢ㄤ笅杩伴夐」绂佹瀹冿細

--disable-thread-safe

浣跨敤璇ラ夐」锛岃兘澶熼氳繃mysql绾跨▼瀹夊叏瀹㈡埛绔簱libmysqlclient_r.so锛堟墿灞曞悕涓庢搷浣滅郴缁熸湁鍏筹級鐨勯摼鎺ワ紝鍒涘缓椹卞姩绋嬪簭绾跨▼瀹夊叏搴搇ibmyodbc3_r.so銆

鍦ㄩ厤缃嚎绋嬪畨鍏ㄩ夐」鏃讹紝濡傛灉鍑虹幇浜嗛厤缃敊璇紝搴旀鏌config.log锛屾鏌ラ敊璇槸鍚︽槸鍥犵郴缁熶腑缂哄皯绾跨▼搴撹屽鑷寸殑锛屽鏋滄槸锛屼娇鐢↙IBS閫夐」鎻愪緵涓涓紝鍗

LIBS="-lpthread" ./configure ..

26.1.7.4. 鍏变韩鎴栭潤鎬侀夐」

鍙互浣跨敤涓嬭堪閫夐」鍚敤鎴栫姝㈠叡浜拰闈欐侀夐」锛

--enable-shared[=yes/no]
--disable-shared
--enable-static[=yes/no]
--disable-static

26.1.7.5. 鍚敤璋冭瘯淇℃伅

榛樿鎯呭喌涓嬶紝鎵鏈夌殑浜岃繘鍒跺垎鍙戠増鍧囦細琚垱寤轰负闈炶皟璇曠増锛堥噰鐢ㄢ--without-debug鈥濊繘琛岄厤缃級銆

瑕佹兂鍚敤璋冭瘯淇℃伅锛岃浣跨敤婧愮爜鍒嗗彂鐗堝垱寤洪┍鍔ㄧ▼搴忥紝骞跺湪杩愯鈥configure鈥濇椂浣跨敤鈥--with-debug閫夐」

26.1.7.6. 鍏佽鏂囨。鍔熻兘

璇ラ夐」浠呰兘鐢ㄤ簬BK鍏嬮殕鏍戯紝鑰屼笉鏄竴鑸殑婧愮爜鍒嗗彂鐗堛

榛樿鎯呭喌涓嬶紝椹卞姩绋嬪簭鏄娇鐢ㄢ--without-docs鍒涘缓鐨勩傚鏋甯屾湜鍦ㄦ甯稿垱寤鸿繃绋嬩腑瑙傚療鏂囨。淇℃伅锛屽彲浣跨敤涓嬭堪閫夐」杩涜閰嶇疆锛

--with-docs

26.1.7.7. 鍒涘缓鍜岀紪璇

瑕佹兂鍒涘缓椹卞姩绋嬪簭搴擄紝浠呴渶鎵ц鈥make鈥濓紝璇ュ懡浠よ兘瀹屾垚鎵鏈変簨椤广
shell> make

濡傛灉鍑虹幇閿欒锛屾洿姝e悗锛岀户缁墽琛屽垱寤鸿繘绋嬨傚鏋滄棤娉曞垱寤猴紝璇峰彂閫佽缁嗙殑鐢靛瓙閭欢鑷myodbc@lists.mysql.com锛屼互鑾峰彇杩涗竴姝ュ府鍔┿

26.1.7.8. 鍒涘缓鍏变韩搴

鍦ㄥぇ澶氭暟骞冲彴涓婏紝榛樿鎯呭喌涓嬶紝MySQL涓嶄細鍒涘缓鎴栨敮鎸佲.so锛堝叡浜級瀹㈡埛绔簱锛岃繖鏄洜涓猴紝鍒涘缓鍏变韩搴撳湪杩囧幓閫犳垚杩囧緢澶氶棶棰樸

鍦ㄨ繖绉嶆儏鍐典笅锛屼綘鍙互涓嬭浇MySQL鍒嗗彂鐗堬紝骞朵娇鐢ㄤ互涓嬮夐」杩涜閰嶇疆锛

--without-server --enable-shared

瑕佹兂鍒涘缓鍏变韩椹卞姩绋嬪簭搴擄紝蹇呴』涓衡configure鈥濇寚瀹氣--enable-shared閫夐」銆榛樿鎯呭喌涓嬶紝鈥configure鈥濅笉鍚敤璇ラ夐」銆

濡傛灉浣跨敤鈥--disable-shared鈥濋夐」杩涜浜嗛厤缃搷浣滐紝鍙娇鐢ㄤ笅杩板懡浠わ紝浠庨潤鎬佸簱鍒涘缓鈥.so鈥濇枃浠躲

shell> cd MyODBC-3.51.01
shell> make
shell> cd driver
shell> CC=/usr/bin/gcc \
     $CC -bundle -flat_namespace -undefined error \
         -o .libs/libmyodbc3-3.51.01.so \
         catalog.o connect.o cursor.o dll.o error.o execute.o \
         handle.o info.o misc.o myodbc3.o options.o prepare.o \
         results.o transact.o utility.o \
         -L/usr/local/mysql/lib/mysql/ \
         -L/usr/local/iodbc/lib/ \
         -lz -lc -lmysqlclient -liodbcinst

濡傛灉浣犳鍦ㄤ娇鐢╱nixODBC鑰屼笉鏄痠ODBC锛屽姟蹇呭皢鈥-liodbcinst鏇存敼涓-lodbcinst锛屽苟鐩稿簲鍦伴厤缃簱璺緞銆

杩欐牱锛屽氨鍒涘缓浜libmyodbc3-3.51.01.so鏂囦欢锛屽苟灏嗗叾鏀惧湪.libs鐩綍涓嬨灏嗚鏂囦欢鎷疯礉鍒癕yODBC搴撶洰褰曚笅锛/usr/local/lib锛屾垨浣跨敤--prefix鎻愪緵鐨勫畨瑁呯洰褰曚笅鐨lib鐩綍锛夈

shell> cd .libs
shell> cp libmyodbc3-3.51.01.so /usr/local/lib
shell> cd /usr/local/lib
shell> ln -s libmyodbc3-3.51.01.so libmyodbc3.so

瑕佹兂鍒涘缓绾跨▼瀹夊叏椹卞姩绋嬪簭搴擄細

shell> CC=/usr/bin/gcc \
     $CC -bundle -flat_namespace -undefined error
      -o .libs/libmyodbc3_r-3.51.01.so
      catalog.o connect.o cursor.o dll.o error.o execute.o
      handle.o info.o misc.o myodbc3.o options.o prepare.o
      results.o transact.o utility.o
      -L/usr/local/mysql/lib/mysql/
      -L/usr/local/iodbc/lib/
      -lz -lc -lmysqlclient_r -liodbcinst

26.1.7.9. 瀹夎椹卞姩搴

瑕佹兂瀹夎椹卞姩绋嬪簭搴擄紝璇锋墽琛屼笅杩板懡浠わ細
shell> make install

璇ュ懡浠ゅ皢瀹夎涓嬭堪搴撻泦鍚堜箣涓锛

瀵逛簬MyODBC 3.51锛

         libmyodbc3.so

         libmyodbc3-3.51.01.so锛屽叾涓紝3.51.01鏄┍鍔ㄧ▼搴忕殑鐗堟湰

         libmyodbc3.a

瀵逛簬绾跨▼瀹夊叏MyODBC 3.51锛

         libmyodbc3_r.so

         libmyodbc3-3_r.51.01.so

         libmyodbc3_r.a

瀵逛簬MyODBC 2.5.0锛

         libmyodbc.so

         libmyodbc-2.50.39.so锛屽叾涓紝2.50.39鏄┍鍔ㄧ▼搴忕殑鐗堟湰

         libmyodbc.a

鍏充簬鍒涘缓杩涚▼鐨勬洿澶氫俊鎭紝璇峰弬闃呬笌婧愮爜鍒嗗彂鐗堜竴璧锋彁渚涚殑INSTALL鏂囦欢銆娉ㄦ剰锛屽鏋滀綘璇曞浘浣跨敤Sun鐨勨渕ake鈥濓紝鍙兘浼氫互閿欒缁撴潫銆備粠鍙︿竴鏂归潰鏉ヨ锛孏NU gmake鍦ㄦ墍鏈夊钩鍙颁笂鍧囪兘鑹ソ宸ヤ綔銆

26.1.7.10.聽鍦║nix骞冲彴涓婃祴璇昅yODBC

瑕佹兂涓庝綘鍒涘缓鐨勫簱涓璧疯繍琛屽垎鍙戠増涓彁渚涚殑绀轰緥锛屽彲鎵ц锛
shell> make test

棣栧厛锛屽姟蹇呭湪odbc.ini涓厤缃DSN 'myodbc3'锛屽苟灏嗙幆澧冨彉閲ODBCINI鎸囧悜姝g‘鐨刼dbc.ini鏂囦欢锛涘悓鏃MySQL鏈嶅姟鍣ㄥ簲澶勪簬杩愯鐘舵併傚湪椹卞姩鍒嗗彂鐗堜腑锛屽彲鎵惧埌涓涓ず渚嬬敤odbc.ini鏂囦欢銆

浣犵敋鑷冲彲浠ユ洿鏀圭ず渚/杩愯绀轰緥鑴氭湰锛屼互鍛戒护琛屽弬鏁扮殑褰㈠紡灏嗘墍闇鐨凞SN銆乁ID鍜孭ASSWORD鍊间紶閫掔粰绀轰緥銆

26.1.7.11. Mac OS X娉ㄦ剰浜嬮」

瑕佹兂鍦∕ac OS X (Darwin)鐜涓嬪垱寤洪┍鍔ㄧ▼搴忥紝鍙娇鐢ㄤ笅杩configure绀轰緥锛
shell> ./configure --prefix=/usr/local
           --with-unixODBC=/usr/local
           --with-mysql-path=/usr/local/mysql
           --disable-shared
           --enable-gui=no
           --host=powerpc-apple

璇ュ懡浠ゅ亣瀹歶nixODBC鍜孧ySQL鍧囧畨瑁呭湪榛樿浣嶇疆銆傚涓嶇劧锛岃杩涜鐩稿簲閰嶇疆銆

鍦 Mac OS X鐜涓嬶紝鈥--enable-shared閫夐」灏嗛粯璁ゅ垱寤.dylib鏂囦欢銆浣犱篃鍙互閲囩敤涓嬭堪鏂瑰紡鍒涘缓鈥.so鈥濇枃浠讹細

shell> make
shell> cd driver
shell> CC=/usr/bin/gcc \
     $CC -bundle -flat_namespace -undefined error
         -o .libs/libmyodbc3-3.51.01.so *.o
         -L/usr/local/mysql/lib/
         -L/usr/local/iodbc/lib
         -liodbcinst -lmysqlclient -lz -lc

瑕佹兂鍒涘缓绾跨▼瀹夊叏椹卞姩绋嬪簭搴擄細

shell> CC=/usr/bin/gcc \
     $CC -bundle -flat_namespace -undefined error
     -o .libs/libmyodbc3-3.51.01.so *.o
     -L/usr/local/mysql/lib/
     -L/usr/local/iodbc/lib
     -liodbcinst -lmysqlclienti_r -lz -lc -lpthread

濡傛灉浣犳鍦ㄤ娇鐢╱nixODBC鑰屼笉鏄痠ODBC锛屽姟蹇呭皢鈥-liodbcinst鏇存敼涓-lodbcinst锛屽苟鐩稿簲鍦伴厤缃簱璺緞銆

鍦ˋpple鐨凣CC鐗堟湰涓紝ccgcc瀹為檯涓婂潎鏄gcc3鐨勭鍙烽摼鎺ャ

灏嗚搴撴嫹璐濆埌$prefix/lib鐩綍涓嬶紝骞跺皢symlink鎷疯礉鍒libmyodbc3.so

鍙互浣跨敤涓嬭堪鍛戒护浜ゅ弶妫楠岃緭鍑虹殑鍏变韩搴撳睘鎬э細

shell> otool -LD .libs/libmyodbc3-3.51.01.so

26.1.7.12. HP-UX娉ㄦ剰浜嬮」

瑕佹兂鍦℉P-UX 10.x鎴11.x鐜涓嬪垱寤洪┍鍔ㄧ▼搴忥紝鍙娇鐢ㄤ笅杩configure绀轰緥锛

濡傛灉浣跨敤cc

shell> CC="cc" \
     CFLAGS="+z" \
     LDFLAGS="-Wl,+b:-Wl,+s" \
     ./configure --prefix=/usr/local
           --with-unixodbc=/usr/local
           --with-mysql-path=/usr/local/mysql/lib/mysql
           --enable-shared
           --enable-thread-safe

濡傛灉浣跨敤gcc

shell> CC="gcc" \
     LDFLAGS="-Wl,+b:-Wl,+s" \
     ./configure --prefix=/usr/local
           --with-unixodbc=/usr/local
           --with-mysql-path=/usr/local/mysql
           --enable-shared
           --enable-thread-safe

涓鏃﹀垱寤轰簡椹卞姩绋嬪簭锛屼娇鐢ㄢchatr .libs/libmyodbc3.sl鈥濅氦鍙夋鏌ュ叾灞炴э紝鏌ョ湅鏄惁闇瑕佷娇鐢SHLIB_PATH鐜鍙橀噺鐨凪ySQL瀹㈡埛绔簱銆瀵逛簬闈欐佺増锛屽拷鐣ユ墍鏈夌殑鍏变韩搴撻夐」锛屽苟浣跨敤鈥--disable-shared鈥濋夐」杩愯鈥configure鈥濄

26.1.7.13. AIX娉ㄦ剰浜嬮」

瑕佹兂鍦ˋIX鐜涓嬪垱寤洪┍鍔ㄧ▼搴忥紝鍙娇鐢ㄤ笅杩configure绀轰緥锛

shell> ./configure --prefix=/usr/local
           --with-unixodbc=/usr/local
           --with-mysql-path=/usr/local/mysql
           --disable-shared
           --enable-thread-safe
娉ㄩ噴锛 鍏充簬鍦ㄤ笉鍚屽钩鍙颁笂鍒涘缓鍜岃缃潤鎬佸拰鍏变韩搴撴柟寮忕殑鏇村淇℃伅锛岃鍙傝璺ㄥ钩鍙颁娇鐢ㄩ潤鎬佸拰鍏变韩搴

26.1.8. 浠嶣itKeeper寮鍙戞簮鐮佹爲瀹夎MyODBC

娉ㄩ噴锛 濡傛灉浣犲鍗忓姪鎴戜滑娴嬭瘯鏂扮殑浠g爜鎰熷叴瓒o紝搴旈槄璇绘湰鑺傜殑鍐呭銆

瑕佹兂鑾峰緱鎴戞柟鐨勬渶鏂板紑鍙戞簮鐮佹爲锛岃锛

1.    鍙傝2.8.3鑺傦紝鈥滀粠寮鍙戞簮鐮佹爲瀹夎鈥锛屽叧浜庡浣曚笅杞藉拰瀹夎BitKeeper鐨勮鏄庛

2.    瀹夎瀹孊itKeeper鍚庯紝棣栧厛杩涘叆鎵撶畻鍦ㄥ叾涓伐浣滅殑鐩綍锛岀劧鍚庯紝濡傛灉鎵撶畻鍏嬮殕MyODBC 3.51鍒嗘敮锛岃浣跨敤璇ュ懡浠わ細

3.           shell> bk clone bk://mysql.bkbits.net/myodbc3 myodbc-3.51

鍦ㄥ墠闈㈢殑绀轰緥涓紝婧愮爜鏍戞槸鍦myodbc-3.51/涓缃殑锛屾垨鍦ㄥ綋鍓嶇洰褰曠殑myodbc3/瀛愮洰褰曚笅璁剧疆鐨勶紙榛樿锛夈濡傛灉浣犱綅浜庨槻鐏鍚庯紝鑰屼笖浠呰兘鍚姩HTTP杩炴帴锛屼篃鍙互閫氳繃HTTP浣跨敤BitKeeper銆傚鏋滆姹備娇鐢ㄤ唬鐞嗘湇鍔″櫒锛屽彲绠鍗曞湴璁剧疆鐜鍙橀噺http_proxy锛屼娇涔嬫寚鍚戜唬鐞嗘湇鍔″櫒锛

shell> export http_proxy="http://your.proxy.server:8080/"

鎵ц鍏嬮殕鎿嶄綔鏃讹紝鐢http://鏇挎崲bk://銆渚嬪锛

shell> bk clone http://mysql.bkbits.net/myodbc3 myodbc-3.51

棣栨涓嬭浇婧愮爜鏍戞椂闇瑕佷竴娈垫椂闂达紝鍏蜂綋鎯呭喌鍙栧喅浜庤繛鎺ラ熷害锛岃鑰愬績绛夊欍

4.    瑕佹兂杩愯涓嬩竴缁勫懡浠わ紝闇瑕丟NU autoconf 2.52锛堟垨鏇存柊鐗堟湰锛automake 1.4libtool 1.4锛屼互鍙m4

5.           shell> cd myodbc-3.51
6.           shell> bk -r edit
7.           shell> aclocal; autoheader; autoconf;  automake;
8.           shell> ./configure  # Add your favorite options here
9.           shell> make

鍏充簬濡備綍鍒涘缓鐨勬洿澶氫俊鎭紝璇峰弬闃呬綅浜庣浉鍚岀洰褰曚笅鐨INSTALL鏂囦欢銆鍦╓indows骞冲彴涓嬶紝鍒涘缓椹卞姩绋嬪簭鏃讹紝璇蜂娇鐢╓indows Makefiles WIN-MakefileWIN-Makefile_debug锛屾洿澶氫俊鎭紝璇峰弬瑙26.1.6鑺傦紝鈥滃湪Windows骞冲彴涓婁粠婧愮爜鐗堟湰瀹夎MyODBC鈥

10.瀹屾垚鍒涘缓鍚庯紝杩愯make install锛屽皢MyODBC 3.51椹卞姩绋嬪簭瀹夎鍒颁綘鐨勭郴缁熶笂銆

11.濡傛灉杩涘叆浜make闃舵锛屼絾骞舵湭缂栬瘧鍒嗗彂鐗堟湰锛岃灏嗗叾閫氭姤缁myodbc@lists.mysql.com

12.鍚姩浜bk clone鎿嶄綔鑾峰緱婧愮爜鏍戝悗锛屽簲瀹氭湡杩愯bk pull杩涜鏇存柊銆

13.鍙互浣跨敤鈥bk sccstool鈥濇鏌ユ爲鐨勫彉鏇村彶銆傚鏋滀綘鍙戠幇浜嗘湁瓒g殑宸紓锛屽苟瀵逛唬鐮佸瓨鍦ㄤ竴闂紝璇风珛鍒诲彂閫佺數瀛愰偖浠惰嚦myodbc@lists.mysql.com

姝ゅ锛屽鏋滀綘璁や负鏈夋洿濂界殑涓绘剰锛岃鍙戦佺數瀛愰偖浠惰嚦鐩稿悓鐨勫湴鍧骞堕檮涓婅ˉ涓併傛洿鏀逛簡婧愮爜鍚庯紝浣跨敤鈥bk diffs鈥濆彲鐢熸垚琛ヤ竵銆傚鏋滀綘娌℃湁鏃堕棿灏变綘鐨勮鐐圭紪鍐欎唬鐮侊紝鍙彂閫佹弿杩版т俊鎭

14.BitKeeper鍏锋湁涓涓彲閫氳繃bk helptool璁块棶鐨勫府鍔╁伐鍏枫

閫氳繃娴忚http://mysql.bkbits.net:8080/myodbc3锛屼篃鑳藉湪绾挎祻瑙堝彉鍖栭泦銆佹敞閲婂拰婧愪唬鐮併

26.1.9. MyODBC閰嶇疆

鏈妭浠嬬粛浜嗛厤缃甅yODBC鐨勬柟娉曪紝鍖呮嫭DSN鍒涘缓锛屼互鍙婇┍鍔ㄧ▼搴忓湪杩炴帴瀛楃涓蹭腑浣滀负杈撳叆鍙傛暟鐨勪笉鍚屽弬鏁般傛澶栵紝杩樹粙缁嶄簡鍒涘缓ODBC璺熻釜鏂囦欢鐨勬柟娉曘

26.1.9.1. 浠涔堟槸鏁版嵁婧愬悕锛

鈥滄暟鎹簮鈥濇槸鎻愪緵鏁版嵁鐨勫湴鐐广傛暟鎹簮蹇呴』鏈夌ǔ瀹氱殑鏍囪瘑绗︼紝鍗虫暟鎹簮鍚嶃備娇鐢ㄦ暟鎹簮鍚嶏紝MySQL鍙闂垵濮嬪寲淇℃伅銆傞氳繃鍒濆鍖栦俊鎭紝MySQL鑳藉浜嗚В鍘诲摢閲岃闂暟鎹簱锛屼互鍙婂湪寮濮嬭闂椂浣跨敤浠涔堣缃

浜嬪疄涓婏紝鏁版嵁婧愬氨鏄暟鎹殑璺緞銆傚湪涓嶅悓鐨勬儏鍐典笅锛屽畠鍙兘鏈夌潃涓嶅悓鐨勫唴瀹癸紝浣嗘槸鍦ㄥ吀鍨嬫儏鍐典笅锛屽畠鎸囨槑浜嗘鍦ㄨ繍琛岀殑MySQL鏈嶅姟鍣紙渚嬪锛岄氳繃缃戠粶鍦板潃鎴栨湇鍔″櫒鍚嶏級锛岃繛鎺ユ椂璇ユ湇鍔″櫒鐨勯粯璁ゆ暟鎹簱锛屼互鍙婂繀瑕佺殑杩炴帴淇℃伅锛堝绔彛锛夈侻ySQL椹卞姩绋嬪簭锛堜互鍙奧indows绯荤粺涓婄殑ODBC椹卞姩绠$悊鍣級灏嗕娇鐢ㄦ暟鎹簮杩涜杩炴帴銆傚浜庤鐩殑锛屽悕涓篗icrosoft ODBC鏁版嵁婧愮鐞嗗櫒鐨勭鐞嗗伐鍏峰彲鑳藉崄鍒嗘湁鐢ㄣ

鏈変袱澶勫彲鑳戒繚瀛樺垵濮嬪寲淇℃伅鐨勪綅缃細 Windows娉ㄥ唽琛紙Windows绯荤粺锛夛紝鎴朌SN鏂囦欢锛堜换浣曠郴缁燂級銆

濡傛灉淇℃伅浣嶄簬Windows娉ㄥ唽琛ㄤ腑锛屽畠绉颁负鈥滄満鍣ㄦ暟鎹簮鈥濄傚畠鍙互鏄滅敤鎴锋暟鎹簮鈥濓紝鍦ㄨ繖绉嶆儏鍐典笅锛屽彧鏈変竴浣嶇敤鎴疯兘鐪嬪埌瀹冦傚畠涔熷彲浠ユ槸鈥滅郴缁熸暟鎹簮鈥濓紝鍦ㄨ繖绉嶆儏鍐典笅锛岃绠楁満涓婄殑鎵鏈夌敤鎴峰潎鑳借闂畠锛屽鏋滅敤鎴锋槸閫氳繃Microsoft Windows NT鏈嶅姟杩炴帴鍦ㄤ竴璧风殑璇濓紝涓庤璁$畻鏈虹浉杩炵殑鎵鏈夌敤鎴峰潎鑳借闂畠銆傝繍琛孫DBC鏁版嵁绠$悊绋嬪簭鏃讹紝鍙互閫夋嫨鏄惁浣跨敤鈥滅敤鎴封濇垨鈥滅郴缁熲濓紝瀹冧滑浣嶄簬涓嶅悓鐨勯夐」鍗′笂銆

濡傛灉淇℃伅浣嶄簬DSN鏂囦欢涓紝瀹冪О涓衡滄枃浠舵暟鎹簮鈥濄傝繖鏄竴绉嶆枃鏈枃浠躲傚叾浼樼偣鍦ㄤ簬锛 锛坅锛夊畠閫傚悎浜庝换浣曠被鍨嬬殑璁$畻鏈猴紝鑰屼笉浠呬粎鏄娇鐢╓indows鎿嶄綔绯荤粺鐨勮绠楁満锛涳紙b锛夊叾鍐呭鐨勬嫹璐濇垨浼犺緭鐩稿瀹规槗銆

26.1.9.2. 鍦╓indows涓婇厤缃甅yODBC DSN

瑕佹兂鍦╓indows骞冲彴涓婃坊鍔犲拰閰嶇疆鏂扮殑MyODBC鏁版嵁婧愶紝璇蜂娇鐢ODBC鏁版嵁婧愮鐞嗗櫒銆侽DBC绠$悊鍣ㄨ兘澶熸洿鏂版暟鎹簮杩炴帴淇℃伅銆娣诲姞浜嗘暟鎹簮鏃讹紝ODBC绠$悊鍣ㄨ兘澶熸洿鏂版敞鍐屼俊鎭

瑕佹兂浠庢帶鍒堕潰鏉挎墦寮ODBC绠$悊鍣細

1.    鐐瑰嚮鈥滃紑濮嬧濓紝灏嗘寚閽堟寚鍚戔滆缃濓紝鐒跺悗鐐瑰嚮鈥滄帶鍒堕潰鏉库濄

2.    鍦ㄨ繍琛孧icrosoft Windows 2000鎴栨洿鏂扮増鏈殑璁$畻鏈轰笂锛屽弻鍑烩滅鐞嗗伐鍏封濓紝鐒跺悗鍙屽嚮鈥滄暟鎹簮鈥濓紙ODBC锛夈傚湪杩愯鏃х増鏈琖indows鐨勮绠楁満涓婏紝鍙屽嚮32浣峅DBCODBC

ODBC Data Sources
              Icon

鎵撳紑ODBC鏁版嵁婧愮鐞嗗櫒瀵硅瘽妗嗭紝濡備笅鍥炬墍绀猴細

ODBC Data Source
              Administrator Dialog

鐐瑰嚮鈥滃府鍔┾濅互浜嗚ВODBC鏁版嵁婧愮鐞嗗櫒瀵硅瘽妗嗗悇閫夐」鍗$殑璇︾粏淇℃伅銆

瑕佹兂鍦╓indows骞冲彴涓婃坊鍔犳暟鎹簮锛

1.    鎵撳紑ODBC鏁版嵁婧愮鐞嗗櫒銆

2.    鍦∣DBC鏁版嵁婧愮鐞嗗櫒瀵硅瘽妗嗕腑锛岀偣鍑烩滄坊鍔犫濄傛墦寮鈥滃垱寤烘柊鏁版嵁婧愨濆璇濇銆

3.    閫夋嫨MySQL ODBC 3.51椹卞姩绋嬪簭锛岀劧鍚庣偣鍑瀹屾垚鎵撳紑鈥MySQL ODBC 3.51椹卞姩绋嬪簭-DSN閰嶇疆瀵硅瘽妗嗭紝濡備笅鍥炬墍绀猴細

MySQL ODBC DSN
              Configuration Dialog

4.    鍦ㄢ滄暟鎹簮鍚嶁濇涓紝杈撳叆鎵撶畻璁块棶鐨勬暟鎹簮鐨勫悕绉般傚畠鍙互鏄綘閫夋嫨鐨勪换浣曟湁鏁堝悕绉般

5.    鍦ㄢ滄弿杩扳濇涓紝杈撳叆DSn鎵闇鐨勬弿杩颁俊鎭

6.    鍦ㄢ滀富鏈衡濇垨鈥滄湇鍔″櫒鍚嶁濓紙鎴朓P锛夋涓紝杈撳叆鍑嗗璁块棶鐨凪ySQL鏈嶅姟鍣ㄤ富鏈虹殑鍚嶇О銆傞粯璁ゆ儏鍐典笅涓localhost锛堟湰鍦颁富鏈猴級銆

7.    鍦ㄢ滄暟鎹簱鍚嶁濇涓紝杈撳叆鍑嗗鐢ㄤ綔榛樿鏁版嵁搴撶殑MySQL鏁版嵁搴撳悕绉般

8.    鍦ㄢ滅敤鎴封濇涓紝杈撳叆浣犵殑MySQL鐢ㄦ埛鍚嶏紙鏁版嵁搴撶敤鎴稩D锛夈

9.    鍦ㄢ滃瘑鐮佲濇涓緭鍏ュ瘑鐮併

10.鍦ㄢ滅鍙b濇涓紝濡傛灉绔彛涓嶆槸榛樿绔彛锛岃緭鍏ョ鍙e彿銆

11.鍦ㄢ淪QL鍛戒护鈥濇涓紝鍙緭鍏ュ缓绔嬭繛鎺ュ悗鑷姩鎵ц鐨凷QL璇彞銆

鏈鍚庯紝瀵硅瘽妗嗕笌涓嬪浘鏄剧ず鐨勭被浼硷細

Filled-In MySQL ODBC DSN
              Configuration Dialog

鐐瑰嚮鈥淥K鈥濇坊鍔犺鏁版嵁婧愩

娉ㄩ噴锛 鐐瑰嚮鈥淥K鈥濆悗锛屽皢鎵撳紑鈥滄暟鎹簮鈥濆璇濇锛孫DBC绠$悊鍣ㄥ皢鏇存柊娉ㄥ唽淇℃伅銆傝繛鎺ュ埌璇ユ暟鎹簮鏃讹紝浣犳墍杈撳叆鐨勭敤鎴峰悕鍜岃繛鎺ュ瓧绗︿覆灏嗘垚涓鸿鏁版嵁婧愮殑榛樿杩炴帴鍊笺

浣犱篃鍙互浣跨敤鈥滄祴璇曟暟鎹簮鈥濇寜閽紝娴嬭瘯浣犵殑璁剧疆鏄惁閫傚悎浜庤繛鎺ュ埌鏈嶅姟鍣ㄣ傝鐗规т粎瀵筂yODBC 3.51椹卞姩绋嬪簭鏈夋晥銆傛垚鍔熷畬鎴愭祴璇曞悗锛屽皢鏄剧ず涓嬭堪绐楀彛锛

MyODBC Successful Connection
          Message

濡傛灉娴嬭瘯澶辫触锛屽皢鏄剧ず閿欒娑堟伅銆

MyODBC Failed Connection Message

DNS閰嶇疆瀵硅瘽妗嗕篃鏈変竴涓滈夐」鈥濇寜閽傚鏋滈夋嫨浜嗗畠锛屽皢鎵撳紑涓嬭堪閫夐」瀵硅瘽妗嗭紝鏄剧ず鎺у埗椹卞姩绋嬪簭鐨勮涓恒傚叧浜庤繖浜涢夐」鐨勫惈涔夛紝璇峰弬瑙26.1.9.4鑺傦紝鈥滆繛鎺ュ弬鏁扳

MyODBC Options Dialog

娉ㄩ噴锛 鍦ㄢ滈┍鍔ㄧ▼搴忚窡韪濋夐」涓嬪垪鍑虹殑閫夐」宸茶绂佹锛堢伆鑹诧級锛岄櫎闈炰綘浣跨敤鐨勬槸椹卞姩DLL鐨勮皟璇曠増鏈

瑕佹兂鍦╓indows骞冲彴涓婃洿鏀规暟鎹簮锛

1.    鎵撳紑ODBC鏁版嵁婧愮鐞嗗櫒銆傜偣鍑绘伆褰撶殑閫夐」鍗♀淒SN鈥濄

2.    閫夋嫨鎵撶畻鏇存敼鐨凪ySQL鏁版嵁婧愶紝鐒跺悗鐐瑰嚮鈥滈厤缃濄傛墦寮鈥MySQL ODBC 3.51椹卞姩绋嬪簭-DSN閰嶇疆瀵硅瘽妗嗐

3.    鏇存敼閫傜敤鐨勬暟鎹簮瀛楁锛岀劧鍚庣偣鍑烩淥K鈥濄

鏇存敼瀹岃瀵硅瘽妗嗕腑鐨勪俊鎭悗锛孫DBC绠$悊鍣ㄥ皢鏇存柊娉ㄥ唽淇℃伅銆

26.1.9.3. 鍦║nix骞冲彴涓婇厤缃甅yODBC DSN

Unix骞冲彴涓婏紝鍙互鐩存帴鍦╫dbc.ini鏂囦欢涓厤缃瓺SN鏉$洰銆杩欓噷缁欏嚭浜1涓吀鍨嬬殑odbc.ini鏂囦欢锛屽湪璇ユ枃浠朵腑锛屽垎鍒皢myodbc鍜宮yodbc3閰嶇疆涓MyODBC 2.50鍜孧yODBC 3.51鐨凞SN鍚嶇О锛

;
;  odbc.ini瀵筂yODBC鍜孧yODBC 3.51椹卞姩绋嬪簭鐨勯厤缃
;

[ODBC Data Sources]
myodbc      = MyODBC 2.50 Driver DSN
myodbc3     = MyODBC 3.51 Driver DSN

[myodbc]
Driver       = /usr/local/lib/libmyodbc.so
Description  = MyODBC 2.50 Driver DSN
SERVER       = localhost
PORT         =
USER         = root
Password     =
Database     = test
OPTION       = 3
SOCKET       =

[myodbc3]
Driver       = /usr/local/lib/libmyodbc3.so
Description  = MyODBC 3.51 Driver DSN
SERVER       = localhost
PORT         =
USER         = root
Password     =
Database     = test
OPTION       = 3
SOCKET       =

[Default]
Driver       = /usr/local/lib/libmyodbc3.so
Description  = MyODBC 3.51 Driver DSN
SERVER       = localhost
PORT         =
USER         = root
Password     =
Database     = test
OPTION       = 3
SOCKET       =

鍏充簬鍙彁渚涜繛鎺ュ弬鏁扮殑娓呭崟锛岃鍙傝26.1.9.4鑺傦紝鈥滆繛鎺ュ弬鏁扳

娉ㄩ噴锛 濡傛灉浣犳鍦ㄤ娇鐢╱nixODBC锛屽彲浣跨敤涓嬭堪宸ュ叿璁剧疆DSN锛

         ODBCConfig GUI tool(HOWTO: ODBCConfig)

         odbcinst

鍦ㄦ煇浜涙儏鍐典笅浣跨敤unixODBC锛屽彲鑳戒細鍑虹幇涓嬭堪閿欒锛

Data source name not found and no default driver specified锛堟暟鎹簮鍚嶄笉瀛樺湪锛屾湭鎸囧畾榛樿椹卞姩绋嬪簭锛

濡傛灉鍑虹幇璇ユ儏鍐碉紝璇风‘璁ODBCINIODBCSYSINI鐜鍙橀噺鎸囧悜姝g‘鐨刼dbc.ini鏂囦欢銆備緥濡傦紝濡傛灉浣犵殑odbc.ini鏂囦欢浣嶄簬鐩綍鈥/usr/local/etc涓嬶紝鍙皢鐜鍙橀噺璁句负锛

export ODBCINI=/usr/local/etc/odbc.ini
export ODBCSYSINI=/usr/local/etc

26.1.9.4. 杩炴帴鍙傛暟

浣犲彲浠ュ湪ODBC.INI鏂囦欢鐨刐Data Source Name]锛堟暟鎹簮鍚嶏級閮ㄥ垎銆佹垨閫氳繃SQLDriverConnect() call鐨InConnectionString鍙傞噺涓篗yODBC鎸囧畾涓嬭堪鍙傛暟

鍙傛暟

榛樿鍊

娉ㄩ噴

user

ODBC (on Windows)

鐢ㄤ簬閾炬帴鑷矼ySQL鐨勭敤鎴峰悕銆

server

localhost

MySQL鏈嶅姟鍣ㄧ殑涓绘満鍚嶃

database

 

榛樿鏁版嵁搴撱

option

0

鎸囧畾MyODBC宸ヤ綔鏂瑰紡鐨勯夐」銆傚弬瑙佷笅闈€

port

3306

濡傛灉鏈嶅姟鍣ㄤ笉鏄湰鍦颁富鏈哄皢瑕佷娇鐢ㄧ殑TCP/IP绔彛銆

stmt

 

杩炴帴鑷矼ySQL鏃跺皢瑕佹墽琛岀殑璇彞銆

password

 

鏈嶅姟鍣ㄤ笂鐢ㄦ埛璐︽埛鐨勫瘑鐮併

socket

 

褰撴湇鍔″櫒鏄湰鍦颁富鏈烘槸灏嗚杩炴帴鐨刄nix濂楁帴瀛楁枃浠舵垨Windows鍛藉悕绠¢亾銆

閫夐」鍙傞噺鐢ㄤ簬閫氱煡MyODBC锛氬鎴风涓嶆槸100% ODBC鍏煎鐨勩傚湪Windows骞冲彴涓嬶紝姝e父鎯呭喌涓嬶紝搴旈氳繃鍒囨崲杩炴帴灞忓箷涓婄殑澶嶉夋閫夋嫨閫夐」锛屼絾涔熻兘鍦ㄩ夐」鍙傞噺涓夋嫨瀹冧滑銆備笅杩伴夐」鏄寜鐓у畠浠湪MyODBC杩炴帴灞忓箷涓婃樉绀虹殑椤哄簭鎺掑垪鐨勶細

鎻忚堪

1

瀹㈡埛绔棤娉曞鐞嗭紝MyODBC杩斿洖鍒楃殑瀹為檯瀹藉害銆

2

瀹㈡埛绔棤娉曞鐞嗭紝MyODBC杩斿洖鍙楀奖鍝嶈鐨勭湡鍊笺傚鏋滆缃簡璇ユ爣蹇楋紝MySQL灏嗚繑鍥炩滃彂鐜扮殑琛屸濆彇鑰屼唬涔嬨侻ySQL鐨勭増鏈繀椤绘槸3.21.14鎴栨洿楂樼増鏈紝璇ュ姛鑳芥墠鑳界敓鏁堛

4

c:\myodbc.log涓敓鎴愯皟璇曟棩蹇椼傚畠涓庡皢MYSQL_DEBUG=d:t:O,c::\myodbc.log鏀惧埌AUTOEXEC.BAT涓殑鏁堟灉鐩稿悓锛堝湪Unix骞冲彴涓嬶紝璇ユ枃浠舵槸/tmp/myodbc.log锛夈

8

涓嶄负缁撴灉鍜屽弬鏁拌缃换浣曚俊鎭姤闄愬埗銆

16

鍗充娇椹卞姩绋嬪簭鍙兘浼氱粰鍑烘彁绀猴紝瀵瑰嚭鐜扮殑闂涓嶄簣鎻愮ず銆

32

鍏佽鎴栫姝㈠姩鎬佸厜鏍囨敮鎸併傦紙鍦∕yODBC 2.50涓笉鍏佽锛夈

64

db_name.tbl_name.col_name涓拷鐣ユ暟鎹簱鍚嶇殑浣跨敤銆

128

寮哄埗浣跨敤ODBC绠$悊鍣ㄥ厜鏍囷紙瀹為獙鎬э級銆

256

绂佹浣跨敤鎵╁睍鍙栨暟鎹紙瀹為獙鎬э級銆

512

CHAR鍒楀~鍏呬负鍏ㄥ垪瀹姐

1024

SQLDescribeCol()杩斿洖瀹屽叏鍚堟牸鐨勫垪鍚嶃

2048

浣跨敤鍘嬬缉瀹㈡埛绔紡鏈嶅姟鍣ㄥ崗璁

4096

閫氱煡鏈嶅姟鍣ㄥ拷鐣ュ嚱鏁板悕涔嬪悗鍜屸(鈥濅箣鍓嶇殑绌烘牸锛圥owerBuilder瑕佹眰杩欐牱锛夈傝繖浼氫娇鎵鏈夌殑鍑芥暟鍚嶆垚涓哄叧閿瓧銆

8192

鐢ㄥ懡鍚嶇閬撻摼鎺ヨ嚦杩愯鍦∟T鐜涓嬬殑mysqld鏈嶅姟鍣ㄣ

16384

LONGLONG鍒楁洿鏀逛负INT鍒楋紙鏌愪簺搴旂敤绋嬪簭涓嶈兘澶勭悊LONGLONG鍒楋級

32768

SQLTables杩斿洖浣滀负Table_qualifierTable_owner鐨勭敤鎴锛堝疄楠屾э級銆

65536

my.cnf鐨刐client][odbc]缁勮鍙栧弬鏁般

131072

澧炲姞涓浜涢澶栨鏌ワ紙涓嶅簲闇瑕佷箣锛屼絾锛夈

262144

绂佹浜嬪姟銆

524288

鍏佽灏嗘煡璇㈣褰曞埌c:\myodbc.sql(/tmp/myodbc.sql)鏂囦欢銆傦紙浠呭湪璋冭瘯妯″紡涓嬫墠鑳藉惎鐢級銆

1048576

涓嶈椹卞姩涓殑缁撴灉杩涜缂撳啿澶勭悊锛岃屽簲浠庢湇鍔″櫒璇诲彇鈥mysql_use_result()鈥濄備粎瀵规鍚戝厜鏍囨墠鑳借捣浣滅敤銆傚綋浣犱笉甯屾湜缂撳啿澶勭悊鏁翠釜缁撴灉闆嗘椂锛屽浜庡ぇ琛ㄥ鐞嗭紝璇ラ夐」鍗佸垎閲嶈銆

2097152

寮哄埗浣跨敤姝e悜鍏夋爣绫诲瀷銆傚湪搴旂敤绋嬪簭璁剧疆浜嗛粯璁ら潤鎬侊紡鍔ㄦ佸厜鏍囩被鍨嬬殑鎯呭喌涓嬶紝濡傛灉甯屾湜椹卞姩绋嬪簭浣跨敤闈炵紦鍐茬粨鏋滈泦锛岄偅涔堣閫夐」鑳藉淇濊瘉姝e悜鍏夋爣鐨勮涓恒

瑕佹兂閫夋嫨澶氫釜閫夐」锛屽彲灏嗗畠浠殑鍊煎姞鍦ㄤ竴璧枫備緥濡傦紝灏嗛夐」璁剧疆涓12锛4锛8锛夛紝灏辫兘鑾峰緱璋冭瘯鍔熻兘锛屼絾娌℃湁淇℃伅鍖呴檺鍒躲

榛樿鐨myodbc3.dll鏄负浼樺寲鎬ц兘鑰岀紪璇戠殑銆濡傛灉甯屾湜璋冭瘯MyODBC 3.51锛堜緥濡傦紝鍚敤璺熻釜鍔熻兘锛夛紝搴斾娇鐢myodbc3d.dll銆傝鎯冲畨瑁呰鏂囦欢锛岃鎷疯礉myodbc3d.dll锛屼娇涔嬭鐩栧凡瀹夎鐨刴yodbc3.dll鏂囦欢銆涓鏃﹀畬鎴愪簡璋冭瘯鎿嶄綔锛屽姟蹇呮仮澶嶈嚦椹卞姩DLL鐨勫彂甯冪増鏈紝杩欐槸鍥犱负璋冭瘯鐗堟湰鍙兘浼氬鑷存ц兘闂銆傛敞鎰忥紝鍦∕yODBC 3.51.07鑷3.51.11涓湭鍖呭惈myodbc3d.dll銆濡傛灉浣犳鍦ㄤ娇鐢ㄨ繖浜涚増鏈腑鐨勪竴涓紝搴斾粠涔嬪墠鐨勭増鏈紙渚嬪3.51.06锛夋嫹璐濊DLL鏂囦欢銆

瀵逛簬MyODBC 2.50锛岄噰鐢ㄤ簡myodbc.dll鍜宮yodbcd.dll鍙栬屼唬涔嬨

鍦ㄤ笅闈㈢殑琛ㄥ悇涓紝缁欏嚭浜嗛拡瀵瑰悇绉嶉厤缃殑鎺ㄨ崘閫夐」鍊硷細

閰嶇疆

閫夐」鍊

Microsoft Access

3

Microsoft Visual Basic

3

鍏锋湁寰堝琛岀殑澶ц〃

2049

椹卞姩璺熻釜鐢熸垚锛堣皟璇曟ā寮忥級

4

鏌ヨ鏃ュ織鐢熸垚锛堣皟璇曟ā寮忥級

524288

鐢熸垚椹卞姩璺熻釜鍜屾煡璇㈡棩蹇楋紙璋冭瘯妯″紡锛

524292

鍏锋湁闈炵紦鍐茬粨鏋滅殑澶ц〃

3145731

26.1.9.5. 娌℃湁棰勫畾涔塂SN涓嬬殑杩炴帴

鏄傞氳繃鎸囧畾DRIVER鍚嶇О瀛楁锛屽彲浣跨敤SQLDriverConnect杩炴帴鍒癕ySQL鏈嶅姟鍣ㄣ備笅闈㈢粰鍑轰簡浣跨敤DSN-Less杩炴帴鐨凪yODBC杩炴帴瀛楃涓诧細

瀵逛簬MyODBC 2.50锛

ConnectionString = "DRIVER={MySQL};\
                  SERVER=localhost;\
                  DATABASE=test;\
                  USER=venu;\
                  PASSWORD=venu;\
                  OPTION=3;"

瀵逛簬MyODBC 3.51锛

ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};\
                  SERVER=localhost;\
                  DATABASE=test;\
                  USER=venu;\
                  PASSWORD=venu;\
                  OPTION=3;"

濡傛灉浣犱娇鐢ㄧ殑缂栫▼璇█浼氬皢鍚庤窡绌烘牸鐨勫弽鏂滄潬杞崲涓虹┖鏍硷紝鏈濂藉皢杩炴帴瀛楃涓叉寚瀹氫负鍗曚釜闀垮瓧绗︿覆锛屾垨浣跨敤涓嶄細鍦ㄥ叾涓坊鍔犵┖鏍肩殑澶氫釜瀛楃涓蹭覆鎺ャ備緥濡傦細

ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};"
                  "SERVER=localhost;"
                  "DATABASE=test;"
                  "USER=venu;"
                  "PASSWORD=venu;"
                  "OPTION=3;"

鍏充簬鍙彁渚涜繛鎺ュ弬鏁扮殑娓呭崟锛岃鍙傝26.1.9.4鑺傦紝鈥滆繛鎺ュ弬鏁扳

26.1.9.6. 寤虹珛浠庣郴缁烝鍒扮郴缁烞鐨勮繙绋嬭繛鎺

濡傛灉浣犳墦绠椾娇鐢myusermypassword浣滀负鐢ㄦ埛鍚嶅拰瀵嗙爜浠庣郴缁烞杩炴帴鍒扮郴缁烝锛屽彲鍙傝冧笅闈㈢粰鍑虹殑绠鍗曟楠ゃ

鍦ㄧ郴缁烝涓婏紝鎵ц涓嬭堪姝ラ锛

1.    鍚姩MySQL鏈嶅姟鍣ㄣ

2.    浣跨敤GRANT寤虹珛鐢ㄦ埛鍚嶄负myuser鐨勮处鎴凤紝璇ヨ处鎴峰彲浣跨敤瀵嗙爜myuser浠庣郴缁烞寤虹珛杩炴帴銆

3.             GRANT ALL ON *.* to 'myuser'@'B' IDENTIFIED BY 'mypassword';

4.    GRANT璇彞涓虹敤鎴穖yuser鎺堜簣浜嗕娇鐢ㄥ瘑鐮乵ypassword浠庣郴缁烞杩涜杩炴帴鐨勬墍鏈夋潈闄愩瑕佹兂鎵ц璇ヨ鍙ワ紝蹇呴』鍦ㄧ郴缁烝涓婃嫢鏈夋牴鐢ㄦ埛鏉冮檺锛屾垨鏄叿鏈夋伆褰撴潈闄愮殑鍙︿竴鐢ㄦ埛銆傚叧浜嶮ySQL鏉冮檺鐨勬洿澶氫俊鎭紝璇峰弬瑙5.8鑺傦紝鈥淢ySQL鐢ㄦ埛璐︽埛绠$悊鈥

鍦ㄧ郴缁烞涓婏紝鎵ц涓嬭堪姝ラ锛

1.    浣跨敤涓嬭堪杩炴帴鍙傛暟閰嶇疆MyODBC DSN锛

2.           DSN            = remote_test
3.           SERVER or HOST = A (or IP address of system A)
4.           DATABASE       = test (The default database or an appropriate one)
5.           USER           = myuser
6.           PASSWORD       = mypassword

鍏充簬寤虹珛DSN-less杩炴帴鐨勬洿澶氫俊鎭紝璇峰弬瑙26.1.9.5鑺傦紝鈥滄病鏈夐瀹氫箟DSN涓嬬殑杩炴帴鈥

7.    浣跨敤Ping鍛戒护鎴栧叾瀹冩柟寮忔鏌ユ槸鍚﹁兘浠庣郴缁烞璁块棶绯荤粺A銆傚鏋滄棤娉曡闂郴缁烝锛岃妫鏌ョ綉缁滄垨Internet杩炴帴锛屾垨涓庝綘鐨勭郴缁熺鐞嗗憳鑱旂郴銆

8.    灏濊瘯浣跨敤DSN=remote_test杩涜杩炴帴銆傚鏋滃け璐ワ紝璇疯窡韪煡璇yODBC鏃ュ織锛屽苟鏍规嵁鏃ュ織缁欏嚭鐨勯敊璇俊鎭噰鍙栬繘涓姝ョ殑姝ラ銆傚鏋滈渶瑕佽繘涓姝ュ府鍔╋紝璇峰彂閫佽缁嗙殑鐢靛瓙閭欢鑷myodbc@lists.mysql.com

鍦ㄤ笅杩扮珯鐐癸紝浣犲彲浠ユ壘鍒板叧浜庡浣曞畬鎴愯鎿嶄綔鐨勭畝鍗曠ず渚嬶細http://www.phphelp.com/tutorial/using-myodbc-to-connect-to-a-remote-database.html.

26.1.9.7. 鑾峰彇ODBC璺熻釜鏂囦欢

濡傛灉閬囧埌涓嶮yODBC鏈夊叧鐨勫洶闅炬垨闂锛岄鍏堝簲浣跨敤ODBC绠$悊鍣ㄥ拰MyODBC鐢熸垚涓浠芥棩蹇楁枃浠锛堣姹傛潵鑷狾DBC ADMIN鐨勬棩蹇楁椂鑾峰緱鐨勬棩蹇楁枃浠讹級銆

瑕佹兂閫氳繃椹卞姩绠$悊鍣ㄨ幏寰桹DBC璺熻釜鏂囦欢锛屽彲閲囧彇涓嬭堪姝ラ锛

         鎵撳紑ODBC鏁版嵁婧愮鐞嗗櫒锛

1.    鐐瑰嚮鈥滃紑濮嬧濓紝灏嗘寚閽堟寚鍚戔滆缃濓紝鐒跺悗鐐瑰嚮鈥滄帶鍒堕潰鏉库濄

2.    鍦ㄨ繍琛孧icrosoft Windows 2000銆乆P鎴2003鐨勮绠楁満涓婏紝鍙屽嚮鈥滅鐞嗗伐鍏封濓紝鐒跺悗鍙屽嚮鈥滄暟鎹簮鈥濓紙ODBC锛夛紝濡備笅鍥炬墍绀恒

ODBC Data Sources
                  Icon

鍦ㄨ繍琛屾棭鏈烳icrosoft Windows鐗堟湰鐨勮绠楁満涓婏紝鍙屽嚮鈥滄帶鍒堕潰鏉库濅腑鐨32浣ODBC鎴朞DBC銆

3.    鎵撳紑ODBC鏁版嵁婧愮鐞嗗櫒瀵硅瘽妗嗭紝濡備笅鍥炬墍绀猴細

ODBC Data Source
                  Administrator Dialog

4.    鐐瑰嚮鈥滃府鍔┾濅互浜嗚ВODBC鏁版嵁婧愮鐞嗗櫒瀵硅瘽妗嗗悇閫夐」鍗$殑璇︾粏淇℃伅銆

         鍚敤璺熻釜閫夐」 瀵逛簬Windows鍜孶nix骞冲彴锛岃姝ラ涓嶅悓銆

瑕佹兂鍦╓indows骞冲彴涓婂惎鐢ㄨ窡韪夐」锛

1.    閫氳繃鈥淥DBC鏁版嵁婧愮鐞嗗櫒鈥濆璇濇鐨勨滆窡韪濋夐」鍗★紝鍙璺熻釜ODBC鍑芥暟鐨勬柟寮忚繘琛岄厤缃

2.    浠庘滆窡韪濋夐」鍗℃縺娲讳簡璺熻釜鍔熻兘鍚庯紝椹卞姩绠$悊鍣ㄤ細瀵瑰悗缁繍琛岀殑鎵鏈夊簲鐢ㄧ▼搴忕殑ODBC鍑芥暟璋冪敤杩涜璺熻釜銆

3.    婵娲昏窡韪姛鑳藉墠鎵杩愯搴旂敤绋嬪簭鐨凮DBC鍑芥暟璋冪敤涓嶄細琚褰曘侽DBC鍑芥暟璋冪敤灏嗚璁板綍鍦ㄤ綘鎸囧畾鐨勬棩蹇楁枃浠朵腑銆

4.    鐐瑰嚮鈥滅幇鍦ㄥ仠姝㈣窡韪濆悗锛岃窡韪姛鑳藉皢鍋滄銆傝璁颁綇锛屽惎鍔ㄨ窡韪姛鑳藉悗锛屾棩蹇楁枃浠跺皢涓嶆柇澧炲ぇ锛岃屼笖璺熻釜鍔熻兘浼氬奖鍝嶆墍鏈塐DBC搴旂敤绋嬪簭鐨勬ц兘銆

ODBC Tracing
                  Tab

瑕佹兂鍦║nix骞冲彴涓婂惎鐢ㄨ窡韪夐」锛

5.    鍦║nix骞冲彴涓婏紝闇瑕佸湪ODBC.INI鏂囦欢涓槑纭缃窡韪夐」銆

浣跨敤TraceFile鍜宱dbc.ini涓殑Trace锛堣窡韪級鍙傛暟鎵撳紑鎴栧叧闂窡韪姛鑳斤紝濡備笅鎵绀猴細

TraceFile  = /tmp/odbc.trace
Trace      = 1

TraceFile鎸囨槑浜嗚窡韪枃浠剁殑鍚嶇О鍜屽畬鏁磋矾寰勶紝灏Trace锛堣窡韪級璁句负ONOFF銆備篃鍙互浣跨敤鈥1鈥濇垨鈥淵es鈥濊〃绀篛N锛屼互鍙娾0鈥濇垨鈥淣o鈥濊〃绀篛FF銆傚鏋滄鍦ㄤ娇鐢unixODBC鐨ODBCConfig锛岀劧鍚庨伒鐓HOWTO-ODBCConfig涓粙缁嶇殑鍏充簬璺熻釜unixODBC璋冪敤鐨勬寚绀鸿鏄庛

瑕佹兂鐢熸垚MyODBC鏃ュ織锛屽彲閲囧彇涓嬭堪姝ラ锛

6.    纭繚浣犳墍浣跨敤鐨勬槸椹卞姩绋嬪簭璋冭瘯DLL锛堝浜嶮yODBC 3.51锛屽畠鏄myodbc3d.dll鑰屼笉鏄痬yodbc3.dll锛屽浜MyODBC 2.50锛屽畠鏄myodbcd.dll锛夈

鏈绠鍗曠殑鏂规硶鏄粠MyODBC 3.51鍒嗗彂鐗堟壘鍒myodbc3d.dll锛堟垨myodbcd.dll锛夛紝骞剁敤鍏惰鐩myodbc3.dll锛堟垨myodbc.dll锛夛紝璇ユ枃浠堕氬父浣嶄簬C:\windows\system32C:\winnt\system32鐩綍涓嬨娉ㄦ剰锛屽畬鎴愭祴璇曞悗锛屼綘鎴栬甯屾湜鎭㈠鏃х殑myodbc.dll鏂囦欢锛岃繖鏄洜涓哄畠姣攎yodbc3d.dll锛堟垨myodbcd.dll锛夊揩寰堝锛屽洜姝わ紝璇蜂繚瀛樺師濮婦LL鐨勫浠姐

7.      鍦ㄢ淢yODBC杩炴帴锛忛厤缃濆睆骞曚笂鍚敤鈥滆窡韪MyODBC鈥濋夐」銆傛棩蹇楀皢琚啓鍏ユ枃浠C:\myodbc.log銆傚綋浣犺繑鍥炰笂杩板睆骞曟椂锛屽鏋滀綘璁剧疆鐨勮窡韪夐」鏈璁颁綇锛岃〃鏄庝綘姝e湪浣跨敤鐨勬槸myodbcd.dll椹卞姩锛堝弬瑙佸墠闈㈢殑浠嬬粛锛夈鍦↙inux骞冲彴涓婏紝鎴栦綘浣跨敤鐨勬槸DSN-Less杩炴帴锛岄渶鍦ㄨ繛鎺ュ瓧绗︿覆涓彁渚涒OPTION=4

8.    鍚姩搴旂敤绋嬪簭锛屽苟灏濊瘯鐫浣垮叾鍑虹幇闂銆傜劧鍚庢鏌yODBC璺熻釜鏂囦欢锛屾壘鍑哄彲鑳藉嚭閿欑殑鍦版柟銆

濡傛灉鍙戠幇鏌愪簺浜嬮」鍑洪敊锛岃鍙戦佺數瀛愰偖浠惰嚦myodbc@lists.mysql.com锛堟垨support@mysql.com锛屽鏋滄湁涓MySQL AB绛捐鐨勬敮鎸佸悎鍚岋級锛岀畝瑕佹弿杩板嚭鐜扮殑闂锛屽苟鎻愪緵涓嬭堪棰濆淇℃伅锛

o        MyODBC鐗堟湰

o        ODBC椹卞姩绠$悊鍣ㄧ殑绫诲瀷鍜岀増鏈

o        MySQL鏈嶅姟鍣ㄧ殑鐗堟湰

o        椹卞姩绠$悊鍣ㄧ殑ODBC璺熻釜

o        鏉ヨ嚜MyODBC椹卞姩鐨凪yODBC鏃ュ織鏂囦欢

o        绠鍗曠殑鍙鍒剁ず渚

璇疯浣忥紝浣犳彁渚涚粰鎴戜滑鐨勪俊鎭秺澶氾紝鎴戜滑鏇存闂鐨勬満浼氬氨瓒婂ぇ銆

姝ゅ锛屽湪鎻愪緵缂洪櫡淇℃伅鍓嶏紝璇锋鏌yODBC閭欢鍒楄〃锛http://lists.mysql.com/锛夈

26.1.9.8. 鐢∕yODBC娴嬭瘯鐨勫簲鐢ㄧ▼搴

浣跨敤涓嬭堪搴旂敤绋嬪簭娴嬭瘯浜哅yODBC锛

濡傛灉浣犵煡閬撹兘澶熶笌MyODBC涓璧峰伐浣滅殑鍏朵粬搴旂敤绋嬪簭锛岃浠ョ數瀛愰偖浠剁殑鏂瑰紡鎸囨槑瀹冿細myodbc@lists.mysql.com

26.1.9.9. 宸茬煡鐨勮兘涓嶮yODBC涓璧峰伐浣滅殑绋嬪簭

澶у鏁扮▼搴忓潎鑳戒笌MyODBC涓璧峰伐浣滐紝瀵逛笂闈㈡墍鍒楃殑姣忎竴绋嬪簭锛屾垜浠嚜宸辫繘琛屼簡娴嬭瘯锛屾垨寰楀埌鐢ㄦ埛鐨勭‘璁ゃ傚緢澶氫粙缁嶄腑鍧囩粰鍑轰簡浣犲彲鑳戒細閬囧埌闂鐨勬弿杩般

         绋嬪簭

娉ㄩ噴

         Access

瑕佹兂浣緼ccess宸ヤ綔锛

o        濡傛灉浣犳鍦ㄤ娇鐢ˋccess 2000锛屽簲浠庝笅杩板湴鍧鑾峰彇骞跺畨瑁呮渶鏂扮殑锛2.6鐗堟垨鏇撮珮锛塎icrosoft MDAC锛Microsoft鏁版嵁璁块棶缁勪欢锛夛紝http://www.microsoft.com/data/銆傚畠鏇存浜咥ccess鍦ㄥ皢鏁版嵁瀵煎嚭鑷矼ySQL鏃跺瓨鍦ㄧ殑涓涓己闄凤紝鏈寚瀹氳〃鍚嶅拰鍒楀悕銆傚彟涓绉嶈В鍐宠缂洪櫡鐨勬柟娉曟槸锛屽崌绾у埌MyODBC 2.50.33鍜孧ySQL 3.23.x, 瀹冧滑鍏卞悓鎻愪緵浜嗛伩鍏嶈闂鐨勪竴绉嶆柟寮忋

姝ゅ锛屼綘杩樺簲鑾峰彇骞跺簲鐢∕icrosoft Jet 4.0 Service Pack 5 (SP5)锛屽彲鍦ㄤ笅杩板湴鍧鎵惧埌瀹冿細http://support.microsoft.com/default.aspx?scid=kb;EN-US;q239114銆傚畠淇浜嗘煇浜涙儏鍐典笅鍦ˋccess涓垪琚爣娉ㄤ负鈥#DELETED#鐨勯棶棰樸

娉ㄩ噴锛 濡傛灉浣犳浣跨敤MySQL 3.22锛屽繀椤诲畨瑁匨DAC琛ヤ竵锛屽苟浣跨敤MyODBC 2.50.32鎴2.50.34鎴栨洿楂樼増鏈互瑙e喅璇ラ棶棰樸

o        瀵逛簬鎵鏈夌増鏈殑Access锛屽簲鍚敤鈥淢yODBC杩斿洖鍖归厤琛屸濋夐」銆傚浜嶢ccess 2.0锛岃繕搴旈澶栧惎鐢ㄢ妯℃嫙ODBC 1.0閫夐」

o        鍦ㄥ笇鏈涜兘澶熸洿鏂扮殑鎵鏈夎〃涓紝鍧囧簲鏈夋椂闂存埑銆備负浜嗚幏寰楁渶澶х殑鍙Щ妞嶆э紝鍦ㄥ垪澹版槑涓笉瑕佷娇鐢ㄩ暱搴﹁鑼冦備篃灏辨槸璇达紝搴斾娇鐢TIMESTAMP锛岃屼笉鏄疶IMESTAMP(n), n < 14銆

o        鍦ㄨ〃涓簲鏈1涓富閿傚涓嶇劧锛屾柊鐨勬垨鏇存柊鐨勮鍙兘浼氭樉绀轰负鈥#DELETED#鈥濄

o        浠呭簲浣跨敤DOUBLE娴偣瀛楁銆涓庡崟绮惧害娴偣杩涜姣旇緝鏃讹紝Access灏嗗け璐ャ傚叾寰佸厗鏄柊鐨勬垨鏇存柊鐨勮鍙兘浼氭樉绀轰负鈥#DELETED#鈥濓紝鎴栨棤娉曟壘鍒版垨鏇存柊琛屻

o        濡傛灉浣犳浣跨敤MyODBC鏉ラ摼鎺ュ埌鏈塀IGINT鍒楃殑琛紝缁撴灉浼氭樉绀轰负鈥#DELETED鈥濄傛帓闄ゅ畠鐨勮В鍐虫柟妗堟槸锛

         鏈1涓互TIMESTAMP浣滀负鏁版嵁绫诲瀷鐨勮櫄鎷熷垪銆

         鍦ㄢ淥DBC DSN绠$悊鍣ㄢ濈殑杩炴帴瀵硅瘽妗嗕腑閫夋嫨鈥滃皢BIGINT鍒楁洿鏀逛负INT鈥濋夐」銆

         鍒犻櫎涓嶢ccess鐨勮〃閾炬帴锛屽苟閲嶆柊鍒涘缓瀹冦

鏃ц褰曚粛灏嗘樉绀轰负鈥#DELETED#鈥濓紝浣嗘柊澧烇紡鏇存柊鐨勮褰曚細鎭板綋鏄剧ず銆

o        娣诲姞浜員IMESTAMP鍒楀悗锛屽彟涓浣嶇敤鎴锋洿鏀逛簡鏁版嵁锛屽鏋滈敊璇緷鏃у嚭鐜帮紝涓嬭堪鎶宸ф垨璁告湁鎵甯姪锛

涓嶈浣跨敤琛ㄦ暟鎹〃瑙嗗浘銆傚彇鑰屼唬涔嬬殑鏄紝浠庝綘甯屾湜浣跨敤鐨勮〃鍒涘缓涓涓〃鍗曪紝骞朵娇鐢ㄨ〃鍗曟暟鎹〃瑙嗗浘銆傚簲灏TIMESTAM鍒楃殑DefaultValue灞炴ц缃负NOW()銆傚湪瑙嗗浘涓殣钘TIMESTAMP鍒楁垨璁告槸涓ソ涓绘剰锛岃繖鏍峰氨涓嶄細浣夸綘鐨勭敤鎴锋劅鍒拌糠鎯戙

o        鍦ㄦ煇浜涙儏鍐典笅锛孉ccess鍙兘浼氱敓鎴怣ySQL鏃犳硶鐞嗚В鐨凷QL璇彞銆傚彲閫氳繃鍦ˋccess鑿滃崟涓夋嫨鈥Query|SQLSpecific|Pass-Through鈥濇潵鏇存璇ラ棶棰樸

o        鍦∟T骞冲彴涓婏紝Access浼氬皢BLOB鍒楅氭姤涓OLE OBJECTS锛圤LE瀵硅薄锛夈濡傛灉浣犳墦绠楃敤MEMO鍒楀彇鑰屼唬涔嬶紝搴斾娇鐢ˋLTER TABLE灏咮LOB鍒楁洿鏀逛负TEXT銆

o        Access鏃犳硶鍦ㄤ换浣曟椂鍊欏潎鎭板綋澶勭悊DATE鍒椼濡傛灉閬囧埌杩欑被闂锛岃灏嗗垪鏇存敼涓DATETIME

o        濡傛灉鍦ˋccess涓瓨鍦ㄥ畾涔変负BYTE鐨勫垪锛Access浼氳鍥惧皢鍏跺鍑轰负TINYINT鑰屼笉鏄疶INYINT UNSIGNED銆傚鏋滃垪涓殑鍊煎ぇ浜127锛屽皢鍑虹幇闂銆

         ADO

浣跨敤ADO API鍜孧yODBC杩涜缂栫爜鏃讹紝闇瑕佹敞鎰忔煇浜涗笉琚玀ySQL鏈嶅姟鍣ㄦ敮鎸佺殑榛樿灞炴с備緥濡傦紝瀵逛簬RecordCount灞炴э紝濡傛灉灏咰ursorLocation灞炴х敤浣渁dUseServer锛屽皢杩斿洖缁撴灉-1瑕佹兂鑾峰緱姝g‘鐨勫硷紝闇瑕佸皢璇ュ睘鎬ц缃负adUseClient锛屽涓嬮潰缁欏嚭鐨刅B浠g爜绀轰緥鎵绀猴細

Dim myconn As New ADODB.Connection
Dim myrs As New Recordset
Dim mySQL As String
Dim myrows As Long
 
myconn.Open "DSN=MyODBCsample"
mySQL = "SELECT * from user"
myrs.Source = mySQL
Set myrs.ActiveConnection = myconn
myrs.CursorLocation = adUseClient
myrs.Open
myrows = myrs.RecordCount
 
myrs.Close
myconn.Close

鍙︿竴绉嶅鐞嗘柟寮忔槸锛屽绫讳技鏌ヨ浣跨敤SELECT COUNT(*)璇彞浠ヨ幏鍙栨纭殑琛岃鏁般

         涓诲姩鏈嶅姟鍣ㄩ〉锛圓SP锛

搴旈夋嫨鈥滆繑鍥炲尮閰嶈鈥濋夐」銆

         BDE搴旂敤绋嬪簭

瑕佹兂浣胯繖绫诲簲鐢ㄧ▼搴忓伐浣滐紝搴旈夋嫨鈥滀笉浼樺寲鍒楀搴﹀苟杩斿洖鍖归厤琛屸濋夐」銆

         Borland Builder 4

寮濮嬫煡璇㈡椂锛屽彲浣跨敤Active灞炴ф垨Open鏂规硶銆娉ㄦ剰锛Active灏嗛氳繃鑷姩鍙戝嚭SELECT * FROM ...鏌ヨ寮濮嬨濡傛灉琛ㄥ緢澶э紝杩欎笉鏄粈涔堝ソ浜嬨

         ColdFusion锛堝湪Unix骞冲彴涓婏級

涓嬭堪淇℃伅鍙栬嚜ColdFusion鏂囨。锛

浣跨敤涓嬭堪淇℃伅鏉ラ厤缃敤浜嶭inux鐨凜oldFusion鏈嶅姟鍣紝浠ヤ究浣跨敤閽堝MySQL鏁版嵁婧愮殑unixODBC椹卞姩鍜孧yODBC銆侫llaire宸茶瘉鏄庯紝MyODBC 2.50.26鑳藉涓嶮ySQL 3.22.27浠ュ強鐢ㄤ簬Linux鐨凜oldFusion涓璧峰伐浣溿傦紙浠讳綍杈冩柊鐨勭増鏈篃搴旇兘姝g‘宸ヤ綔锛夈備綘鍙互鍦ㄧ綉绔http://dev.mysql.com/downloads/connector/odbc/涓婁笅杞組yODBC銆

閫氳繃ColdFusion 4.5.1鐗堬紝鍙互浣跨敤鈥淐oldFusion绠$悊鍣ㄢ濇潵娣诲姞MySQL鏁版嵁婧愩備絾鏄紝椹卞姩绋嬪簭鏈寘鍚湪ColdFusion 4.5.1鐗堜腑銆傚湪MySQL椹卞姩绋嬪簭鍑虹幇鍦∣DBC鏁版嵁婧愪笅鎷夊垪琛ㄤ箣鍓嶏紝蹇呴』鍒涘缓MyODBC椹卞姩绋嬪簭锛屽苟灏嗗叾鎷疯礉鍒/opt/coldfusion/lib/libmyodbc.so

鍦–ontrib鐩綍涓嬪寘鍚▼搴mydsn-xxx.zip锛屼娇鐢ㄥ畠锛屽浜Coldfusion搴旂敤绋嬪簭锛屽彲鍒涘缓骞跺垹闄ょ敤浜嶮yODBC椹卞姩鐨凞SN娉ㄥ唽鏂囦欢銆

         DataJunction

搴斿鍏惰繘琛屾洿鏀癸紝浣夸箣杈撳嚭VARCHAR鑰屼笉鏄疎NUM锛屽洜涓哄叾瀵煎嚭ENUM鐨勬柟寮忎細閫犳垚MySQL闂銆

         Excel

宸ヤ綔銆備竴浜涙彁绀猴細

o        濡傛灉閬囧埌鏃ユ湡鏂归潰鐨勯棶棰橈紝璇蜂娇鐢CONCAT()鍑芥暟锛屽皢鍏堕夋嫨涓哄瓧绗︿覆銆渚嬪锛

o                     SELECT CONCAT(rise_time), CONCAT(set_time)
o                       FROM sunrise_sunset;

閲囩敤璇ユ柟寮忎互瀛楃涓叉彁鍙栫殑鍊煎簲鑳借Excel97姝g‘璇嗗埆涓烘椂闂村笺

鍦ㄦ湰渚嬩腑锛CONCAT()鐨勭洰鐨勬槸璁㎡DBC璁や负鍒楁槸瀛楃涓茬被鍨濡傛灉娌℃湁CONCAT()锛孫DBC浼氬皢鍒楄涓烘椂闂寸被鍨嬶紝Excel鏃犳硶鐞嗚В瀹冦

娉ㄦ剰锛孍xcel瀛樺湪1涓己闄凤紝杩欐槸鍥犱负瀹冧細鑷姩灏嗗瓧绗︿覆杞崲涓烘椂闂淬傚鏋滄簮鏄枃鏈枃浠讹紝涓嶅瓨鍦ㄩ棶棰橈紝浣嗗綋婧愭槸閫氭姤鍚勫垪鍑嗙‘绫诲瀷鐨凮DBC杩炴帴鏃讹紝灏嗗嚭鐜伴棶棰樸

         Word

瑕佹兂灏嗘暟鎹粠MySQL鎻愬彇鍒癢ord/Excel鏂囨。锛岄渶瑕佷娇鐢∕yODBC椹卞姩绋嬪簭浠ュ強鈥淢icrosoft鏌ヨ甯姪鈥濇彃浠躲

渚嬪锛岀敤鍚湁涓ゅ垪鏂囨湰鐨勮〃鍒涘缓1涓暟鎹簱锛

o        浣跨敤mysql瀹㈡埛绔鍛戒护琛屽伐鍏锋彃鍏ヨ銆

o        浣跨敤ODBC绠$悊鍣ㄥ垱寤1涓狣SN鏂囦欢锛屼緥濡傦紝閽堝鍒氬垱寤烘暟鎹簱鐨勨渕y鈥濄

o        鎵撳紑Word搴旂敤绋嬪簭銆

o        鍒涘缓1涓柊鐨勭┖鐧芥枃妗c

o        鍦ㄦ暟鎹簱宸ュ叿鏍忎笂锛屾寜鈥滄彃鍏ユ暟鎹簱鈥濇寜閽

o        鎸夆滆幏鍙栨暟鎹濇寜閽

o        鍦ㄢ滆幏鍙栨暟鎹濆睆骞曞彸渚э紝鎸夆Ms Query鈥濇寜閽

o        鍦ㄢMs Query鈥濅腑浣跨敤鈥my DSN鈥濇枃浠跺垱寤1涓柊鏁版嵁婧愩

o        閫夋嫨鏂版煡璇€

o        閫夋嫨鎵撶畻浣跨敤鐨勫垪銆

o        濡傛灉鎰挎剰锛屽垱寤1涓繃婊ゅ櫒銆

o        濡傛灉鎰挎剰锛屽垱寤1涓垎绫汇

o        閫夋嫨鈥滃皢鏁版嵁杩斿洖鍒Microsoft Word鈥濄

o        鐐瑰嚮鈥滃畬鎴愨濄

o        鐐瑰嚮鈥滄彃鍏ユ暟鎹濆苟閫夋嫨璁板綍銆

o        鐐瑰嚮OK锛屽湪浣犵殑Word鏂囨。涓皢鐪嬪埌鎻掑叆鐨勮銆

         odbcadmin

ODBC鐨勬祴璇曠▼搴忋

         Delphi

蹇呴』浣跨敤BDE 3.2鐗堟垨鏇存柊鐨勭増鏈傝繛鎺ュ埌MySQL鏃讹紝閫夋嫨鈥滀笉浼樺寲鍒楀搴︹濋夐」銆

姝ゅ锛岃繖閲岀粰鍑轰簡涓浜涘彲鑳芥湁鐢ㄧ殑Delphi浠g爜锛岃繖浜涗唬鐮佸彲璁剧疆涓篗yODBC璁剧疆ODBC鏉$洰鍜孊DE鏉$洰銆侭DE鏉$洰瑕佹眰鐢ㄥ埌鈥淏DE鍒悕缂栬緫鍣ㄢ濓紝瀹冧綅浜庨潬杩戜綘鐨勨淒elphi Super Page鈥濅笂锛屽彲鑷敱鎷栧姩銆傦紙涓嬭堪鍐呭鐢盉ryan Brunton <bryan@flesherfab.com>鎻愪緵锛夛細

fReg:= TRegistry.Create;
fReg.OpenKey('\Software\ODBC\ODBC.INI\DocumentsFab', True);
fReg.WriteString('Database', 'Documents');
fReg.WriteString('Description', ' ');
fReg.WriteString('Driver', 'C:\WINNT\System32\myodbc.dll');
fReg.WriteString('Flag', '1');
fReg.WriteString('Password', '');
fReg.WriteString('Port', ' ');
fReg.WriteString('Server', 'xmark');
fReg.WriteString('User', 'winuser');
fReg.OpenKey('\Software\ODBC\ODBC.INI\ODBC Data Sources', True);
fReg.WriteString('DocumentsFab', 'MySQL');
fReg.CloseKey;
fReg.Free;
 
Memo1.Lines.Add('DATABASE NAME=');
Memo1.Lines.Add('USER NAME=');
Memo1.Lines.Add('ODBC DSN=DocumentsFab');
Memo1.Lines.Add('OPEN MODE=READ/WRITE');
Memo1.Lines.Add('BATCH COUNT=200');
Memo1.Lines.Add('LANGDRIVER=');
Memo1.Lines.Add('MAX ROWS=-1');
Memo1.Lines.Add('SCHEMA CACHE DIR=');
Memo1.Lines.Add('SCHEMA CACHE SIZE=8');
Memo1.Lines.Add('SCHEMA CACHE TIME=-1');
Memo1.Lines.Add('SQLPASSTHRU MODE=SHARED AUTOCOMMIT');
Memo1.Lines.Add('SQLQRYMODE=');
Memo1.Lines.Add('ENABLE SCHEMA CACHE=FALSE');
Memo1.Lines.Add('ENABLE BCD=FALSE');
Memo1.Lines.Add('ROWSET SIZE=20');
Memo1.Lines.Add('BLOBS TO CACHE=64');
Memo1.Lines.Add('BLOB SIZE=32');
 
AliasEditor.Add('DocumentsFab','MySQL',Memo1.Lines);

         C++ Builder

鐢˙DE 3.0鐗堣繘琛屼簡娴嬭瘯銆傜洰鍓嶅凡鐭ョ殑鍞竴闂鏄紝鏇存敼琛ㄦ柟妗堟椂锛屾煡璇㈠瓧娈典笉鏇存柊銆傜劧鑰岋紝BDE鐪嬩笂鍘讳笉浼氳瘑鍒富閿紝瀹冧粎鏄悕涓篜RIMARY鐨勭储寮曪紝灏界杩欒皥涓嶄笂鏄棶棰樸

         Vision

搴旈夋嫨鈥滆繑鍥炲尮閰嶈鈥濋夐」銆

         Visual Basic

瑕佹兂鏇存柊琛紝蹇呴』涓鸿〃瀹氫箟涓婚敭銆

甯︽湁ADO鐨刅isual Basic涓嶈兘澶勭悊澶ф暣鏁般傝繖鎰忓懗鐫鏌愪簺鏌ヨ锛堝SHOW PROCESSLIST绛夛級涓嶄細姝g‘宸ヤ綔銆鏇存鏂规硶鏄紝鍦∣DBC杩炴帴瀛楃涓蹭腑浣跨敤OPTION=16384锛屾垨鍦MyODBC杩炴帴灞忓箷涓婇夋嫨鈥滃皢BIGINT鍒楁洿鏀逛负INT鈥濋夐」銆傛垨璁革紝浣犱篃甯屾湜閫夋嫨鈥滆繑鍥炲尮閰嶈鈥濋夐」銆

         VisualInterDev

濡傛灉鍦ㄧ粨鏋滀腑鏈BIGINT锛屽彲鑳戒細鍑虹幇閿欒[Microsoft][ODBC Driver Manager]椹卞姩绋嬪簭涓嶆敮鎸佽鍙傛暟銆傝MyODBC杩炴帴灞忓箷涓婇夋嫨鈥滃皢BIGINT鍒楁洿鏀逛负INT鈥濋夐」銆

         Visual Objects

搴旈夋嫨鈥滀笉浼樺寲鍒楀搴︹濋夐」銆

         MS Visio Enterprise 2000

閫氳繃MyODBC锛2.50.37鎴栨洿楂樼増鏈級锛岄氳繃杩炴帴MS Vision Enterprise 2000鍜孧ySQL锛屽苟浣跨敤Visio鐨勯嗗悜宸ョ▼甯堝姛鑳斤紝鎴戜滑寤虹珛浜嗘暟鎹簱妯″瀷锛屼娇鐢ㄥ畠鏉ユ绱㈠叧浜嶥B鐨勪俊鎭紙Visio鏄剧ず浜嗘墍鏈夌殑鍒楀畾涔夈佷富閿佺储寮曠瓑锛夈傛澶栵紝鎴戜滑杩橀氳繃鎸囧畾Visio涓殑鏂拌〃杩涜浜嗘祴璇曪紝骞堕氳繃MyODBC灏嗗叾瀵煎嚭鑷矼ySQL銆

26.1.10. 涓嶮yODBC杩炴帴鐩稿叧鐨勪簨瀹

鍦ㄦ湰鑺備腑锛屽洖绛斾簡涓嶮yODBC杩炴帴鏈夊叧鐨勯棶棰樸

26.1.10.1. 閰嶇疆MyODBC DSN鏃讹紝鍑虹幇涓嶈兘鍔犺浇缈昏瘧鍣ㄦ垨璁剧疆搴撻敊璇

鏇村淇℃伅锛岃鍙傝MS鐭ヨ瘑搴撴枃绔(Q260558)銆傛澶栵紝璇风‘璁ゅ湪浣犵殑绯荤粺鐩綍涓嬫湁鏈鏂扮殑鏈夋晥ctl3d32.dll鏂囦欢銆

26.1.10.2. 杩炴帴鏃讹紝鍑虹幇鎷掔粷璁块棶閿欒

璇峰弬瑙5.7.8鑺傦紝鈥滄嫆缁濊闂敊璇殑鍘熷洜

26.1.10.3. INFO锛氬叧浜嶰DBC杩炴帴姹

鍏充簬杩炴帴姹犳柟闈㈢殑淇℃伅锛岃鍙傞槄涓嬭堪鏂囨。锛 http://support.microsoft.com/default.aspx?scid=kb;EN-US;q169470

26.1.11. MyODBC鍜孧icrosoft Access

鍦ㄦ湰鑺備腑锛屽洖绛斾簡涓嶮yODBC鍜孧icrosoft Access鏈夊叧鐨勯棶棰樸

26.1.11.1. 濡備綍璁剧疆Microsoft Access锛屼娇涔嬭兘澶熶笌浣跨敤MyODBC鐨凪ySQL涓璧峰伐浣滐紵

瑕佹兂浣縈icrosoft Access鑳藉涓嶮yODBC涓璧峰伐浣滐紝鍦ㄤ綘鐨勫鎴风PC涓婂繀椤诲畬鎴愪笅杩版搷浣溿

1.    濡傛灉浣犳鍦ㄤ娇鐢ˋccess 2000锛屽簲浠庝笅杩板湴鍧鑾峰彇骞跺畨瑁呮渶鏂扮殑锛2.6鐗堟垨鏇撮珮锛塎icrosoft MDAC锛Microsoft鏁版嵁璁块棶缁勪欢锛夛紝http://www.microsoft.com/data/銆傚畠鏇存浜咥ccess鍦ㄥ皢鏁版嵁瀵煎嚭鑷矼ySQL鏃跺瓨鍦ㄧ殑涓涓己闄凤紝鏈寚瀹氳〃鍚嶅拰鍒楀悕銆傚彟涓绉嶈В鍐宠缂洪櫡鐨勬柟娉曟槸锛屽崌绾у埌MyODBC 2.50.33鍜孧ySQL 3.23.x, 瀹冧滑鍏卞悓鎻愪緵浜嗛伩鍏嶈闂鐨勪竴绉嶆柟寮忋

姝ゅ锛屼綘杩樺簲鑾峰彇骞跺簲鐢∕icrosoft Jet 4.0 Service Pack 5 (SP5)锛屽彲鍦ㄤ笅杩板湴鍧鎵惧埌瀹冿細http://support.microsoft.com/default.aspx?scid=kb;EN-US;q239114銆傚畠淇浜嗘煇浜涙儏鍐典笅鍦ˋccess涓垪琚爣娉ㄤ负鈥#DELETED#鐨勯棶棰樸

娉ㄩ噴锛 濡傛灉浣犳浣跨敤MySQL 3.22锛屽繀椤诲畨瑁匨DAC琛ヤ竵锛屽苟浣跨敤MyODBC 2.50.32鎴2.50.34鎴栨洿楂樼増鏈互瑙e喅璇ラ棶棰樸

2.    瀹夎鏈鏂扮増MySQL锛http://dev.mysql.com/downloads/

3.    瀹夎鏈鏂扮増MyODBC 3.51鎴2.50锛http://dev.mysql.com/downloads/connector/odbc/

4.    瀵逛簬鎵鏈夌増鏈殑Access锛屽簲鍚敤鈥淢yODBC杩斿洖鍖归厤琛屸濋夐」銆

5.    閫氳繃MyODBC锛屽皢Access鐢ㄤ綔MySQL鏈嶅姟鍣ㄧ殑鍓嶇绋嬪簭銆

26.1.11.2. 濡備綍灏嗚〃鎴栨煡璇粠Access瀵煎嚭鍒癕ySQL锛

闄ら潪宸插畨瑁呬簡MyODBC锛屽惁鍒欎笉鑳藉皢琛ㄦ垨鏌ヨ瀵煎嚭鍒癕ySQL銆

瑕佹兂灏嗚〃浠嶢ccess瀵煎叆MySQL锛岃閬靛惊涓嬭堪璇存槑锛

1.    鎵撳紑Access鏁版嵁搴撴垨Access椤圭洰鏃讹紝鍑虹幇鈥滄暟鎹簱鈥濈獥鍙c傚叾涓樉绀轰簡鐢ㄤ簬鍒涘缓鏂版暟鎹簱瀵硅薄鍜屾墦寮宸叉湁瀵硅薄鐨勫揩鎹锋柟寮忋

Access Database

2.    鐐瑰嚮鎵撶畻瀵煎嚭鐨勮〃鍚嶆垨鏌ヨ鍚嶏紝鐒跺悗鍦ㄢ滄枃浠垛濊彍鍗曚腑閫夋嫨鈥滃鍑衡濄

3.    鍦ㄢ滃鍑哄璞$被鍨瀵硅薄鍚鈥濆璇濇涓紝鍦ㄢ滃彟瀛樹负绫诲瀷鈥濇涓紝閫夋嫨ODBC鏁版嵁搴()锛屽涓嬪浘鎵绀

Selecting an ODBC Database

4.    鍦ㄢ滃鍑衡濆璇濇涓紝杈撳叆鏂囦欢鍚嶏紙鎴栦娇鐢ㄥ缓璁殑鏂囦欢鍚嶏級锛岀劧鍚庨夋嫨OK銆

5.    鏄剧ず鈥滈夋嫨鏁版嵁婧愨濆璇濇锛屽叾涓垪鍑轰簡涓鸿绠楁満涓婂凡瀹夎鐨勫悇ODBC椹卞姩瀹氫箟鐨勬暟鎹簮銆傜偣鍑烩滄枃浠舵暟鎹簮鈥濇垨鈥滄満鍣ㄦ暟鎹簮鈥濋夐」鍗★紝鐒跺悗鍙屽嚮鎵撶畻瀵煎嚭鑷崇殑MyODBC鎴朚yODBC 3.51鏁版嵁婧愩傚叧浜庝负MyODBC瀹氫箟鏂版暟鎹簮鐨勬柟娉曪紝璇峰弬瑙26.1.9.2鑺傦紝鈥滃湪Windows涓婇厤缃甅yODBC DSN鈥

Microsoft Access閫氳繃璇ユ暟鎹簮杩炴帴鑷矼ySQL鏈嶅姟鍣紝骞跺鍑烘柊鐨勮〃鍜岋紡鎴栨暟鎹

26.1.11.3. 濡備綍瀵煎叆MySQL鏁版嵁搴撹〃鎴栧皢鍏堕摼鎺ュ埌Access锛

闄ら潪宸插畨瑁呬簡MyODBC锛屽惁鍒欎笉鑳藉皢琛ㄦ垨鏌ヨ瀵煎嚭鍒癕ySQL鏁版嵁搴撱

瑕佹兂灏嗚〃浠嶮ySQL瀵煎叆鎴栭摼鎺ュ埌Access锛岃閲囧彇涓嬭堪姝ラ锛

1.    鎵撳紑鏁版嵁搴擄紝鎴栧垏鎹㈠埌鈥滄暟鎹簱鈥濈獥鍙d互鎵撳紑鏁版嵁搴撱

2.    瑕佹兂瀵煎叆琛紝鍦ㄢ滄枃浠垛濊彍鍗曚笂锛屽皢榧犳爣鎸囬拡鎸囧悜鈥滆幏鍙栧閮ㄦ暟鎹濓紝鐒跺悗鐐瑰嚮鈥滃鍏モ濄傝鎯抽摼鎺ヨ〃锛屽湪鈥滄枃浠垛濊彍鍗曚笂锛屽皢榧犳爣鎸囬拡鎸囧悜鈥滆幏鍙栧閮ㄦ暟鎹濓紝鐒跺悗鐐瑰嚮鈥滈摼鎺ヨ〃鈥濄

3.    鍦ㄢ滃鍏モ濓紙鎴栤滈摼鎺モ濓級瀵硅瘽妗嗕腑锛屽湪鈥滄枃浠剁被鍨嬧濇涓夋嫨鈥ODBC Databases ()鈥濄傚湪鈥滈夋嫨鏁版嵁婧愨濆璇濇涓紝鍒楀嚭浜嗗畾涔夌殑鏁版嵁婧愩傛樉绀衡滈夋嫨鏁版嵁婧愨濆璇濇锛屽叾涓垪鍑轰簡涓哄畨瑁呭湪璁$畻鏈轰笂鐨勪换浣昈DBC椹卞姩瀹氫箟鐨勬暟鎹簮銆傜偣鍑烩滄枃浠舵暟鎹簮鈥濇垨鈥滄満鍣ㄦ暟鎹簮鈥濋夐」鍗★紝鐒跺悗鍙屽嚮鎵撶畻瀵煎嚭鑷崇殑MyODBC鎴朚yODBC 3.51鏁版嵁婧愩傚叧浜庝负MyODBC鎴朚yODBC 3.51椹卞姩瀹氫箟鏂版暟鎹簮鐨勬柟娉曪紝璇峰弬瑙26.1.9.2鑺傦紝鈥滃湪Windows涓婇厤缃甅yODBC DSN鈥

4.    濡傛灉鎵閫夌殑鏁版嵁婧愯姹傜櫥褰曪紝璇疯緭鍏ョ櫥褰旾D鍜屽瘑鐮侊紙鍙兘杩橀渶瑕侀澶栦俊鎭級锛岀劧鍚庣偣鍑籓K銆

5.    Microsoft Access閫氳繃ODBC鏁版嵁婧愯繛鎺ュ埌MySQL鏈嶅姟鍣紝骞舵樉绀哄彲瀵煎叆鎴栭摼鎺ョ殑琛ㄦ竻鍗曘

6.    鐐瑰嚮甯屾湜瀵煎叆鎴栭摼鎺ョ殑姣忎釜琛紝鐒跺悗鐐瑰嚮OK銆傚鏋滀綘姝e湪閾炬帴1涓〃锛屼絾瀹冩病鏈夊敮涓璇嗗埆鍚勬潯璁板綍鐨勭储寮曪紝Microsoft Access灏嗘樉绀洪摼鎺ヨ〃涓殑瀛楁鍒楄〃銆傜偣鍑昏兘鍞竴鏍囪瘑鍚勮褰曠殑瀛楁鎴栧瓧娈电粍鍚堬紝鐒跺悗鐐瑰嚮OK銆

26.1.11.4. 閾炬帴琛ㄧ殑缁撴瀯鎴栦綅缃凡鏀瑰彉锛屾垜鑳界湅鍒伴摼鎺ヨ〃涓殑杩欎簺鍙樺寲鍚楋紵

鏄傚綋閾炬帴琛ㄧ殑缁撴瀯鎴栦綅缃彂鐢熷彉鍖栨椂锛屽彲閲囧彇涓嬭堪姝ラ鏌ョ湅鎴栧埛鏂伴摼鎺ャ傗滈摼鎺ヨ〃绠$悊鍣ㄢ濆垪鍑轰簡褰撳墠閾炬帴鐨勬墍鏈夎〃鐨勮矾寰勩

瑕佹兂鏌ョ湅鎴栧埛鏂伴摼鎺ワ細

1.    鎵撳紑鍖呭惈琛ㄩ摼鎺ョ殑鏁版嵁搴撱

2.    鍦ㄢ滃伐鍏封濊彍鍗曚笂锛屾寚鍚戔滃姞杞介」鈥濓紙鍦ˋccess 2000鎴栨洿鏂扮増鏈腑涓衡滄暟鎹簱瀹炵敤宸ュ叿鈥濓級锛岀劧鍚庣偣鍑烩滈摼鎺ヨ〃绠$悊鍣ㄢ濄

3.    閫変腑鎵撶畻鍒锋柊閾炬帴鐨勮〃鐨勫閫夋銆

4.    鐐瑰嚮OK锛屽埛鏂伴摼鎺ャ

Microsoft Access灏嗙‘璁ゆ垚鍔熺殑鍒锋柊鎿嶄綔锛屾垨鑰咃紝濡傛灉鏈壘鍒拌〃锛屽皢鏄剧ず鈥滈夋嫨<table name>鏂颁綅缃濆璇濇锛屽湪璇ュ璇濇涓紝鍙寚瀹氳〃鐨勬柊浣嶇疆銆傚鏋滀綘鎵閫夋嫨鐨勬暟涓〃宸茶绉昏嚦浣犳墍鎸囧畾鐨勬柊浣嶇疆锛岄摼鎺ヨ〃绠$悊鍣ㄥ皢閽堝鎵鏈夋墍閫夌殑琛ㄦ悳绱㈣浣嶇疆锛屽苟涓娆℃у湴鏇存柊鎵鏈夐摼鎺ャ

瑕佹兂鏇存敼閾炬帴琛ㄩ泦鍚堢殑璺緞锛

1.    鎵撳紑鍖呭惈琛ㄩ摼鎺ョ殑鏁版嵁搴撱

2.    鍦ㄢ滃伐鍏封濊彍鍗曚笂锛屾寚鍚戔滃姞杞介」鈥濓紙鍦ˋccess 2000鎴栨洿鏂扮増鏈腑涓衡滄暟鎹簱瀹炵敤宸ュ叿鈥濓級锛岀劧鍚庣偣鍑烩滈摼鎺ヨ〃绠$悊鍣ㄢ濄

3.    閫変腑鈥滃鏂颁綅缃缁堟彁绀衡濆閫夋銆

4.    閫変腑鎵撶畻鏇存敼閾炬帴鐨勮〃鐨勫閫夋锛岀劧鍚庣偣鍑籓K銆

5.    鍦ㄢ滈夋嫨<table name>鏂颁綅缃濆璇濇涓紝鎸囧畾鏂颁綅缃紝鐐瑰嚮鈥滄墦寮鈥濓紝鐒跺悗鐐瑰嚮OK銆

26.1.11.5. 褰撴垜鍦ㄩ摼鎺ヨ〃涓彃鍏ヨ褰曟垨鏇存柊鍏朵腑鐨勮褰曟椂锛岄亣鍒扳#DELETED#鈥

濡傛灉鍦ˋccess涓彃鍏ユ垨鏇存柊鐨勮褰曟樉绀轰负鈥#DELETED#鈥濓細

         濡傛灉浣犳鍦ㄤ娇鐢ˋccess 2000锛屽簲浠庝笅杩板湴鍧鑾峰彇骞跺畨瑁呮渶鏂扮殑锛2.6鐗堟垨鏇撮珮锛塎icrosoft MDAC锛Microsoft鏁版嵁璁块棶缁勪欢锛夛紝http://www.microsoft.com/data/銆傚畠鏇存浜咥ccess鍦ㄥ皢鏁版嵁瀵煎嚭鑷矼ySQL鏃跺瓨鍦ㄧ殑涓涓己闄凤紝鏈寚瀹氳〃鍚嶅拰鍒楀悕銆傚彟涓绉嶈В鍐宠缂洪櫡鐨勬柟娉曟槸锛屽崌绾у埌MyODBC 2.50.33鍜孧ySQL 3.23.x, 瀹冧滑鍏卞悓鎻愪緵浜嗛伩鍏嶈闂鐨勪竴绉嶆柟寮忋

姝ゅ锛屼綘杩樺簲鑾峰彇骞跺簲鐢∕icrosoft Jet 4.0 Service Pack 5 (SP5)锛屽彲鍦ㄤ笅杩板湴鍧鎵惧埌瀹冿細http://support.microsoft.com/default.aspx?scid=kb;EN-US;q239114銆傚畠淇浜嗘煇浜涙儏鍐典笅鍦ˋccess涓垪琚爣娉ㄤ负鈥#DELETED#鐨勯棶棰樸

娉ㄩ噴锛 濡傛灉浣犳浣跨敤MySQL 3.22锛屽繀椤诲畨瑁匨DAC琛ヤ竵锛屽苟浣跨敤MyODBC 2.50.32鎴2.50.34鎴栨洿楂樼増鏈互瑙e喅璇ラ棶棰樸

         瀵逛簬鎵鏈夌増鏈殑Access锛屽簲鍚敤鈥淢yODBC杩斿洖鍖归厤琛屸濋夐」銆傚浜嶢ccess 2.0锛岃繕搴旈澶栧惎鐢ㄢ妯℃嫙ODBC 1.0閫夐」

         鍦ㄥ笇鏈涜兘澶熸洿鏂扮殑鎵鏈夎〃涓紝鍧囧簲鏈夋椂闂存埑銆備负浜嗚幏寰楁渶澶х殑鍙Щ妞嶆э紝鍦ㄥ垪澹版槑涓笉瑕佷娇鐢ㄩ暱搴﹁鑼冦備篃灏辨槸璇达紝搴斾娇鐢TIMESTAMP锛岃屼笉鏄疶IMESTAMP(n), n < 14銆

         鍦ㄨ〃涓簲鏈1涓富閿傚涓嶇劧锛屾柊鐨勬垨鏇存柊鐨勮鍙兘浼氭樉绀轰负鈥#DELETED#鈥濄

         浠呭簲浣跨敤DOUBLE娴偣瀛楁銆涓庡崟绮惧害娴偣杩涜姣旇緝鏃讹紝Access灏嗗け璐ャ傚叾寰佸厗鏄柊鐨勬垨鏇存柊鐨勮鍙兘浼氭樉绀轰负鈥#DELETED#鈥濓紝鎴栨棤娉曟壘鍒版垨鏇存柊琛屻

         濡傛灉浣犳浣跨敤MyODBC鏉ラ摼鎺ュ埌鏈塀IGINT鍒楃殑琛紝缁撴灉浼氭樉绀轰负鈥#DELETED鈥濄傛帓闄ゅ畠鐨勮В鍐虫柟妗堟槸锛

o        鏈1涓互TIMESTAMP浣滀负鏁版嵁绫诲瀷鐨勮櫄鎷熷垪銆

o        鍦ㄢ淥DBC DSN绠$悊鍣ㄢ濈殑杩炴帴瀵硅瘽妗嗕腑閫夋嫨鈥滃皢BIGINT鍒楁洿鏀逛负INT鈥濋夐」銆

o        鍒犻櫎涓嶢ccess鐨勮〃閾炬帴锛屽苟閲嶆柊鍒涘缓瀹冦

鏃ц褰曚粛灏嗘樉绀轰负鈥#DELETED#鈥濓紝浣嗘柊澧烇紡鏇存柊鐨勮褰曚細鎭板綋鏄剧ず銆

26.1.11.6. 濡備綍澶勭悊鍐欏啿绐佹垨琛屼綅缃敊璇紵

濡傛灉鐪嬪埌涓嬭堪閿欒锛岃鍦ㄢ淒SN閰嶇疆鈥濆璇濇涓夋嫨鈥滆繑鍥炲尮閰嶈鈥濋夐」锛屾垨灏嗚繛鎺ュ弬鏁版寚瀹氫负鈥OPTION=2
鍐欏啿绐併傚彟涓鐢ㄦ埛鏇存敼浜嗕綘鐨勬暟鎹
 
鏃犳硶鎵惧埌闇鏇存柊琛岀殑浣嶇疆銆傝嚜涓婃璇诲彇鎿嶄綔浠ユ潵锛屾煇浜涘煎彲鑳藉凡琚敼鍙樸

26.1.11.7. 鏃犺浣曟椂锛屽綋鎴戜粠Access 97瀵煎嚭琛ㄦ椂锛屽嚭鐜伴檶鐢熺殑璇硶閿欒

瀵逛簬Access 97锛岃繖鏄欢濂囨殑浜嬪疁锛屼絾鍦ˋccess 2000鎴2002涓苟鏈嚭鐜般傚皢MyODBC鍗囩骇鑷矼yODBC 3.51.02鎴栦互涓婏紝鍙互鍏嬫湇璇ラ棶棰樸

26.1.11.8. 缂栬緫璁板綍鏃讹紝Access杩斿洖鈥滃彟涓鐢ㄦ埛鏇存敼浜嗕綘淇敼鐨勮褰曗

瀵逛簬鏌愪簺绋嬪簭锛屽彲鑳戒細鍑虹幇璇ラ敊璇細 鍙︿竴鐢ㄦ埛鏇存敼浜嗕綘鎵淇敼鐨勮褰曘傚湪澶у鏁版儏鍐典笅锛屽彲閫氳繃涓嬭堪鎺柦瑙e喅璇ラ棶棰橈細

         濡傛灉涓婚敭涓嶅瓨鍦紝涓鸿〃娣诲姞1涓富閿

         濡傛灉鏃堕棿鎴充笉瀛樺湪锛屾坊鍔1涓椂闂存埑鍒椼

         浠呭簲浣跨敤DOUBLE娴偣瀛楁銆涓庡崟绮惧害娴偣鍊兼瘮杈冩椂锛屾煇浜涚▼搴忎細鍑洪敊銆

濡傛灉杩欎簺鎺柦鏈兘瑙e喅闂锛岄鍏堝簲浠嶰DBC绠$悊鍣ㄧ敓鎴1涓棩蹇楁枃浠讹紙璇锋眰鏉ヨ嚜ODBC ADMIN鐨勬棩蹇楁椂鑾峰緱鐨勬棩蹇楁枃浠讹級锛屼互鍙1涓狹yODBC鏃ュ織锛屼娇鐢ㄥ畠浠壘鍑哄嚭閿欑殑鍘熷洜銆傚叿浣撲粙缁嶏紝璇峰弬瑙26.1.9.7鑺傦紝鈥滆幏鍙朞DBC璺熻釜鏂囦欢鈥

26.1.11.9. 濡備綍鍦ˋccess涓繕鑾稯DBC鐧诲綍閿欒娑堟伅锛

璇烽槄璇烩滃浣曞湪Access涓繕鑾稯DBC鐧诲綍閿欒娑堟伅鈥濓紝http://support.microsoft.com/support/kb/articles/Q124/9/01.asp?LN=EN-US&SD=gn&FR=0%3CP%3E

26.1.11.10. 濡備綍浼樺寲Access涓嶮yODBC涓璧峰伐浣滅殑鎬ц兘锛

26.1.11.11. 鎴戞湁寰堥暱鐨勮〃锛孧yODBC璁块棶杩欎簺Access琛ㄧ殑鏈浣抽厤缃槸浠涔堬紵

濡傛灉鍦ˋccess涓湁寰堝ぇ锛堥暱锛夌殑琛紝鍙兘闇瑕佺浉褰撻暱鐨勬椂闂存墠鑳芥墦寮銆傛垨鑰咃紝涔熷彲鑳芥槸铏氭嫙鍐呭瓨杈冧綆鐨勬儏鍐典笅杩愯锛屾渶缁堝鑷碠DBC鏌ヨ澶辫触閿欒锛屽苟鏃犳硶鎵撳紑琛ㄣ備负浜嗚В鍐宠闂锛屽彲閫夋嫨涓嬭堪閫夐」锛

         杩斿洖鍖归厤琛岋紙2锛

         鍏佽BIG缁撴灉锛8锛

杩欐牱鍙皢鍊煎鍔犲埌10锛OPTION=10锛夈

26.1.11.12. 濡備綍涓篛DBC杩炴帴璁剧疆QueryTimeout鍊硷紵

璇峰弬闃呪滀负ODBC杩炴帴璁剧疆QueryTimeout鍊尖濓紝http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3B153756

26.1.11.13. INFO锛氱敤浜嶢ccess鍜孧ySQL闂村鍏/瀵煎嚭鐨勫伐鍏

鍏充簬鍙敤宸ュ叿鍒楄〃锛岃鍙傞槄杞崲鍣涓鑺傘

26.1.12. MyODBC鍜孧icrosoft VBA鍙夾SP

鍦ㄦ湰鑺備腑锛屽洖绛斾簡涓嶮icrosoft Visual Basic(ADO, DAO & RDO)鍜孉SP涓璧蜂娇鐢∕yODBC鏈夊叧鐨勯棶棰樸

26.1.12.1. 涓轰粈涔圫ELECT COUNT(*) FROM tbl_name杩斿洖閿欒锛

杩欐槸鍥犱负COUNT(*)琛ㄨ揪寮忚繑鍥炰簡1涓BIGINT锛ADO涓嶇悊瑙h繖涓ぇ鍊肩殑鍚箟銆傞夋嫨鈥滃皢BIGINT鍒楁洿鏀逛负INT閫夐」锛閫夐」鍊16384锛夈

26.1.12.2. 鏃犺浣曟椂锛屽綋鎴戜娇鐢ˋppendChunk()鎴朑etChunk() ADO鏂规硶鏃讹紝閬囧埌閿欒鈥滃姝ユ搷浣滃鑷撮敊璇紝璇锋鏌ユ瘡涓姸鎬佸尖

灏嗗厜鏍囦綅缃寚瀹氫负adUseServer鏃讹紝ADO鐨GetChunk()AppendChunk()鏂规硶涓嶈兘鎸夐鏈熺殑鏂瑰紡宸ヤ綔銆備粠鍙︿竴鏂归潰涓婅锛屽彲浣跨敤adUseClient鍏嬫湇璇ラ棶棰樸

http://www.dwam.net/iishelp/ado/docs/adomth02_4.htm涓婄粰鍑轰簡涓涓畝鍗曠ず渚嬨

26.1.12.3. 鍦ˋDO涓浣曞彂鐜板彈鐗瑰畾SQL璇彞褰卞搷鐨勬昏鏁帮紵

鍦ˋDO鎵ц鏂规硶涓娇鐢RecordsAffected灞炴с鍏充簬浣跨敤鎵ц鏂规硶鐨勬洿澶氫俊鎭紝璇峰弬瑙http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ado270/htm/mdmthcnnexecute.asp

26.1.12.4. 鍦╒isual Basic涓浣曞鐞咮lob鏁版嵁锛

涓嬮潰缁欏嚭浜哅ike Hillyer锛m.hillyer@telusplanet.net锛夊啓鐨勪竴绡囧ソ鏂囩珷锛屽叾涓В閲婁簡濡備綍鍦ˋDO涓氳繃MyODBC鎻掑叆鏁版嵁鍜岋紡鎴栦粠Blob鍒楄幏鍙栨暟鎹殑鏂规硶銆MySQL BLOB鍒楀拰Visual Basic 6

26.1.12.5. 濡備綍灏哣isual Basic鐨勬暟鎹被鍨嬫槧灏勫埌MySQL绫诲瀷锛

涓嬮潰缁欏嚭浜哅ike Hillyer锛m.hillyer@telusplanet.net锛夌殑鍙︿竴绡囧ソ鏂囩珷銆濡備綍灏哣isual basic鏁版嵁绫诲瀷鏄犲皠涓篗ySQL绫诲瀷

26.1.12.6. 绀轰緥锛歏B涓嶢DO銆丏AO鍜孯DO

涓嬮潰缁欏嚭浜咥DO銆丏AO鍜孯DO涓嶸B涓璧蜂娇鐢ㄧ殑鐢ㄦ硶绀轰緥锛

         ADO绀轰緥锛 26.1.19鑺傦紝鈥淢yODBC涓嶸B锛欰DO銆丏AO鍜孯DO鈥

         DAO绀轰緥锛 26.1.19鑺傦紝鈥淢yODBC涓嶸B锛欰DO銆丏AO鍜孯DO鈥

         RDO绀轰緥锛 26.1.19鑺傦紝鈥淢yODBC涓嶸B锛欰DO銆丏AO鍜孯DO鈥

濡傛灉浣犳湁鍏朵粬濂界殑渚嬪瓙锛屾垨鍏充簬ADO/DAO/RDO鐨勫熀鏈煡璇嗭紝璇峰皢璇︽儏鍙戦佽嚦myodbc@lists.mysql.com

26.1.12.7. ASP鍜孧ySQL浠ュ強MyODBC

鍏充簬濡備綍浣跨敤MyODBC閫氳繃ASP璁块棶MySQL鐨勬洿澶氫俊鎭紝璇峰弬闃呬笅杩版枃绔狅細

         浣跨敤MyODBC閫氳繃ASP璁块棶浣犵殑MySQL鏁版嵁搴

         ASP and MySQL at DWAM.NT

http://support.microsoft.com/default.aspx?scid=/Support/ActiveServer/faq/data/adofaq.asp涓紝缁欏嚭浜嗗叧浜嶢SP鐨勫父瑙侀棶棰樻竻鍗曘

26.1.12.8. INFO锛氬叧浜嶢ctiveX鏁版嵁瀵硅薄锛圓DO锛夌殑甯歌闂

鏇村淇℃伅锛岃鍙傝ActiveX鏁版嵁瀵硅薄锛圓DO锛夊父瑙侀棶棰

26.1.13. MyODBC鍜岀涓夋柟ODBC宸ュ叿

鍦ㄦ湰鑺備腑锛屽洖绛斾簡涓嶮yODBC鍜屽悇绉峅DBC鐩稿叧宸ュ叿鏈夊叧鐨勯棶棰橈紝濡侻icrosoft Word銆丒xcel鍜孋oldFusion銆

26.1.13.1. 濡備綍灏嗘暟鎹粠MySQL鎻愬彇鍒癕S-Word/Excel鏂囨。锛

瑕佹兂灏嗘暟鎹粠MySQL鎻愬彇鍒癢ord/Excel鏂囨。锛岄渶瑕佷娇鐢∕yODBC椹卞姩绋嬪簭浠ュ強鈥淢icrosoft鏌ヨ甯姪鈥濇彃浠躲

渚嬪锛岀敤鍚湁涓ゅ垪鏂囨湰鐨勮〃鍒涘缓1涓暟鎹簱锛

         浣跨敤mysql瀹㈡埛绔鍛戒护琛屽伐鍏锋彃鍏ヨ銆

         浣跨敤ODBC绠$悊鍣ㄥ垱寤1涓狣SN鏂囦欢锛屼緥濡傦紝閽堝鍒氬垱寤烘暟鎹簱鐨勨渕y鈥濄

         鎵撳紑Word搴旂敤绋嬪簭銆

         鍒涘缓1涓柊鐨勭┖鐧芥枃妗c

         鍦ㄦ暟鎹簱宸ュ叿鏍忎笂锛屾寜鈥滄彃鍏ユ暟鎹簱鈥濇寜閽

         鎸夆滆幏鍙栨暟鎹濇寜閽

         鍦ㄢ滆幏鍙栨暟鎹濆睆骞曞彸渚э紝鎸夆Ms Query鈥濇寜閽

         鍦ㄢMs Query鈥濅腑浣跨敤鈥my DSN鈥濇枃浠跺垱寤1涓柊鏁版嵁婧愩

         閫夋嫨鏂版煡璇€

         閫夋嫨鎵撶畻浣跨敤鐨勫垪銆

         濡傛灉鎰挎剰锛屽垱寤1涓繃婊ゅ櫒銆

         濡傛灉鎰挎剰锛屽垱寤1涓垎绫汇

         閫夋嫨鈥滃皢鏁版嵁杩斿洖鍒Microsoft Word鈥濄

         鐐瑰嚮鈥滃畬鎴愨濄

         鐐瑰嚮鈥滄彃鍏ユ暟鎹濆苟閫夋嫨璁板綍銆

         鐐瑰嚮OK锛屽湪浣犵殑Word鏂囨。涓皢鐪嬪埌鎻掑叆鐨勮銆

26.1.13.2. 浣跨敤MyODBC灏嗚〃浠嶮S DTS瀵煎嚭鍒癕ySQL鏃跺嚭鐜拌娉曢敊璇

杩欎笌褰撹〃鐢盩EXT鎴朧ARCHAR鏁版嵁绫诲瀷鏋勬垚鏃禔ccess 97閬囧埌鐨勯棶棰樼被浼笺傞氳繃灏哅yODBC椹卞姩鍗囩骇鍒3.51.02鎴栨洿楂樼増鏈紝鍗冲彲鎺掗櫎璇ラ敊璇

26.1.13.3.聽濡備綍鍦⊿olaris骞冲彴涓婇厤缃甅ySQL+MyODBC+unixODBC+ColdFusion

璇峰弬瑙MySQL ColdFusion unixODBC MyODBC鍜孲olaris锛氬浣曟垚鍔

26.1.14. MyODBC閫氱敤鍔熻兘

鍦ㄦ湰鑺備腑锛屽洖绛斾簡涓嶮yODBC涓鑸姛鑳芥湁鍏崇殑闂銆

26.1.14.1. 濡備綍鍦∣DBC涓幏鍙朅UTO_INCREMENT鍒楃殑鍊

涓涓父瑙侀棶棰樻槸锛屽浣曡幏鍙栦粠INSERT璇彞鑷姩鐢熸垚鐨処D鐨勫笺備娇鐢∣DBC锛屼綘鍙互浣滀笌浠ヤ笅绀轰緥绫讳技鐨勪换浣曚簨锛堝亣瀹氣渁uto鈥濅负AUTO_INCREMENT瀛楁锛夛細

INSERT INTO tbl (auto,text) VALUES(NULL,'text');
SELECT LAST_INSERT_ID();

鎴栬咃紝濡傛灉浣犱粎鎵撶畻灏咺D鎻掑叆鍒板彟涓琛ㄤ腑锛屼綘鍙互锛

INSERT INTO tbl (auto,text) VALUES(NULL,'text');
INSERT INTO tbl2 (id,text) VALUES(LAST_INSERT_ID(),'text');

璇峰弬瑙25.2.13.3鑺傦紝鈥滃浣曡幏寰椾笂娆℃彃鍏ヨ鐨勫敮涓ID鈥

涓轰簡浣挎煇浜汷DBC搴旂敤绋嬪簭锛堣嚦灏戞槸Delphi鍜孉ccess锛夎幏寰楁洿濂界殑鎬ц兘锛屽彲浣跨敤涓嬭堪鏌ヨ鏉ユ壘鍒版柊鎻掑叆鐨勮锛

SELECT * FROM tbl WHERE auto IS NULL;

26.1.14.2. MyODBC鏀寔鍔ㄦ佸厜鏍囩被鍨嬪悧锛

鏄侻yODBC 3.51鏀寔鍔ㄦ佸厜鏍囩被鍨嬩互鍙婃鍚戝拰闈欐佺壒鎬с

鐢变簬鎬ц兘鏂归潰鐨勫師鍥狅紝鍦ㄩ粯璁ゆ儏鍐典笅锛岄┍鍔ㄧ▼搴忎笉鏀寔璇ョ壒鎬с備綘鍙互鍚敤璇ョ壒鎬э紝鏂规硶鏄紝灏嗚繛鎺ラ夐」鏍囧織鎸囧畾涓衡OPTION=32锛屾垨鍦DSN閰嶇疆涓変腑鈥滃惎鐢ㄥ姩鎬佸厜鏍団濋夐」銆

26.1.14.3. 瀵艰嚧浜嬪姟鏃犳硶鍚敤閿欒鐨勫師鍥犳槸浠涔堬紵

褰撳簲鐢ㄧ▼搴忓彂鍑轰簨鍔¤皟鐢紝浣嗗簳灞侻ySQL鏈嶅姟鍣ㄤ笉鏀寔浜嬪姟鎴栫姝簨鍔℃椂锛岄┍鍔ㄧ▼搴忓皢杩斿洖璇ラ敊璇

涓轰簡閬垮厤璇ラ棶棰橈紝蹇呴』浣跨敤鍚敤浜InnoDBBDB瀛樺偍寮曟搸锛堟垨涓よ咃級鐨勬湇鍔″櫒锛屽苟浣跨敤杩欑被琛ㄣ浠4.0鐗堜互鍚庯紝榛樿鎯呭喌涓嬶紝MySQL鏈嶅姟鍣ㄥ潎鏀寔InnoDB銆傚湪BDB鍙敤鐨勫钩鍙颁笂锛孧ySQL-Max鏈嶅姟鍣ㄤ篃鏀寔BDB

姝ゅ锛屽鏋滀綘鐨勬湇鍔″櫒鏀寔浜嬪姟琛ㄧ被鍨嬶紙InnoDB鍜孊DB锛夛紝璇风‘淇濆湪DSN閰嶇疆涓湭璁剧疆鈥滅姝簨鍔♀濋夐」銆

26.1.14.4. 瀵艰嚧鏃犳硶鎵惧埌鍏夋爣閿欒鐨勫師鍥犳槸浠涔堬紵

杩欐槸鍥犱负搴旂敤绋嬪簭姝e湪浣跨敤鏃х殑MyODBC 2.50鐗堟湰锛屼笉鑳介氳繃SQLSetCursorName鏄庣‘璁剧疆鍏夋爣鍚嶇О銆傛洿姝e畠鐨勬柟娉曟槸鍗囩骇鍒癕yODBC 3.51鐗堛

26.1.14.5. 鎴戣兘涓嶮yODBC 3.51涓璧蜂娇鐢∕yODBC 2.50搴旂敤绋嬪簭鍚楋紵

鏄傚鏋滀綘鍙戠幇涓嶈兘涓嶮yODBC 3.51涓璧峰伐浣滐紝浣嗚兘涓嶮yODBC 2.50涓璧峰伐浣滅殑浠讳綍浜嬮」锛岃鍙戦佺數瀛愰偖浠惰嚦myodbc@lists.mysql.com

26.1.14.6. 鎴戣兘浣跨敤MyODBC浠.NET鐜璁块棶MySQL鍚楋紵

鏄備綘鍙互浣跨敤odbc.net锛岄氳繃MyODBC杩炴帴鍒癕ySQL銆傝繖閲岀粰鍑轰簡涓浜涗粠VC.NET鍜孷B.NET杩炴帴鍒癕ySQL鐨勫熀鏈ず渚嬨

         璇峰弬瑙26.1.20.1鑺傦紝鈥淥DBC.NET: CSHARP(C#)鈥

         璇峰弬瑙26.1.20.2鑺傦紝鈥淥DBC.NET: VB鈥

杩欓噷缁欏嚭浜Venu锛圡yODBC寮鍙戜汉鍛橈級鎾板啓鐨勫彟涓绡囧ソ鏂囩珷鐮旂┒.NET鐜涓嬬殑MySQL锛屽叾涓紝缁欏嚭浜嗘墍鏈夌殑MySQL .NET鎺ュ彛浠ュ強涓浜涙湁鐢ㄧ殑渚嬪瓙銆

娉ㄦ剰锛 鍦ㄤ笌MyODBC涓璧蜂娇鐢∣DBC.NET鐨勮繃绋嬩腑锛屽湪鑾峰彇绌哄瓧绗︿覆鐨勫悓鏃讹紙闀垮害涓0锛夛紝灏嗙粰鍑篠QL_NO_DATA寮傚父銆備粠绔欑偣http://support.microsoft.com/default.aspx?scid=kb;EN-US;q319243锛屽彲鑾峰彇閽堝瀹冪殑琛ヤ竵銆

26.1.14.7. MyODBC鐨勬ц兘涓轰粈涔堝緢宸紝瀵逛簬鐩稿杈冨皬鐨勬煡璇篃浼氬鑷村ぇ閲忕殑纾佺洏鍔ㄤ綔锛

MyODBC姣斿叾浠朞DBC椹卞姩绋嬪簭蹇緢澶氥傜紦鎱㈠彲鑳芥槸鍥犳湭浣跨敤涓嬭堪閫夐」閫犳垚鐨勶細

         鎵撳紑鈥淥DBC璺熻釜鈥濋夐」銆傞伒寰杩欓噷缁欏嚭鐨勬寚绀鸿鏄庯紝浜ゅ弶妫鏌ユ槸鍚︽湭鍚敤璇ラ夐」銆

ODBC Tracing
              Tab

濡備笂鍥炬墍绀猴紝鈥淥DBC鏁版嵁婧愮鐞嗗櫒鈥濃滆窡韪濋夐」鍗$殑鈥滀綍鏃惰窡韪濋夐」搴斿缁堟寚鍚戔滅幇鍦ㄥ紑濮嬭窡韪濓紝鑰屼笉鏄滅幇鍦ㄥ仠姝㈣窡韪濄

         浣跨敤浜嗛┍鍔ㄧ▼搴忕殑璋冭瘯鐗堟湰銆傚鏋滀綘姝e湪浣跨敤椹卞姩DLL鐨勮皟璇曠増鏈紝涔熶細浣挎煡璇㈠鐞嗗彉鎱€備綘鍙互鎵ц浜ゅ弶妫鏌ワ紝閫氳繃椹卞姩DLL灞炴э紙鍦ㄧ郴缁熺洰褰曚笅锛屽彸鍑婚┍鍔―LL骞剁偣鍑烩滃睘鎬р濓級鐨勨滄敞閲娾濆尯锛屾鏌LL鏄惁鏄皟璇曠増鎴栧彂甯冪増锛屽涓嬪浘鎵绀猴細

DLL Properties Dialog

         鍚敤浜嗏滈┍鍔ㄨ窡韪拰鏌ヨ鏃ュ織鈥濄傚嵆浣夸綘鎵撶畻浣跨敤椹卞姩绋嬪簭鐨勮皟璇曠増锛堝湪鐢熶骇鐜涓嬫诲簲浣跨敤鍙戝竷鐗堬級锛屼篃搴旂‘淇濈姝簡鈥滈┍鍔ㄨ窡韪拰鏌ヨ鏃ュ織鈥濋夐」锛圤PTION=4,524288锛夛紝濡備笅鍥炬墍绀猴細

MyODBC Options Dialog

26.1.15. 鍩烘湰鐨凪yODBC搴旂敤姝ラ

浠嶮yODBC搴旂敤绋嬪簭鎵ц鐨勪笌MySQL鏈嶅姟鍣ㄧ殑浜や簰鍖呭惈浠ヤ笅鎿嶄綔锛

         閰嶇疆MyODBC DSN銆

         杩炴帴鍒癕ySQL鏈嶅姟鍣ㄣ

         鍒濆鍖栨搷浣溿

         鎵цSQL璇彞銆

         妫绱㈢粨鏋溿

         鎵ц浜嬪姟銆

         鏂紑涓庢湇鍔″櫒鐨勮繛鎺ャ

澶у鏁板簲鐢ㄧ▼搴忓潎浣跨敤浜嗚繖浜涙楠ょ殑鏌愪簺鍙樹綋銆傚湪涓嬪浘涓紝缁欏嚭浜嗗熀鏈殑搴旂敤姝ラ锛

MyODBC Programming Flowchart

26.1.16. MyODBC API寮曠敤

鍦ㄦ湰鑺備腑锛屾瑕佷粙缁嶄簡鎸夊姛鑳藉垎绫荤殑ODBC瀛愮▼搴忋

鍏充簬鍏ㄩ儴ODBC API鍙傝冿紝璇峰弬瑙丱DBC绋嬪簭鍛樺弬鑰冿紝http://msdn.microsoft.com/library/en-us/odbc/htm/odbcabout_this_manual.asp

搴旂敤绋嬪簭鍙互璋冪敤SQLGetInfo鍑芥暟鏉ヨ幏寰楀叧浜MyODBC鐨勪竴鑷存т俊鎭備负浜嗚幏寰楅┍鍔ㄧ▼搴忓鐗瑰畾鍑芥暟鐨勬敮鎸佷俊鎭紝搴旂敤绋嬪簭鍙皟鐢SQLGetFunctions

娉ㄩ噴锛 涓轰簡鍚戝悗鍏煎锛孧yODBC 3.51椹卞姩绋嬪簭鏀寔鎵鏈夊凡涓嶄娇鐢ㄧ殑鍑芥暟銆

鍦ㄤ笅闈㈢殑琛ㄥ悇涓紝鎸変换鍔″垎缁勫垪鍑轰簡MyODBC API璋冪敤锛

杩炴帴鍒版暟鎹簮锛

鍑芥暟鍚

MyODBC

MyODBC

涓鑷存

鐩殑

 

2.50

3.51

 

 

SQLAllocHandle

No

Yes

ISO 92

鑾峰彇鐜銆佽繛鎺ャ佽鍙ユ垨鎻忚堪绗﹀彞鏌勩

SQLConnect

Yes

Yes

ISO 92

鎸夋暟鎹簮鍚嶃佺敤鎴稩D鍜屽瘑鐮佽繛鎺ュ埌鐗瑰畾椹卞姩绋嬪簭銆

SQLDriverConnect

Yes

Yes

ODBC

閫氳繃杩炴帴瀛楃涓诧紝鎴栭┍鍔ㄧ鐞嗗櫒鍜岄┍鍔ㄦ樉绀哄璇濇鍙戝嚭鐨勮姹傦紝杩炴帴鍒扮壒瀹氶┍鍔ㄧ▼搴忋

SQLAllocEnv

Yes

Yes

Deprecated

鑾峰緱椹卞姩绋嬪簭鍒嗛厤鐨勭幆澧冨彞鏌勩

SQLAllocConnect

Yes

Yes

Deprecated

鑾峰彇杩炴帴鍙ユ焺銆

鑾峰彇鍏充簬椹卞姩绋嬪簭鍜屾暟鎹簮鐨勪俊鎭細

鍑芥暟鍚

MyODBC

MyODBC

涓鑷存

鐩殑

 

2.50

3.51

 

 

SQLDataSources

No

No

ISO 92

杩斿洖鍙敤鏁版嵁婧愮殑鍒楄〃锛岀敱椹卞姩绠$悊鍣ㄥ鐞嗐

SQLDrivers

No

No

ODBC

杩斿洖宸插畨瑁呴┍鍔ㄧ▼搴忓拰鍣ㄥ睘鎬х殑鍒楄〃锛岀敱椹卞姩绠$悊鍣ㄥ鐞嗐

SQLGetInfo

Yes

Yes

ISO 92

杩斿洖鍏充簬鐗瑰畾椹卞姩绋嬪簭鍜屾暟鎹簮鐨勪俊鎭

SQLGetFunctions

Yes

Yes

ISO 92

杩斿洖鏀寔鐨勯┍鍔ㄥ嚱鏁般

SQLGetTypeInfo

Yes

Yes

ISO 92

杩斿洖鍏充簬鎵鏀寔鏁版嵁绫诲瀷鐨勪俊鎭

璁剧疆骞舵绱㈤┍鍔ㄥ睘鎬э細

鍑芥暟鍚

MyODBC

MyODBC

涓鑷存

鐩殑

 

2.50

3.51

 

 

SQLSetConnectAttr

No

Yes

ISO 92

璁剧疆杩炴帴灞炴с

SQLGetConnectAttr

No

Yes

ISO 92

杩斿洖杩炴帴灞炴х殑鍊笺

SQLSetConnectOption

Yes

Yes

Deprecated

璁剧疆杩炴帴閫夐」銆

SQLGetConnectOption

Yes

Yes

Deprecated

杩斿洖杩炴帴閫夐」鐨勫笺

SQLSetEnvAttr

No

Yes

ISO 92

璁剧疆鐜灞炴с

SQLGetEnvAttr

No

Yes

ISO 92

杩斿洖鐜灞炴х殑鍊笺

SQLSetStmtAttr

No

Yes

ISO 92

璁剧疆璇彞灞炴с

SQLGetStmtAttr

No

Yes

ISO 92

杩斿洖璇彞灞炴х殑鍊笺

SQLSetStmtOption

Yes

Yes

Deprecated

璁剧疆璇彞閫夐」銆

SQLGetStmtOption

Yes

Yes

Deprecated

杩斿洖璇彞閫夐」鐨勫笺

鍑嗗SQL璇锋眰锛

鍑芥暟鍚

MyODBC

MyODBC

涓鑷存

鐩殑

 

2.50

3.51

 

 

SQLAllocStmt

Yes

Yes

Deprecated

鍒嗛厤璇彞鍙ユ焺銆

SQLPrepare

Yes

Yes

ISO 92

鍑嗗闅忓悗鎵ц鐨凷QL璇彞銆

SQLBindParameter

Yes

Yes

ODBC

涓篠QL璇彞涓殑鍙傛暟鍒嗛厤瀛樺偍鍣ㄣ

SQLGetCursorName

Yes

Yes

ISO 92

杩斿洖涓庤鍙ュ彞鏌勭浉鍏崇殑鍏夋爣鍚嶃

SQLSetCursorName

Yes

Yes

ISO 92

鎸囧畾鍏夋爣鍚嶃

SQLSetScrollOptions

Yes

Yes

ODBC

璁剧疆鎺у埗鍏夋爣琛屼负鐨勯夐」銆

鎻愪氦璇锋眰锛

鍑芥暟鍚

MyODBC

MyODBC

涓鑷存

鐩殑

 

2.50

3.51

 

 

SQLExecute

Yes

Yes

ISO 92

鎵ц鍑嗗濂界殑璇彞銆

SQLExecDirect

Yes

Yes

ISO 92

鎵ц璇彞銆

SQLNativeSql

Yes

Yes

ODBC

杩斿洖鐢遍┍鍔ㄧ▼搴忕炕璇戠殑SQL璇彞鐨勬枃鏈

SQLDescribeParam

Yes

Yes

ODBC

杩斿洖璇彞涓壒瀹氬弬鏁扮殑鎻忚堪銆

SQLNumParams

Yes

Yes

ISO 92

杩斿洖璇彞涓殑鍙傛暟鏁扮洰銆

SQLParamData

Yes

Yes

ISO 92

SQLPutData涓璧蜂娇鐢紝浠ヤ究鍦ㄦ墽琛屾椂鎻愪緵鍙傛暟銆傦紙瀵逛簬闀挎暟鎹煎緢鏈夌敤锛夈

SQLPutData

Yes

Yes

ISO 92

鍙戦佹煇涓鍙傛暟鏁版嵁鍊肩殑閮ㄥ垎鎴栧叏閮ㄣ傦紙瀵逛簬闀挎暟鎹煎緢鏈夌敤锛夈

妫绱㈢粨鏋滀互鍙婂叧浜庣粨鏋滅殑淇℃伅锛

鍑芥暟鍚

MyODBC

MyODBC

涓鑷存

鐩殑

 

2.50

3.51

 

 

SQLRowCount

Yes

Yes

ISO 92

杩斿洖鎻掑叆銆佹洿鏂版垨鍒犻櫎璇锋眰褰卞搷鐨勮鏁般

SQLNumResultCols

Yes

Yes

ISO 92

杩斿洖缁撴灉闆嗕腑鐨勫垪鏁般

SQLDescribeCol

Yes

Yes

ISO 92

鎻忚堪缁撴灉闆嗕腑鐨勫垪銆

SQLColAttribute

No

Yes

ISO 92

鎻忚堪缁撴灉闆嗕腑鐨勬煇1鍒楃殑灞炴с

SQLColAttributes

Yes

Yes

Deprecated

鎻忚堪缁撴灉闆嗕腑鐨勬煇1鍒楃殑澶氫釜灞炴с

SQLFetch

Yes

Yes

ISO 92

杩斿洖澶氫釜缁撴灉琛屻

SQLFetchScroll

No

Yes

ISO 92

杩斿洖鍙粴鍔ㄧ粨鏋滆銆

SQLExtendedFetch

Yes

Yes

Deprecated

杩斿洖鍙粴鍔ㄧ粨鏋滆銆

SQLSetPos

Yes

Yes

ODBC

灏嗗厜鏍囧畾涓哄湪鑾峰彇鐨勬暟鎹潡涓紝鍏佽搴旂敤绋嬪簭鏇存柊琛岄泦鍚堜腑鐨勬暟鎹紝鎴栨洿鏂版垨鍒犻櫎缁撴灉闆嗕腑鐨勬暟鎹

SQLBulkOperations

No

Yes

ODBC

鎵ц鎵归噺鎻掑叆鍜屾壒閲忎功绛炬搷浣滐紝鍖呮嫭鏇存柊銆佸垹闄ゅ拰鎸変功绛捐幏鍙栥

妫绱㈤敊璇拰璇婃柇淇℃伅锛

鍑芥暟鍚

MyODBC

MyODBC

涓鑷存

鐩殑

 

2.50

3.51

 

 

SQLError

Yes

Yes

Deprecated

杩斿洖棰濆鐨勯敊璇垨鐘舵佷俊鎭

SQLGetDiagField

Yes

Yes

ISO 92

杩斿洖棰濆鐨勮瘖鏂俊鎭紙璇婃柇鎬ф暟鎹粨鏋勭殑鍗曚釜瀛楁锛夈

SQLGetDiagRec

Yes

Yes

ISO 92

杩斿洖棰濆鐨勮瘖鏂俊鎭紙璇婃柇鎬ф暟鎹粨鏋勭殑澶氫釜瀛楁锛夈

鑾峰彇鍏充簬鏁版嵁婧愮殑绯荤粺琛紙鐩綍鍑芥暟锛夋潯鐩殑淇℃伅锛

鍑芥暟鍚

MyODBC

MyODBC

涓鑷存

鐩殑

 

2.50

3.51

 

 

SQLColumnPrivileges

Yes

Yes

ODBC

杩斿洖鍏充簬涓涓垨澶氫釜琛ㄧ殑鍒楀拰鐩稿叧灞炴х殑鍒楄〃銆

SQLColumns

Yes

Yes

X/Open

杩斿洖鎸囧畾琛ㄤ腑鍒楀悕鐨勫垪琛ㄣ

SQLForeignKeys

Yes

Yes

ODBC

鍦ㄦ寚瀹氳〃涓鏋滃瓨鍦ㄥ閿紝杩斿洖鏋勬垚澶栭敭鐨勫垪鍚嶅垪琛ㄣ

SQLPrimaryKeys

Yes

Yes

ODBC

杩斿洖鏋勬垚鏌1琛ㄧ殑涓婚敭鐨勫垪鍚嶅垪琛ㄣ

SQLSpecialColumns

Yes

Yes

X/Open

杩斿洖鍏充簬鏈浣冲垪闆嗗悎鐨勪俊鎭紝璇ュ垪闆嗗悎鍞竴鍦版寚鏄庝簡鎸囧畾琛ㄤ腑鐨勮锛屾垨褰撴煇1浜嬪姟鏇存柊浜嗚涓殑浠讳綍鍊兼椂鑷姩鏇存柊鐨勫垪銆

SQLStatistics

Yes

Yes

ISO 92

杩斿洖鍏充簬鍗曚釜琛ㄧ殑缁熻淇℃伅锛屼互鍙婁笌琛ㄧ浉鍏崇殑绱㈠紩鍒楄〃銆

SQLTablePrivileges

Yes

Yes

ODBC

杩斿洖琛ㄥ垪琛紝浠ュ強涓庡悇琛ㄧ浉鍏崇殑鏉冮檺銆

SQLTables

Yes

Yes

X/Open

杩斿洖瀛樺偍鍦ㄧ壒瀹氭暟鎹簮鍐呯殑琛ㄥ悕鍒楄〃銆

鎵ц浜嬪姟锛

鍑芥暟鍚

MyODBC

MyODBC

涓鑷存

鐩殑

 

2.50

3.51

 

 

SQLTransact

Yes

Yes

Deprecated

鎻愪氦鎴栧洖婊氫簨鍔°

SQLEndTran

No

Yes

ISO 92

鎻愪氦鎴栧洖婊氫簨鍔°

涓璇彞锛

鍑芥暟鍚

MyODBC

MyODBC

涓鑷存

鐩殑

 

2.50

3.51

 

 

SQLFreeStmt

Yes

Yes

ISO 92

缁撴潫璇彞澶勭悊锛岃垗寮冩湭鍐崇粨鏋滐紝骞堕噴鏀句笌璇彞鍙ユ焺鐩稿叧鐨勬墍鏈夎祫婧愶紙鍙夛級銆

SQLCloseCursor

Yes

Yes

ISO 92

鍏抽棴鍦ㄨ鍙ュ彞鏌勪笂鎵撳紑鐨勬寚閽堛

SQLCancel

Yes

Yes

ISO 92

鍙栨秷SQL璇彞銆

涓杩炴帴锛

鍑芥暟鍚

MyODBC

MyODBC

涓鑷存

鐩殑

 

2.50

3.51

 

 

SQLDisconnect

Yes

Yes

ISO 92

鍏抽棴杩炴帴銆

SQLFreeHandle

No

Yes

ISO 92

閲婃斁鐜銆佽繛鎺ャ佽鍙ユ垨鎻忚堪绗﹀彞鏌勩

SQLFreeConnect

Yes

Yes

Deprecated

閲婃斁杩炴帴鍙ユ焺銆

SQLFreeEnv

Yes

Yes

Deprecated

閲婃斁杩炴帴鍙ユ焺銆

26.1.17. MyODBC鏁版嵁绫诲瀷

鍦ㄤ笅琛ㄤ腑锛屼粙缁嶄簡椹卞姩绋嬪簭灏嗘湇鍔″櫒鏁版嵁绫诲瀷鏄犲皠涓洪粯璁QL鍜孋鏁版嵁绫诲瀷鐨勬柟娉曪細

SQL绫诲瀷

C绫诲瀷

bit

SQL_BIT

SQL_C_BIT

tinyint

SQL_TINYINT

SQL_C_STINYINT

tinyint unsigned

SQL_TINYINT

SQL_C_UTINYINT

bigint

SQL_BIGINT

SQL_C_SBIGINT

bigint unsigned

SQL_BIGINT

SQL_C_UBIGINT

long varbinary

SQL_LONGVARBINARY

SQL_C_BINARY

blob

SQL_LONGVARBINARY

SQL_C_BINARY

longblob

SQL_LONGVARBINARY

SQL_C_BINARY

tinyblob

SQL_LONGVARBINARY

SQL_C_BINARY

mediumblob

SQL_LONGVARBINARY

SQL_C_BINARY

long varchar

SQL_LONGVARCHAR

SQL_C_CHAR

text

SQL_LONGVARCHAR

SQL_C_CHAR

mediumtext

SQL_LONGVARCHAR

SQL_C_CHAR

char

SQL_CHAR

SQL_C_CHAR

numeric

SQL_NUMERIC

SQL_C_CHAR

decimal

SQL_DECIMAL

SQL_C_CHAR

integer

SQL_INTEGER

SQL_C_SLONG

integer unsigned

SQL_INTEGER

SQL_C_ULONG

int

SQL_INTEGER

SQL_C_SLONG

int unsigned

SQL_INTEGER

SQL_C_ULONG

mediumint

SQL_INTEGER

SQL_C_SLONG

mediumint unsigned

SQL_INTEGER

SQL_C_ULONG

smallint

SQL_SMALLINT

SQL_C_SSHORT

smallint unsigned

SQL_SMALLINT

SQL_C_USHORT

real

SQL_FLOAT

SQL_C_DOUBLE

double

SQL_FLOAT

SQL_C_DOUBLE

float

SQL_REAL

SQL_C_FLOAT

double precision

SQL_DOUBLE

SQL_C_DOUBLE

date

SQL_DATE

SQL_C_DATE

time

SQL_TIME

SQL_C_TIME

year

SQL_SMALLINT

SQL_C_SHORT

datetime

SQL_TIMESTAMP

SQL_C_TIMESTAMP

timestamp

SQL_TIMESTAMP

SQL_C_TIMESTAMP

text

SQL_VARCHAR

SQL_C_CHAR

varchar

SQL_VARCHAR

SQL_C_CHAR

enum

SQL_VARCHAR

SQL_C_CHAR

set

SQL_VARCHAR

SQL_C_CHAR

bit

SQL_CHAR

SQL_C_CHAR

bool

SQL_CHAR

SQL_C_CHAR

26.1.18. MyODBC閿欒浠g爜

鍦ㄤ笅琛ㄤ腑锛屽垪鍑轰簡椹卞姩绋嬪簭杩斿洖鐨勯櫎鏈嶅姟鍣ㄩ敊璇箣澶栫殑閿欒浠g爜鍒楄〃锛

鏈満浠g爜

SQLSTATE 2

SQLSTATE 3

閿欒娑堟伅

500

01000

01000

涓鑸鍛

501

01004

01004

瀛楃涓叉暟鎹紝鍙虫埅

502

01S02

01S02

閫夐」鍊艰鏇存敼

503

01S03

01S03

鏈洿鏂帮紡鍒犻櫎琛

504

01S04

01S04

鏇存柊锛忓垹闄や簡1涓互涓婄殑琛

505

01S06

01S06

鍦ㄧ粨鏋滈泦鍚堣繑鍥炵1涓闆嗗悎涔嬪墠瑙嗗浘鑾峰彇鏁版嵁銆

506

07001

07002

瀵逛簬鎵鏈夊弬鏁帮紝鏈娇鐢⊿QLBindParameter

507

07005

07005

绮惧埗璇彞涓嶇鍚堝厜鏍囪鑼

508

07009

07009

鏃犳晥鐨勬弿杩扮绱㈠紩銆

509

08002

08002

杩炴帴鍚嶆鍦ㄤ娇鐢ㄣ

510

08003

08003

杩炴帴涓嶅瓨鍦ㄣ

511

24000

24000

鏃犳晥鐨勫厜鏍囩姸鎬併

512

25000

25000

鏃犳晥鐨勪簨鍔$姸鎬併

513

25S01

25S01

浜嬪姟鐘舵佹湭鐭ャ

514

34000

34000

鏃犳晥鍏夋爣鍚嶃

515

S1000

HY000

涓鑸殑椹卞姩绋嬪簭瀹氫箟閿欒銆

516

S1001

HY001

鍐呭瓨鍒嗛厤閿欒銆

517

S1002

HY002

鏃犳晥鐨勫垪缂栧彿銆

518

S1003

HY003

鏃犳晥鐨勫簲鐢ㄧ紦鍐茬被鍨嬨

519

S1004

HY004

鏃犳晥鐨凷QL鏁版嵁绫诲瀷銆

520

S1009

HY009

绌烘寚閽堢殑鏃犳晥浣跨敤銆

521

S1010

HY010

鍑芥暟椤哄簭閿欒銆

522

S1011

HY011

鐜板湪鏃犳硶璁剧疆灞炴с

523

S1012

HY012

鏃犳晥鐨勪簨鍔℃搷浣滅爜銆

524

S1013

HY013

鍐呭瓨绠$悊閿欒銆

525

S1015

HY015

鏃犲彲鐢ㄧ殑鍏夋爣鍚嶃

526

S1024

HY024

鏃犳晥鐨勫睘鎬у笺

527

S1090

HY090

鏃犳晥瀛楃涓叉垨缂撳啿闀垮害銆

528

S1091

HY091

鏃犳晥鐨勬弿杩扮瀛楁鏍囪瘑绗︺

529

S1092

HY092

鏃犳晥鐨勫睘鎬э紡閫夐」鏍囪瘑绗︺

530

S1093

HY093

鏃犳晥鐨勫弬鏁扮紪鍙枫

531

S1095

HY095

鍑芥暟绫诲瀷瓒呭嚭鑼冨洿銆

532

S1106

HY106

鑾峰彇绫诲瀷瓒呭嚭鑼冨洿銆

533

S1117

HY117

琛屽艰秴鍑鸿寖鍥淬

534

S1109

HY109

鏃犳晥鐨勫厜鏍囦綅缃

535

S1C00

HYC00

鍙夌壒鎬ф湭瀹炴柦銆

0

21S01

21S01

鍒楄鏁颁笌鍊艰鏁颁笉鍖归厤銆

0

23000

23000

瀹屾暣鎬х害鏉熻繚鍙嶃

0

42000

42000

璇硶閿欒鎴栬闂啿绐併

0

42S02

42S02

鏈彂鐜板熀鏈〃鎴栬鍥俱

0

42S12

42S12

鏈彂鐜扮储寮曘

0

42S21

42S21

鍒楀凡瀛樺湪銆

0

42S22

42S22

鏈彂鐜板垪銆

0

08S01

08S01

閫氫俊閾炬帴澶辫触銆

26.1.19. MyODBC涓嶸B锛欰DO銆丏AO鍜孯DO

鍦ㄦ湰鑺備腑锛岀粰鍑轰簡MySQL ODBC 3.51椹卞姩绋嬪簭涓嶢DO銆丏AO鍜孯DO涓璧蜂娇鐢ㄧ殑涓浜涚畝鍗曠ず渚嬨

26.1.19.1. ADO: rs.addNew, rs.delete鍜宺s.update

鍦ㄤ笅闈㈢殑ADO锛圓ctiveX鏁版嵁瀵硅薄锛夌ず渚嬩腑锛屽垱寤轰簡琛my_ado锛屽苟婕旂ず浜唕s.addNewrs.deleters.update鐨勭敤娉曘

Private Sub myodbc_ado_Click()
 
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim fld As ADODB.Field
Dim sql As String
 
'connect to MySQL server using MySQL ODBC 3.51 Driver锛堜娇鐢∕ySQL ODBC 3.51椹卞姩绋嬪簭杩炴帴鍒癕ySQL鏈嶅姟鍣級
Set conn = New ADODB.Connection
conn.ConnectionString = "DRIVER={MySQL ODBC 3.51 Driver};"_
                      & "SERVER=localhost;"_
                      & " DATABASE=test;"_
                      & "UID=venu;PWD=venu; OPTION=3"
 
conn.Open
 
'create table锛堝垱寤鸿〃锛
conn.Execute "DROP TABLE IF EXISTS my_ado"
conn.Execute "CREATE TABLE my_ado(id int not null primary key, name varchar(20)," _
                               & "txt text, dt date, tm time, ts timestamp)"
 
'direct insert锛堢洿鎺ユ彃鍏ワ級
conn.Execute "INSERT INTO my_ado(id,name,txt) values(1,100,'venu')"
conn.Execute "INSERT INTO my_ado(id,name,txt) values(2,200,'MySQL')"
conn.Execute "INSERT INTO my_ado(id,name,txt) values(3,300,'Delete')"
 
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseServer
 
'fetch the initial table ..锛堣幏鍙栧垵濮嬭〃鈥︼級
rs.Open "SELECT * FROM my_ado", conn
  Debug.Print rs.RecordCount
  rs.MoveFirst
  Debug.Print String(50, "-") & "Initial my_ado Result Set " & String(50, "-")
  For Each fld In rs.Fields
    Debug.Print fld.Name,
    Next
    Debug.Print
 
    Do Until rs.EOF
    For Each fld In rs.Fields
    Debug.Print fld.Value,
    Next
    rs.MoveNext
    Debug.Print
  Loop
rs.Close
 
'rs insertrs鎻掑叆锛
rs.Open "select * from my_ado", conn, adOpenDynamic, adLockOptimistic
rs.AddNew
rs!Name = "Monty"
rs!txt = "Insert row"
rs.Update
rs.Close
 
'rs updaters鏇存柊锛
rs.Open "SELECT * FROM my_ado"
rs!Name = "update"
rs!txt = "updated-row"
rs.Update
rs.Close
 
'rs update second time..rs鏇存柊绗2娆♀︼級
rs.Open "SELECT * FROM my_ado"
rs!Name = "update"
rs!txt = "updated-second-time"
rs.Update
rs.Close
 
'rs deleters鍒犻櫎锛
rs.Open "SELECT * FROM my_ado"
rs.MoveNext
rs.MoveNext
rs.Delete
rs.Close
 
'fetch the updated table ..锛堣幏鍙栨洿鏂扮殑琛ㄢ︼級
rs.Open "SELECT * FROM my_ado", conn
  Debug.Print rs.RecordCount
  rs.MoveFirst
  Debug.Print String(50, "-") & "Updated my_ado Result Set " & String(50, "-")
  For Each fld In rs.Fields
    Debug.Print fld.Name,
    Next
    Debug.Print
 
    Do Until rs.EOF
    For Each fld In rs.Fields
    Debug.Print fld.Value,
    Next
    rs.MoveNext
    Debug.Print
  Loop
rs.Close
conn.Close
End Sub

26.1.19.2. DAO: rs.addNew, rs.update鍜屾粴鍔

鍦ㄤ笅闈㈢殑DAO锛堟暟鎹闂璞★級绀轰緥涓紝鍒涘缓浜嗚〃my_dao锛屽苟婕旂ず浜唕s.addNewrs.update銆佷互鍙婄粨鏋滈泦婊氬姩鐨勭敤娉曘
Private Sub myodbc_dao_Click()
 
Dim ws As Workspace
Dim conn As Connection
Dim queryDef As queryDef
Dim str As String
 
'connect to MySQL server using MySQL ODBC 3.51 Driver锛堜娇鐢∕ySQL ODBC 3.51椹卞姩绋嬪簭杩炴帴鍒癕ySQL锛
Set ws = DBEngine.CreateWorkspace("", "venu", "venu", dbUseODBC)
str = "odbc;DRIVER={MySQL ODBC 3.51 Driver};"_
                      & "SERVER=localhost;"_
                      & " DATABASE=test;"_
                      & "UID=venu;PWD=venu; OPTION=3"
Set conn = ws.OpenConnection("test", dbDriverNoPrompt, False, str)
 
'Create table my_dao锛堝垱寤鸿〃my_dao
Set queryDef = conn.CreateQueryDef("", "drop table if exists my_dao")
queryDef.Execute
 
Set queryDef = conn.CreateQueryDef("", "create table my_dao(Id INT AUTO_INCREMENT PRIMARY KEY, " _
                                                         & "Ts TIMESTAMP(14) NOT NULL, Name varchar(20), Id2 INT)")
queryDef.Execute
 
'Insert new records using rs.addNew锛堜娇鐢rs.addNew鎻掑叆鏂拌褰曪級
Set rs = conn.OpenRecordset("my_dao")
Dim i As Integer
 
  For i = 10 To 15
  rs.AddNew
  rs!Name = "insert record" & i
  rs!Id2 = i
  rs.Update
  Next i
           rs.Close
 
'rs update..rs鏇存柊锛
Set rs = conn.OpenRecordset("my_dao")
rs.Edit
rs!Name = "updated-string"
rs.Update
rs.Close
 
'fetch the table back...锛堝悜鍚庤幏鍙栬〃鈥︼級
Set rs = conn.OpenRecordset("my_dao", dbOpenDynamic)
str = "Results:"
rs.MoveFirst
While Not rs.EOF
str = " " & rs!Id & " , " & rs!Name & ", " & rs!Ts & ", " & rs!Id2
Debug.Print "DATA:" & str
rs.MoveNext
Wend
 
'rs Scrollingrs婊氬姩锛
rs.MoveFirst
str = " FIRST ROW: " & rs!Id & " , " & rs!Name & ", " & rs!Ts & ", " & rs!Id2
Debug.Print str
 
rs.MoveLast
str = " LAST ROW: " & rs!Id & " , " & rs!Name & ", " & rs!Ts & ", " & rs!Id2
Debug.Print str
 
rs.MovePrevious
str = " LAST-1 ROW: " & rs!Id & " , " & rs!Name & ", " & rs!Ts & ", " & rs!Id2
Debug.Print str
 
'free all resources锛堥噴鏀炬墍鏈夎祫婧愶級
rs.Close
queryDef.Close
conn.Close
ws.Close
 
End Sub

26.1.19.3. RDO: rs.addNew鍜宺s.update

鍦ㄤ笅闈㈢殑RDO锛堣繙绋嬫暟鎹璞★級绀轰緥涓紝鍒涘缓浜嗚〃my_rdo锛屽苟婕旂ず浜唕s.addNewrs.update鐨勭敤娉曘
Dim rs As rdoResultset
  Dim cn As New rdoConnection
  Dim cl As rdoColumn
  Dim SQL As String
 
  'cn.Connect = "DSN=test;"
  cn.Connect = "DRIVER={MySQL ODBC 3.51 Driver};"_
                      & "SERVER=localhost;"_
                      & " DATABASE=test;"_
                      & "UID=venu;PWD=venu; OPTION=3"
 
  cn.CursorDriver = rdUseOdbc
  cn.EstablishConnection rdDriverPrompt
 
 
  'drop table my_rdo锛堣垗寮冭〃my_rdo
  SQL = "drop table if exists my_rdo"
  cn.Execute SQL, rdExecDirect
 
  'create table my_rdo锛堝垱寤鸿〃my_rdo
  SQL = "create table my_rdo(id int, name varchar(20))"
  cn.Execute SQL, rdExecDirect
 
  'insert  direct锛堟彃鍏ワ紝鐩存帴锛
  SQL = "insert into my_rdo values (100,'venu')"
  cn.Execute SQL, rdExecDirect
 
  SQL = "insert into my_rdo values (200,'MySQL')"
  cn.Execute SQL, rdExecDirect
 
  'rs insertrs鎻掑叆锛
  SQL = "select * from my_rdo"
  Set rs = cn.OpenResultset(SQL, rdOpenStatic, rdConcurRowVer, rdExecDirect)
  rs.AddNew
  rs!id = 300
  rs!Name = "Insert1"
  rs.Update
  rs.Close
 
  'rs insertrs鎻掑叆锛
  SQL = "select * from my_rdo"
  Set rs = cn.OpenResultset(SQL, rdOpenStatic, rdConcurRowVer, rdExecDirect)
  rs.AddNew
  rs!id = 400
  rs!Name = "Insert 2"
  rs.Update
  rs.Close
 
  'rs updaters鏇存柊锛
  SQL = "select * from my_rdo"
  Set rs = cn.OpenResultset(SQL, rdOpenStatic, rdConcurRowVer, rdExecDirect)
  rs.Edit
  rs!id = 999
  rs!Name = "updated"
  rs.Update
  rs.Close
 
  'fetch back...
  SQL = "select * from my_rdo"
  Set rs = cn.OpenResultset(SQL, rdOpenStatic, rdConcurRowVer, rdExecDirect)
  Do Until rs.EOF
  For Each cl In rs.rdoColumns
              Debug.Print cl.Value,
    Next
    rs.MoveNext
    Debug.Print
             Loop
  Debug.Print "Row count="; rs.RowCount
 
  'close锛堝叧闂級
  rs.Close
  cn.Close
 
End Sub

26.1.20. MyODBC涓嶮icrosoft.NET

鏈妭鍖呭惈涓浜涚畝鍗曠ず渚嬶紝浠嬬粛浜哅yODBC椹卞姩绋嬪簭涓嶰DBC.NET涓璧蜂娇鐢ㄧ殑鐢ㄦ硶銆

26.1.20.1.聽ODBC.NET: CSHARP(C#)

鍦ㄤ笅闈㈢殑绠鍗曠ず渚嬩腑鍒涘缓浜嗚〃my_odbc_net锛屽苟浠嬬粛浜嗗畠鍦–#涓殑浣跨敤銆

/**
* @sample    : mycon.cs
* @purpose   : Demo sample for ODBC.NET using MyODBC
* @author    : Venu, <venu@mysql.com>
*
* (C) Copyright MySQL AB, 1995-2004
*
**/

/* build command
*
*  csc /t:exe
*      /out:mycon.exe mycon.cs
*      /r:Microsoft.Data.Odbc.dll
*/

using Console = System.Console;
using Microsoft.Data.Odbc;

namespace myodbc3
{
class mycon
{
  static void Main(string[] args)
  {
    try
    {
      //Connection string for MyODBC 2.50
      /*string MyConString = "DRIVER={MySQL};" +
                           "SERVER=localhost;" +
                           "DATABASE=test;" +
                           "UID=venu;" +
                           "PASSWORD=venu;" +
                           "OPTION=3";
      */
      //Connection string for MyODBC 3.51
      string MyConString = "DRIVER={MySQL ODBC 3.51 Driver};" +
                           "SERVER=localhost;" +
                           "DATABASE=test;" +
                           "UID=venu;" +
                           "PASSWORD=venu;" +
                           "OPTION=3";

      //Connect to MySQL using MyODBC
      OdbcConnection MyConnection = new OdbcConnection(MyConString);
      MyConnection.Open();

      Console.WriteLine("\n !!! success, connected successfully !!!\n");

      //Display connection information
      Console.WriteLine("Connection Information:");
      Console.WriteLine("\tConnection String:" + MyConnection.ConnectionString);
      Console.WriteLine("\tConnection Timeout:" + MyConnection.ConnectionTimeout);
      Console.WriteLine("\tDatabase:" + MyConnection.Database);
      Console.WriteLine("\tDataSource:" + MyConnection.DataSource);
      Console.WriteLine("\tDriver:" + MyConnection.Driver);
      Console.WriteLine("\tServerVersion:" + MyConnection.ServerVersion);

      //Create a sample table
      OdbcCommand MyCommand = new OdbcCommand("DROP TABLE IF EXISTS my_odbc_net",MyConnection);
      MyCommand.ExecuteNonQuery();
      MyCommand.CommandText = "CREATE TABLE my_odbc_net(id int, name varchar(20), idb bigint)";
      MyCommand.ExecuteNonQuery();

      //Insert
      MyCommand.CommandText = "INSERT INTO my_odbc_net VALUES(10,'venu', 300)";
      Console.WriteLine("INSERT, Total rows affected:" + MyCommand.ExecuteNonQuery());;

      //Insert
      MyCommand.CommandText = "INSERT INTO my_odbc_net VALUES(20,'mysql',400)";
      Console.WriteLine("INSERT, Total rows affected:" + MyCommand.ExecuteNonQuery());

      //Insert
      MyCommand.CommandText = "INSERT INTO my_odbc_net VALUES(20,'mysql',500)";
      Console.WriteLine("INSERT, Total rows affected:" + MyCommand.ExecuteNonQuery());

      //Update
      MyCommand.CommandText = "UPDATE my_odbc_net SET id=999 WHERE id=20";
      Console.WriteLine("Update, Total rows affected:" + MyCommand.ExecuteNonQuery());

      //COUNT(*)
      MyCommand.CommandText = "SELECT COUNT(*) as TRows FROM my_odbc_net";
      Console.WriteLine("Total Rows:" + MyCommand.ExecuteScalar());

      //Fetch
      MyCommand.CommandText = "SELECT * FROM my_odbc_net";
      OdbcDataReader MyDataReader;
      MyDataReader =  MyCommand.ExecuteReader();
      while (MyDataReader.Read())
      {
       if(string.Compare(MyConnection.Driver,"myodbc3.dll") == 0) {
         Console.WriteLine("Data:" + MyDataReader.GetInt32(0) + " " +
                                     MyDataReader.GetString(1) + " " +
                                     MyDataReader.GetInt64(2)); //Supported only by MyODBC 3.51
       }
       else {
         Console.WriteLine("Data:" + MyDataReader.GetInt32(0) + " " +
                                     MyDataReader.GetString(1) + " " +
                                     MyDataReader.GetInt32(2)); //BIGINTs not supported by MyODBC
       }
      }

      //Close all resources
      MyDataReader.Close();
      MyConnection.Close();
    }
    catch (OdbcException MyOdbcException)//Catch any ODBC exception ..
    {
      for (int i=0; i < MyOdbcException.Errors.Count; i++)
      {
        Console.Write("ERROR #" + i + "\n" +
          "Message: " + MyOdbcException.Errors[i].Message + "\n" +
          "Native: " + MyOdbcException.Errors[i].NativeError.ToString() + "\n" +
          "Source: " + MyOdbcException.Errors[i].Source + "\n" +
          "SQL: " + MyOdbcException.Errors[i].SQLState + "\n");
      }
    }
  }
}
}

26.1.20.2.聽ODBC.NET: VB

鍦ㄤ笅闈㈢殑绠鍗曠ず渚嬩腑鍒涘缓浜嗚〃my_vb_net锛屽苟浠嬬粛浜嗗畠鍦╒B涓殑鐢ㄦ硶銆

' @sample    : myvb.vb
' @purpose   : Demo sample for ODBC.NET using MyODBC
' @author    : Venu, <venu@mysql.com>
'
' (C) Copyright MySQL AB, 1995-2004
'
'

'
' build command
'
' vbc /target:exe
'     /out:myvb.exe
'     /r:Microsoft.Data.Odbc.dll
'     /r:System.dll
'     /r:System.Data.dll
'

Imports Microsoft.Data.Odbc
Imports System

Module myvb
  Sub Main()
      Try

          'MyODBC 3.51 connection string
          Dim MyConString As String = "DRIVER={MySQL ODBC 3.51 Driver};" & _
                         "SERVER=localhost;" & _
                         "DATABASE=test;" & _
                         "UID=venu;" & _
                         "PASSWORD=venu;" & _
                         "OPTION=3;"

          'Connection
          Dim MyConnection As New OdbcConnection(MyConString)
          MyConnection.Open()

          Console.WriteLine ("Connection State::" & MyConnection.State.ToString)

          'Drop
          Console.WriteLine ("Dropping table")
          Dim MyCommand As New OdbcCommand()
          MyCommand.Connection = MyConnection
          MyCommand.CommandText = "DROP TABLE IF EXISTS my_vb_net"
          MyCommand.ExecuteNonQuery()

          'Create
          Console.WriteLine ("Creating....")
          MyCommand.CommandText = "CREATE TABLE my_vb_net(id int, name varchar(30))"
          MyCommand.ExecuteNonQuery()

          'Insert
          MyCommand.CommandText = "INSERT INTO my_vb_net VALUES(10,'venu')"
          Console.WriteLine("INSERT, Total rows affected:" & MyCommand.ExecuteNonQuery())

          'Insert
          MyCommand.CommandText = "INSERT INTO my_vb_net VALUES(20,'mysql')"
          Console.WriteLine("INSERT, Total rows affected:" & MyCommand.ExecuteNonQuery())

          'Insert
          MyCommand.CommandText = "INSERT INTO my_vb_net VALUES(20,'mysql')"
          Console.WriteLine("INSERT, Total rows affected:" & MyCommand.ExecuteNonQuery())

          'Insert
          MyCommand.CommandText = "INSERT INTO my_vb_net(id) VALUES(30)"
          Console.WriteLine("INSERT, Total rows affected:" & MyCommand.ExecuteNonQuery())

          'Update
          MyCommand.CommandText = "UPDATE my_vb_net SET id=999 WHERE id=20"
          Console.WriteLine("Update, Total rows affected:" & MyCommand.ExecuteNonQuery())

          'COUNT(*)
          MyCommand.CommandText = "SELECT COUNT(*) as TRows FROM my_vb_net"
          Console.WriteLine("Total Rows:" & MyCommand.ExecuteScalar())

          'Select
          Console.WriteLine ("Select * FROM my_vb_net")
          MyCommand.CommandText = "SELECT * FROM my_vb_net"
          Dim MyDataReader As OdbcDataReader
          MyDataReader = MyCommand.ExecuteReader
          While MyDataReader.Read
              If MyDataReader("name") Is DBNull.Value Then
                  Console.WriteLine ("id = " & CStr(MyDataReader("id")) & "  name = " & _
                    "NULL")
              Else
                  Console.WriteLine ("id = " & CStr(MyDataReader("id")) & "  name = " & _
                                        CStr(MyDataReader("name")))
              End If
          End While

      'Catch ODBC Exception
      Catch MyOdbcException As OdbcException
          Dim i As Integer
          Console.WriteLine (MyOdbcException.ToString)

      'Catch program exception
      Catch MyException As Exception
          Console.WriteLine (MyException.ToString)
  End Try
  End Sub
End Module

26.1.21. 鎰熻阿

涓嬮潰鍒楀嚭浜嗕竴浜汳ySQL AB鍏徃璐熻矗MyODBC鍜孧yODBC 3.51椹卞姩绋嬪簭寮鍙戠殑浜哄憳銆

  • Micheal (Monty) Widenius

  • Venu Anuganti

  • Peter Harvey

26.2.聽MySQL Connector/NET

26.2.1. 鍓嶈█

浣跨敤MySQL Connector/NET锛屽紑鍙戜汉鍛樿兘澶熸柟渚垮湴鍒涘缓闇瑕佸畨鍏ㄥ拰楂樻ц兘鏁版嵁杩炴帴锛堜笌MySQL锛夌殑.NET搴旂敤绋嬪簭銆傚畠瀹炴柦浜嗘墍闇鐨凙DO.NET鎺ュ彛锛屽苟灏嗗叾闆嗘垚鍒颁簡ADO.NET aware宸ュ叿涓傚紑鍙戜汉鍛樿兘澶熶娇鐢ㄤ粬浠夋嫨鐨.NET璇█鍒涘缓搴旂敤绋嬪簭銆侻ySQL Connector/NET鏄敤100锛呯函C#璇█缂栧啓鐨勫彲瀹屽叏绠$悊鐨凙DO.NET椹卞姩绋嬪簭銆

MySQL Connector/NET鍖呮嫭瀵逛笅杩颁簨瀹滅殑瀹屾暣鏀寔锛

         MySQL 5.0鐗规э紙瀛樺偍绋嬪簭绛夛級銆

         MySQL 4.1鐗规э紙鏈嶅姟鍣ㄧ鐨勭簿鍒惰鍙ャ乁nicode銆佷互鍙婂叡浜唴瀛樿闂瓑锛夈

         澶т俊鎭寘鏀寔锛屽彲鍙戦佸拰鎺ユ敹楂樿揪2GB鐨勮鍜孊LOB銆

         鍗忚鍘嬬缉锛屽厑璁稿帇缂╁鎴风鍜屾湇鍔″櫒涔嬮棿鐨勬暟鎹祦銆

         鏀寔浣跨敤CP/IP濂楁帴瀛椼佸懡鍚嶇閬撱佷互鍙奧indows鍏变韩鍐呭瓨鐨勮繛鎺ャ

         鏀寔浣跨敤CP/IP濂楁帴瀛椼佹垨Unix濂楁帴瀛楃殑杩炴帴銆

         鏀寔鐢盢ovell寮鍙戠殑寮鏀炬簮鐮丮ono妗嗘灦銆

         鍙畬鍏ㄧ鐞嗭紝涓嶅埄鐢∕ySQL瀹㈡埛绔簱銆

MySQL Connector/NET鐨勫紑鍙戜汉鍛橀珮搴﹀皧閲嶇敤鎴峰湪杞欢寮鍙戣繃绋嬩腑鎻愪緵鐨勫府鍔┿傚鏋滀綘鍙戠幇MySQL Connector/NET缂哄皯瀵逛綘鏉ヨ寰堥噸瑕佺殑鏌愪簺鐗规э紝鎴栬呭鏋滀綘鍙戠幇浜嗙己闄凤紝璇蜂娇鐢ㄦ垜浠殑MySQL缂洪櫡绯荤粺璇锋眰璇ョ壒鎬ф垨閫氭姤闂銆

閫氳繃http://forums.mysql.com涓婄殑璁哄潧浠ュ強http://lists.mysql.com涓婄殑閭欢鍒楄〃锛屽彲鎵惧埌閽堝MySQL Connector/NET鐨勭ぞ鍖烘敮鎸佷俊鎭侻ySQL AB鍏徃鎻愪緵浠樿垂鏀寔锛屾洿澶氫俊鎭鍙傝http://www.mysql.com/support/

鏈枃妗g殑鐩殑鏄綔涓篗ySQL Connector/NET鐨勭敤鎴锋寚鍗楋紝鑰屼笉鏄娉曞弬鑰冦傚鏋滀綘鎵撶畻浜嗚В璇︾粏鐨勮娉曚俊鎭紝璇烽槄璇籑ySQL Connector/NET鍒嗗彂鐗堜腑鎻愪緵鐨Documentation.chm鏂囦欢銆

26.2.2. 涓嬭浇骞跺畨瑁匨ySQL Connector/NET

MySQL Connector/NET鑳藉杩愯鍦ㄤ换浣曟敮鎸.NET妗嗘灦鐨勫钩鍙颁笂銆.NET妗嗘灦涓昏琚渶杩戠殑Microsoft Windows鐗堟湰鏀寔锛岄氳繃鐢盢ovell寮鍙戠殑Mono妗嗘灦锛屽湪Linux涓婁篃鏀寔瀹冿紙璇峰弬瑙http://www.mono-project.com锛夈

MySQL Connector/NET鍙氳繃浣跨敤Windows Installer (.msi)瀹夎杞欢鍖呰繘琛屽畨瑁咃紝浣跨敤璇ヨ蒋浠跺寘锛屽彲鍦ㄤ换浣昗indows鎿嶄綔绯荤粺涓婂畨瑁匨ySQL Connector/NET銆侻SI杞欢鍖呭寘鍚湪鍚嶄负mysql-connector-net-version.zip鐨勫帇缂╂枃浠朵腑锛屽叾涓紝version锛堢増鏈級鎸囨槑浜MySQL Connector/NET鐨勭増鏈

鍙粠涓嬭堪缃戠珯涓嬭浇MySQL Connector/NET锛http://dev.mysql.com/downloads/connector/net/1.0.html

闅忕潃Windows XP鐨勫彂甯冿紝Windows Installer锛堝畨瑁呭櫒锛夊紩鎿庝篃浜堜互浜嗘洿鏂帮紝瀵逛簬浣跨敤鏃х増鏈殑鐢ㄦ埛锛屽彲鍙傞槄璇icrosoft鐭ヨ瘑搴撴枃绔浠ヤ簡瑙e崌绾ц嚦鏈鏂扮増鏈殑鏇村淇℃伅銆

瑕佹兂瀹夎MySQL Connector/NET锛岃鍙冲嚮MSI鏂囦欢骞堕夋嫨鈥滃畨瑁呪濄傚湪瀹夎鍣ㄦ彁绀轰綘瀹屾垚瀹夎鍙傛暟閫夋嫨鍚庯紝瀹夎灏嗚嚜鍔ㄥ紑濮嬨傚浜庡ぇ澶氭暟鐢ㄦ埛锛屽缓璁噰鐢ㄥ吀鍨嬪畨瑁呫

濡傛灉鍦ㄨ繍琛屽畨瑁呭櫒鏃堕亣鍒伴棶棰橈紝鍙笅杞戒笉甯﹀畨瑁呭櫒鐨刏IP鏂囦欢銆傝鏂囦欢鍚嶄负mysql-connector-net-version-noinstall.zip銆備娇鐢╖IP绋嬪簭锛屽皢鍏惰В鍘嬭嚦浣犳墍閫夋嫨鐨勭洰褰曘

闄ら潪浣滀簡鍏朵粬閫夋嫨锛屽惁鍒橫ySQL Connector/NET灏嗚瀹夎鍒扳C:\Program Files\MySQL\MySQL Connector Net X.X.X鈥濓紝鍏朵腑锛屸X.X.X鈥濇槸浣犳墍瀹夎鐨凪ySQL Connector/NET鐨勭増鏈彿銆傛柊瀹夎涓嶄細瑕嗙洊宸叉湁鐨凪ySQL Connector/NET鐗堟湰銆

26.2.3. Connector/NET浣撶郴缁撴瀯

MySQL Connector/NET鍖呭惈鏁颁釜绫伙紝杩欎簺绫诲彲鐢ㄤ簬杩炴帴鍒版暟鎹簱锛屾墽琛屾煡璇㈠拰璇彞锛屽苟绠$悊鏌ヨ缁撴灉銆

涓嬮潰浠嬬粛浜哅ySQL Connector/NET鐨勪富瑕佺被锛

         MySqlCommand锛氫唬琛ㄥMySQL鏁版嵁搴撹繘琛屾墽琛屾搷浣滅殑SQL璇彞銆

         MySqlCommandBuilder锛氳嚜鍔ㄧ敓鎴愬崟涓〃鐨勫懡浠わ紝鐢ㄤ簬鍗忚皟瀵笵ataSet鎵浣滅殑鏇存敼鍜岀浉鍏崇殑MySQL鏁版嵁搴撱

         MySqlConnection锛氫唬琛ㄤ笌MySQL鏈嶅姟鍣ㄦ暟鎹簱鐨勫紑鏀惧紡杩炴帴銆

         MySqlDataAdapter锛氫唬琛ㄤ竴缁勬暟鎹懡浠ゅ拰鏁版嵁搴撹繛鎺ワ紝鐢ㄤ簬濉厖鏁版嵁搴撳拰鏇存柊MySQL鏁版嵁搴撱

         MySqlDataReader锛氭彁渚涗簡浠嶮ySQL鏁版嵁搴撹鍙栬鐨勨滀粎姝e悜鈥濇祦鐨勪竴绉嶆柟寮忋

         MySqlException锛氬綋MySQL杩斿洖閿欒鏃舵姏鍑虹殑寮傚父銆

         MySqlHelper锛氬姪鎵嬬被锛岃兘浣垮伐浣滃彉鐨勬洿绠鍗曘

         MySqlTransaction锛氫唬琛ㄥ皢鍦∕ySQL鏁版嵁搴撲腑杩涜鐨凷QL浜嬪姟銆

鍦ㄥ悗缁钀戒腑锛屽皢鍒嗗埆浠嬬粛杩欎簺瀵硅薄銆傝繖浜涚珷鑺傜殑鐩殑鏄瑕佷粙缁峂ySQL Connector/NET鐨勪富瑕佺被锛岃屼笉鏄娉曞弬鑰冦傚鏋滀綘鎵撶畻浜嗚В璇︾粏鐨勮娉曚俊鎭紝璇烽槄璇籑ySQL Connector/NET鍒嗗彂鐗堜腑鎻愪緵鐨Documentation.chm鏂囦欢銆

26.2.3.1. MySqlCommand绫

MySqlCommand绫浠h〃瀵筂ySQL鏁版嵁搴撹繘琛屾墽琛屾搷浣滅殑SQL璇彞銆

娉ㄩ噴锛鍦ㄤ互鍓嶇殑鐗堟湰涓紝閲囩敤绗﹀彿鈥淍鈥濇潵鏍囪瘑SQL涓殑鍙傛暟銆傚畠涓嶮ySQL鐢ㄦ埛鍙橀噺涓嶅吋瀹癸紝鍥犳锛岀幇閲囩敤绗﹀彿鈥?鈥濇潵瀹氫綅SQL涓殑鍙傛暟銆備负浜嗘敮鎸佹棭鏈熶唬鐮侊紝涔熷彲浠ュ湪杩炴帴瀛楃涓蹭腑璁剧疆鈥渙ld syntax=yes鈥濄傚鏋滆繘琛屼簡杩欑被璁剧疆锛岃娉ㄦ剰锛屽鏋滄棤娉曞畾涔夊笇鏈涘湪SQL涓娇鐢ㄧ殑鍙傛暟锛堝畾涔夊け璐ワ級锛屼笉浼氱粰鍑哄紓甯告彁绀恒

26.2.3.1.1. 灞炴
鍙敤灞炴у涓嬶細

         CommandText锛氳幏鍙栨垨璁剧疆灏嗗湪鏁版嵁婧愪笂鎵ц鐨凷QL璇彞銆

         CommandTimeout锛氳幏鍙栨垨璁剧疆涓鎵ц鍛戒护骞剁敓鎴愰敊璇箣鍓嶅簲绛夊緟鐨勬椂闂淬

         CommandType锛氳幏鍙栨垨璁剧疆鍊硷紝璇ュ兼寚鏄庝簡瑙i噴CommandText鐨勬柟寮忋傚彲鑳界殑鍊煎寘鎷StoredProcedureTableDirectText

         Connection锛氳幏鍙栨垨璁剧疆璇ySqlCommand瀹炰緥浣跨敤鐨凪ySqlConnection銆

         IsPrepared锛氬鏋滆鍛戒护宸插噯澶囧ソ锛屼负鈥滅湡鈥濓紝鍚﹀垯涓衡滃亣鈥濄

         Parameters锛氳幏鍙朚ySqlParameterCollection銆

         Transaction锛氳幏鍙栨垨璁剧疆MySqlTransaction锛孧ySqlCommand灏嗗湪鍏朵腑鎵ц銆

         UpdatedRowSource锛氬綋DbDataAdapter鐨刄pdate鏂规硶浣跨敤瀹冩椂锛岀敤浜庤幏鍙栨垨璁剧疆鍛戒护缁撴灉浣滅敤鍦―ataRow涓婄殑鏂瑰紡銆

26.2.3.1.2. 鏂规硶
鍙敤鏂规硶濡備笅锛

         Cancel锛氬皾璇曞彇娑圡ySqlCommand鐨勬墽琛屻涓嶆敮鎸佽鎿嶄綔銆

         Clone锛氬垱寤鸿MySqlCommand瀵硅薄鐨勫厠闅嗗璞°傚寘鎷珻ommandText銆丆onnection鍜孴ransaction灞炴э紝浠ュ強鏁翠釜鍙傛暟鍒楄〃銆

         CreateParameter锛氬垱寤篗ySqlParameter瀵硅薄鐨勬柊瀹炰緥銆

         Dispose锛氬鐞嗚MySqlCommand瀹炰緥銆

         ExecuteNonQuery锛氭牴鎹繛鎺ユ儏鍐垫墽琛孲QL璇彞锛屽苟杩斿洖鍙楀奖鍝嶇殑琛屾暟銆

         ExecuteReader锛氬皢CommandText鍙戦佺粰Connection锛屽苟鍒涘缓MySqlDataReader銆

         ExecuteScalar锛氭墽琛屾煡璇紝骞惰繑鍥炴煡璇㈡搷浣滄墍杩斿洖鐨勭粨鏋滈泦涓1琛岀殑绗1鍒椼傚浣欑殑鍒楁垨琛屽皢琚拷鐣ャ

         Prepare锛氬湪MySQL鏈嶅姟鍣ㄧ殑1涓疄渚嬩笂鍒涘缓鍛戒护鐨勯鍒剁増鏈

26.2.3.1.3. 鐢ㄦ硶
鍦ㄤ笅闈㈢殑绀轰緥涓紝鍒涘缓浜1涓狹ySqlCommand鍜1涓狹ySqlConnection銆傛墦寮浜哅ySqlConnection锛屽苟灏嗗叾璁剧疆涓虹敤浜嶮ySqlCommand鐨勮繛鎺ャ傞殢鍚庯紝璋冪敤ExecuteNonQuery锛屽苟鍏抽棴杩炴帴銆備负浜嗗畬鎴愯浠诲姟锛屼负ExecuteNonQuery浼犻掍簡1涓繛鎺ュ瓧绗︿覆鍜1涓煡璇㈠瓧绗︿覆锛堟煡璇㈠瓧绗︿覆鏄1鏉QL INSERT璇彞锛夈
26.2.3.1.3.1.聽VB.NET

鍦ㄤ笅渚嬩腑锛屼粙缁嶄簡鍦╒B.NET涓娇鐢∕ySqlCommand绫荤殑鏂规硶锛

Public Sub InsertRow(myConnectionString As String)
    ' If the connection string is null, use a default.
    If myConnectionString = "" Then
        myConnectionString = "Database=Test;Data Source=localhost;User Id=username;Password=pass"
    End If
    Dim myConnection As New MySqlConnection(myConnectionString)
    Dim myInsertQuery As String = "INSERT INTO Orders (id, customerId, amount) Values(1001, 23, 30.66)"
    Dim myCommand As New MySqlCommand(myInsertQuery)
    myCommand.Connection = myConnection
    myConnection.Open()
    myCommand.ExecuteNonQuery()
    myCommand.Connection.Close()
End Sub
26.2.3.1.3.2.聽C#

鍦ㄤ笅渚嬩腑锛屼粙缁嶄簡鍦–#涓娇鐢∕ySqlCommand绫荤殑鏂规硶锛

public void InsertRow(string myConnectionString) 
{
    // If the connection string is null, use a default.
    if(myConnectionString == "") 
    {
        myConnectionString = "Database=Test;Data Source=localhost;User Id=username;Password=pass";
    }
    MySqlConnection myConnection = new MySqlConnection(myConnectionString);
    string myInsertQuery = "INSERT INTO Orders (id, customerId, amount) Values(1001, 23, 30.66)";
    MySqlCommand myCommand = new MySqlCommand(myInsertQuery);
    myCommand.Connection = myConnection;
    myConnection.Open();
    myCommand.ExecuteNonQuery();
    myCommand.Connection.Close();
}

26.2.3.2. MySqlCommandBuilder绫

MySqlDataAdapter涓嶄細鑷姩鐢熸垚鎵闇鐨凷QL璇彞锛堢敤浜庡崗璋冨DataSet鎵浣滅殑鏇存敼鍜岀浉鍏崇殑MySQL瀹炰緥锛夈備絾鏄紝濡傛灉璁剧疆浜哅ySqlDataAdapter鐨凷electCommand灞炴э紝鍙互鍒涘缓MySqlCommandBuilder瀵硅薄鏉ヨ嚜鍔ㄧ敓鎴愰拡瀵瑰崟涓〃鏇存柊鐨凷QL璇彞銆傞殢鍚庯紝MySqlCommandBuilder灏嗙敓鎴愪綘鏈缃殑浠讳綍闄勫姞鐨凷QL璇彞銆

涓鏃︿綘璁剧疆浜咲ataAdapter灞炴э紝MySqlCommandBuilder浼氬皢鑷繁娉ㄥ唽涓洪拡瀵筄nRowUpdating浜嬩欢鐨勭洃鍚▼搴忋備竴娆″彧鑳藉皢1涓狹ySqlDataAdapter鎴朚ySqlCommandBuilder瀵硅薄鍏宠仈璧锋潵銆

涓轰簡鐢熸垚INSERT銆乁PDATE鎴朌ELETE璇彞锛孧ySqlCommandBuilder浣跨敤浜哠electCommand灞炴ф潵鑷姩妫绱㈡墍闇鐨勫厓鏁版嵁闆嗗悎銆傚鏋滃湪妫绱㈠畬鍏冩暟鎹悗鏇存敼浜哠electCommand锛堜緥濡傞娆℃洿鏂板悗锛夛紝搴旇皟鐢≧efreshSchema鏂规硶鏉ユ洿鏂板厓鏁版嵁銆

SelectCommand涔熷繀椤昏繑鍥炶嚦灏1涓富閿垨鍞竴鍒椼傚鏋滄湭鏄剧ず浠讳綍杩斿洖淇℃伅锛屽皢鐢熸垚InvalidOperation寮傚父锛岃屼笖涓嶄細鐢熸垚鍛戒护銆

MySqlCommandBuilder杩樹細浣跨敤SelectCommand寮曠敤鐨凜onnection銆丆ommandTimeout鍜孴ransaction灞炴с傚鏋滄洿鏀逛簡杩欎簺灞炴т腑鐨勪换浣1涓紝鎴栬咃紝濡傛灉鏇挎崲浜哠electCommand鏈韩锛岀敤鎴峰簲璋冪敤RefreshSchema銆傚涓嶇劧锛孖nsertCommand銆乁pdateCommand鍜孌eleteCommand灞炴у皢淇濇寔瀹冧滑浠ュ墠鐨勫笺

濡傛灉璋冪敤浜咲ispose锛孧ySqlCommandBuilder灏嗚В闄や笌MySqlDataAdapter鐨勫叧鑱旓紝宸茬敓鎴愮殑鍛戒护灏嗕笉鍐嶄娇鐢ㄣ

26.2.3.2.1. 灞炴

鍙敤灞炴у涓嬶細

         DataAdapter锛歁ySqlCommandBuilder灏嗚嚜宸辨敞鍐屼负閽堝RowUpdating浜嬩欢鐨勭洃鍚▼搴忥紝RowUpdating浜嬩欢鏄敱鍦ㄨ灞炴т腑鎸囧畾鐨凪ySqlDataAdapter鐢熸垚鐨勩傚垱寤轰簡鏂扮殑MySqlCommandBuilder瀹炰緥鏃讹紝灏嗛噴鏀句换浣曞凡鏈夌殑涓嶮ySqlDataAdapter鍏宠仈鐨凪ySqlCommandBuilder銆

         QuotePrefix, QuoteSuffix锛歁ySQL涓殑鏁版嵁搴撳璞¤兘澶熷寘鍚壒娈婂瓧绗︼紝濡傜┖鏍肩瓑锛岃繖浼氫娇寰楁甯哥殑SQL瀛楃涓叉棤娉曡В鏋愩備娇鐢≦uotePrefix鍜孮uoteSuffix灞炴э紝MySqlCommandBuilder鑳藉鍒涘缓澶勭悊璇ラ棶棰樼殑SQL鍛戒护銆

26.2.3.2.2. 鏂规硶

鍙敤鏂规硶濡備笅锛

         DeriveParameters锛氫粠MySqlCommand鎸囧畾鐨勫瓨鍌ㄧ▼搴忎腑妫绱㈠弬鏁颁俊鎭紝骞跺~鍏呮墍鎸囧畾MySqlCommand瀵硅薄鐨勫弬鏁伴泦銆傜洰鍓嶄笉鏀寔璇ユ柟娉曪紝杩欐槸鍥犱负MySQL涓湭鎻愪緵瀛樺偍绋嬪簭銆

         GetDeleteCommand锛氳幏鍙栫敤浜庡湪鏁版嵁搴撲笂鎵ц鍒犻櫎鎿嶄綔鎵闇鐨勩佽嚜鍔ㄧ敓鎴愮殑MySqlCommand瀵硅薄銆

         GetInsertCommand锛氳幏鍙栫敤浜庡湪鏁版嵁搴撲笂鎵ц鎻掑叆鎿嶄綔鎵闇鐨勩佽嚜鍔ㄧ敓鎴愮殑MySqlCommand瀵硅薄銆

         GetUpdateCommand锛氳幏鍙栫敤浜庡湪鏁版嵁搴撲笂鎵ц鏇存柊鎿嶄綔鎵闇鐨勩佽嚜鍔ㄧ敓鎴愮殑MySqlCommand瀵硅薄銆

         RefreshSchema锛氬埛鏂扮敤浜庣敓鎴怚NSERT銆乁PDATE鎴朌ELETE璇彞鐨勬暟鎹簱鏂规淇℃伅銆

26.2.3.2.3. 鐢ㄦ硶
鍦ㄤ笅闈㈢粰鍑虹殑绀轰緥涓紝浣跨敤浜哅ySqlCommand銆丮ySqlDataAdapter鍜孧ySqlConnection锛岀敤浜庝粠鏁版嵁婧愰夋嫨琛屻備负璇ョず渚嬩紶閫掍簡1涓垵濮嬪寲鐨凞ataSet銆1涓繛鎺ュ瓧绗︿覆銆1涓煡璇㈠瓧绗︿覆锛堟槸SQL SELECT璇彞锛夈佷互鍙1涓綔涓烘暟鎹簱琛ㄥ悕绉扮殑瀛楃涓层傞殢鍚庯紝璇ョず渚嬪垱寤轰簡1涓狹ySqlCommandBuilder銆
26.2.3.2.3.1.聽VB.NET

鍦ㄤ笅渚嬩腑锛屼粙缁嶄簡鍦╒B.NET涓娇鐢∕ySqlCommandBuilder绫荤殑鏂规硶锛

  Public Shared Function SelectRows(myConnection As String, mySelectQuery As String, myTableName As String) As DataSet
        Dim myConn As New MySqlConnection(myConnection)
        Dim myDataAdapter As New MySqlDataAdapter()
        myDataAdapter.SelectCommand = New MySqlCommand(mySelectQuery, myConn)
        Dim cb As SqlCommandBuilder = New MySqlCommandBuilder(myDataAdapter)

        myConn.Open()

        Dim ds As DataSet = New DataSet
        myDataAdapter.Fill(ds, myTableName)

        ' Code to modify data in DataSet here 

        ' Without the MySqlCommandBuilder this line would fail.
        myDataAdapter.Update(ds, myTableName)

        myConn.Close()
    End Function 'SelectRows
    
26.2.3.2.3.2.聽C#

鍦ㄤ笅渚嬩腑锛屼粙缁嶄簡鍦–#涓娇鐢∕ySqlCommandBuilder绫荤殑鏂规硶锛

    public static DataSet SelectRows(string myConnection, string mySelectQuery, string myTableName)
    {
      MySqlConnection myConn = new MySqlConnection(myConnection);
      MySqlDataAdapter myDataAdapter = new MySqlDataAdapter();
      myDataAdapter.SelectCommand = new MySqlCommand(mySelectQuery, myConn);
      MySqlCommandBuilder cb = new MySqlCommandBuilder(myDataAdapter);

      myConn.Open();

      DataSet ds = new DataSet();
      myDataAdapter.Fill(ds, myTableName);

      //code to modify data in DataSet here

      //Without the MySqlCommandBuilder this line would fail
      myDataAdapter.Update(ds, myTableName);

      myConn.Close();

      return ds;
    }  
    

26.2.3.3. MySqlConnection绫

MySqlConnection瀵硅薄浠h〃涓嶮ySQL鏈嶅姟鍣ㄦ暟鎹簮鐨勪細璇濄傚垱寤篗ySqlConnection瀹炰緥鏃讹紝鎵鏈夊睘鎬у潎灏嗚璁剧疆涓哄畠浠殑鍒濆鍊笺傚叧浜庤繖浜涘肩殑鍒楄〃锛岃鍙傝MySqlConnection鏋勯犲嚱鏁般

濡傛灉MySqlConnection瓒呭嚭鑼冨洿锛屼笉浼氳鍏抽棴銆傚洜姝わ紝蹇呴』閫氳繃璋冪敤Close鎴朌ispose鏄庣‘鍦板叧闂繛鎺ャ

26.2.3.3.1. 灞炴
鍙敤灞炴у涓嬶細

         ConnectionString锛氳缃垨鑾峰彇鐢ㄤ簬杩炴帴鑷矼ySQL鏈嶅姟鍣ㄦ暟鎹簱鐨勫瓧绗︿覆銆

         ConnectionTimeout锛氳幏鍙栧湪涓灏濊瘯骞剁敓鎴愰敊璇箣鍓嶄负寤虹珛杩炴帴鎵闇鐨勭瓑寰呮椂闂淬

         Database锛氳幏鍙栧綋鍓嶆暟鎹簱鐨勫悕绉版垨鎵撳紑杩炴帴鍚庡皢浣跨敤鐨勬暟鎹簱鐨勫悕绉般

         DataSource锛氳幏鍙栧皢瑕佽繛鎺ョ殑MySQL鏈嶅姟鍣ㄧ殑鍚嶇О銆

         ServerThread锛氳繑鍥炶杩炴帴鎵浣跨敤鐨勬湇鍔″櫒绾跨▼鐨処D銆

         ServerVersion锛氳幏鍙栧寘鍚鎴风涓庝箣鐩歌繛鐨凪ySQL鏈嶅姟鍣ㄧ増鏈殑瀛楃涓层

         State锛氳幏鍙栬繛鎺ョ殑褰撳墠杩炴帴鐨勭姸鎬併

         UseConnection锛氫笌鏈嶅姟鍣ㄨ繘琛岄氫俊鏃讹紝鎸囨槑璇ヨ繛鎺ユ槸鍚﹀皢浣跨敤鍘嬬缉鐗规с

26.2.3.3.2. 鏂规硶
鍙敤鏂规硶濡備笅锛

         BeginTransaction锛氬紑濮嬫暟鎹簱浜嬪姟銆

         ChangeDatabase锛氶拡瀵规墦寮鐨凪ySqlConnection锛屾洿鏀瑰綋鍓嶆暟鎹簱銆

         Close锛氬叧闂笌鏁版嵁搴撶殑杩炴帴銆傝繖鏄叧闂换浣曟墦寮杩炴帴鐨勯閫夋柟娉曘

         CreateCommand锛氬垱寤哄苟杩斿洖涓嶮ySqlConnection鐩稿叧鐨凪ySqlCommand瀵硅薄銆

         Dispose锛氶噴鏀綧ySqlConnection浣跨敤鐨勮祫婧愩

         Open锛氱敤ConnectionString鎸囧畾鐨勫睘鎬ц缃墦寮鏁版嵁搴撹繛鎺ャ

         Ping锛氬MySQL鏈嶅姟鍣ㄦ墽琛孭ing鎿嶄綔銆

26.2.3.3.3. 鐢ㄦ硶
鍦ㄤ笅闈㈢殑绀轰緥涓紝鍒涘缓浜1涓狹ySqlCommand鍜1涓狹ySqlConnection銆傛墦寮浜哅ySqlConnection锛屽苟灏嗗叾璁剧疆涓虹敤浜嶮ySqlCommand鐨勮繛鎺ャ傞殢鍚庯紝璋冪敤ExecuteNonQuery锛屽苟鍏抽棴杩炴帴銆備负浜嗗畬鎴愯浠诲姟锛屼负ExecuteNonQuery浼犻掍簡1涓繛鎺ュ瓧绗︿覆鍜1涓煡璇㈠瓧绗︿覆锛堟煡璇㈠瓧绗︿覆鏄1鏉QL INSERT璇彞锛夈
26.2.3.3.3.1.聽VB.NET

鍦ㄤ笅渚嬩腑锛屼粙缁嶄簡鍦╒B.NET涓娇鐢∕ySqlConnection绫荤殑鏂规硶锛

Public Sub InsertRow(myConnectionString As String)
    ' If the connection string is null, use a default.
    If myConnectionString = "" Then
        myConnectionString = "Database=Test;Data Source=localhost;User Id=username;Password=pass"
    End If
    Dim myConnection As New MySqlConnection(myConnectionString)
    Dim myInsertQuery As String = "INSERT INTO Orders (id, customerId, amount) Values(1001, 23, 30.66)"
    Dim myCommand As New MySqlCommand(myInsertQuery)
    myCommand.Connection = myConnection
    myConnection.Open()
    myCommand.ExecuteNonQuery()
    myCommand.Connection.Close()
End Sub
      
26.2.3.3.3.2.聽C#

鍦ㄤ笅渚嬩腑锛屼粙缁嶄簡鍦–#涓娇鐢∕ySqlConnection绫荤殑鏂规硶锛

public void InsertRow(string myConnectionString) 
{
    // If the connection string is null, use a default.
    if(myConnectionString == "") 
    {
        myConnectionString = "Database=Test;Data Source=localhost;User Id=username;Password=pass";
    }
    MySqlConnection myConnection = new MySqlConnection(myConnectionString);
    string myInsertQuery = "INSERT INTO Orders (id, customerId, amount) Values(1001, 23, 30.66)";
    MySqlCommand myCommand = new MySqlCommand(myInsertQuery);
    myCommand.Connection = myConnection;
    myConnection.Open();
    myCommand.ExecuteNonQuery();
    myCommand.Connection.Close();
}

      

26.2.3.4. MySqlDataAdapter绫

MySQLDataAdapter璧风潃DataSet鍜孧ySQL涔嬮棿妗ユ鐨勪綔鐢紝鐢ㄤ簬妫绱㈠拰淇濆瓨鏁版嵁銆侻ySQLDataAdapter閫氳繃鏄犲皠Fill锛堝~鍏咃級鍜孶pdate锛堟洿鏂帮級鎻愪緵浜嗚妗ワ紝Fill鑳芥敼鍙楧ataSet涓殑鏁版嵁浠ヤ究涓庢暟鎹簮涓殑鏁版嵁鍖归厤锛孶pdate鑳芥敼鍙樻暟鎹簮涓殑鏁版嵁浠ヤ究涓嶥ataSet涓殑鏁版嵁鍖归厤锛堥氳繃瀵规暟鎹簮浣跨敤鎭板綋鐨凷QL璇彞锛夈

褰揗ySQLDataAdapter濉厖DataSet鏃讹紝濡傛灉琛ㄦ垨鍒椾笉瀛樺湪锛屽畠灏嗕负杩斿洖鐨勬暟鎹垱寤哄繀瑕佺殑琛ㄥ拰鍒椼備絾鏄紝鍦ㄩ殣寮忓垱寤虹殑鏂规涓笉鍖呮嫭涓婚敭淇℃伅锛岄櫎闈炲皢MissingSchemaAction灞炴ц涓篈ddWithKey銆傚湪浣跨敤FillSchema鐢ㄦ暟鎹~鍏呭畠涔嬪墠锛屼篃鑳借MySQLDataAdapter鍒涘缓DataSet鏂规锛屽寘鍚富閿俊鎭

MySQLDataAdapter鐢ㄤ簬MySqlConnection鍜孧ySqlCommand鐨勮繛鎺ワ紝鐢ㄤ互鎻愬崌杩炴帴鑷矼ySQL鏁版嵁搴撴椂鐨勬ц兘銆

MySQLDataAdapter杩樺寘鎷琒electCommand銆両nsertCommand銆丏eleteCommand銆乁pdateCommand鍜孴ableMappings灞炴э紝鐢ㄤ簬绠鍖栨暟鎹殑鍔犺浇鍜屾洿鏂版搷浣溿

26.2.3.4.1. 灞炴

鍙敤灞炴у涓嬶細

         AcceptChangesDuringFill锛氳幏鍙栨垨璁剧疆鍊硷紝璇ュ兼寚鏄庝簡鍦ㄤ换浣曞~鍏呮搷浣滆繃绋嬩腑锛屽湪灏咲ataRow娣诲姞鍒癉ataTable鍚庯紝鏄惁瑕佸湪DataRow涓婅皟鐢ˋcceptChanges銆

         ContinueUpdateOnError锛氳幏鍙栨垨璁剧疆鍊硷紝璇ュ兼寚瀹氫簡鍦ㄨ鏇存柊杩囩▼涓嚭鐜伴敊璇椂鏄惁瑕佺敓鎴愬紓甯搁」銆

         DeleteCommand锛氳幏鍙栨垨璁剧疆鐢ㄤ簬灏嗚褰曚粠鏁版嵁闆嗕腑鍒犻櫎鐨凷QL璇彞鎴栧瓨鍌ㄧ▼搴忋

         InsertCommand锛氳幏鍙栨垨璁剧疆鐢ㄤ簬鍦ㄦ暟鎹泦涓彃鍏ヨ褰曠殑SQL璇彞鎴栧瓨鍌ㄧ▼搴忋

         MissingMappingAction锛氱‘瀹氬綋杩涘叆鐨勬暟鎹笉鍚尮閰嶈〃鎴栧垪鏃堕渶瑕侀噰鍙栫殑鍔ㄤ綔銆

         MissingSchemaAction锛氱‘瀹氬綋宸叉湁鐨凞ataSet鏂规涓庤繘鍏ユ暟鎹笉鍖归厤鏃堕渶瑕侀噰鍙栫殑鍔ㄤ綔銆

         SelectCommand锛氳幏鍙栨垨璁剧疆鐢ㄤ簬鍦ㄦ暟鎹簮涓夋嫨璁板綍鐨凷QL璇彞鎴栧瓨鍌ㄧ▼搴忋

         TableMappings锛氳幏鍙栨彁渚涗簡婧愯〃鍜孌ataTable涔嬮棿涓绘槧灏勭殑闆嗗悎銆

         UpdateCommand锛氳幏鍙栨垨璁剧疆鐢ㄤ簬鍦ㄦ暟鎹簮涓洿鏂拌褰曠殑SQL璇彞鎴栧瓨鍌ㄧ▼搴忋

26.2.3.4.2. 鏂规硶
鍙敤鏂规硶濡備笅锛

         Fill锛氫娇鐢―ataSet鍚嶇О娣诲姞鎴栧埛鏂癉ataSet涓殑琛岋紝浠ヤ究涓庢暟鎹簮涓殑琛屽尮閰嶏紝骞跺垱寤哄悕涓衡淭able鈥濈殑DataTable銆

         FillSchema锛氬皢鍚嶄负鈥淭able鈥濈殑DataTable娣诲姞鍒版寚瀹氱殑DataSet锛屽苟閰嶇疆鏂规锛屼互渚夸笌鍩轰簬鎸囧畾SchemaType鐨勬暟鎹簮涓殑琛ㄥ尮閰嶃

         GetFillParameters锛氭墽琛孲QL SELECT璇彞鏃讹紝鎸夌敤鎴疯幏鍙栧弬鏁伴泦銆

         Update锛氫负鎸囧畾DataSet涓殑鍚勬彃鍏ヨ銆佹洿鏂拌鎴栧垹闄よ鍒嗗埆璋冪敤INSERT銆乁PDATE鎴朌ELETE璇彞銆

26.2.3.4.3. 鐢ㄦ硶
鍦ㄤ笅闈㈢殑绀轰緥涓紝鍒涘缓浜1涓狹ySqlCommand鍜1涓狹ySqlConnection銆傛墦寮MySqlConnection锛屽苟灏嗗叾璁剧疆涓虹敤浜嶮ySqlCommand鐨勮繛鎺ャ傞殢鍚庯紝璋冪敤ExecuteNonQuery锛屽苟鍏抽棴杩炴帴銆備负浜嗗畬鎴愯浠诲姟锛屼负ExecuteNonQuery浼犻掍簡1涓繛鎺ュ瓧绗︿覆鍜1涓煡璇㈠瓧绗︿覆锛堟煡璇㈠瓧绗︿覆鏄1鏉QL INSERT璇彞锛夈
26.2.3.4.3.1.聽VB.NET

鍦ㄤ笅渚嬩腑锛屼粙缁嶄簡鍦╒B.NET涓娇鐢∕ySqlDataAdapter绫荤殑鏂规硶锛

Public Function SelectRows(dataSet As DataSet, connection As String, query As String) As DataSet
    Dim conn As New MySqlConnection(connection)
    Dim adapter As New MySqlDataAdapter()
    adapter.SelectCommand = new MySqlCommand(query, conn)
    adapter.Fill(dataset)
    Return dataset
End Function 
26.2.3.4.3.2.聽C#

鍦ㄤ笅渚嬩腑锛屼粙缁嶄簡鍦–#涓娇鐢∕ySqlDataAdapter绫荤殑鏂规硶锛

public DataSet SelectRows(DataSet dataset,string connection,string query) 
{
    MySqlConnection conn = new MySqlConnection(connection);
    MySqlDataAdapter adapter = new MySqlDataAdapter();
    adapter.SelectCommand = new MySqlCommand(query, conn);
    adapter.Fill(dataset);
    return dataset;
}   
  

26.2.3.5. MySqlDataReader绫

MySqlDataReader绫绘彁渚涗簡浠嶮ySQL鏁版嵁搴撹鍙栬鐨勨滀粎姝e悜鈥濇祦鐨勪竴绉嶆柟寮忋

瑕佹兂鍒涘缓MySQLDataReader锛屽繀椤昏皟鐢∕ySqlCommand瀵硅薄鐨凟xecuteReader鏂规硶锛岃屼笉鏄洿鎺ヤ娇鐢ㄦ瀯閫犲嚱鏁般

浣跨敤MySqlDataReader鐨勫悓鏃讹紝鐩稿叧鐨凪ySqlConnection灏嗗繖浜嶮ySqlDataReader銆傞櫎浜嗗叧闂畠涔嬪锛屼笉鑳藉湪MySqlConnection涓婃墽琛屼换浣曟搷浣溿傝鎯呭喌灏嗕竴鐩存寔缁埌璋冪敤浜哅ySqlDataReader鐨勨淐lose鈥濇柟娉曚负姝€

鍏抽棴浜哅ySqlDataReader鍚庯紝浣犲彧鑳借皟鐢↖sClosed鍜孯ecordsAffected灞炴с傚敖绠″湪MySqlDataReader瀛樺湪鍚屾椂鑳藉璁块棶RecordsAffected灞炴э紝浣嗗湪杩斿洖RecordsAffected鐨勫间箣鍓嶆诲簲璋冪敤鈥淐lose鈥濓紝浠ョ‘淇濆噯纭殑杩斿洖鍊笺

涓轰簡鑾峰緱鏈浣虫ц兘锛孧ySqlDataReader灏嗛伩鍏嶅垱寤轰笉蹇呰鐨勫璞℃垨鎵ц涓嶅繀瑕佺殑鏁版嵁鎷疯礉銆傚叾缁撴灉鏄紝瀵硅濡侴etValue绛夋柟娉曠殑澶氫釜璋冪敤浼氳繑鍥炲鐩稿悓瀵硅薄鐨勫紩鐢ㄣ傚鏋滀綘鍑嗗鏇存敼鐢辫濡侴etValue绛夋柟娉曡繑鍥炵殑瀵硅薄鐨勫熀鏈硷紝璇蜂粩缁嗗皬蹇冦

26.2.3.5.1. 灞炴
鍙敤灞炴у涓嬶細

         Depth锛氳幏鍙栨寚鏄庡綋鍓嶈宓屽娣卞害鐨勫笺傜洰鍓嶅苟涓嶆敮鎸佹柟娉曪紝鎬讳細杩斿洖0銆

         FieldCount锛氳幏鍙栧綋鍓嶈涓殑鍒楁暟銆

         HasRows锛氳幏鍙栧硷紝璇ュ兼寚鏄庝簡MySqlDataReader鏄惁鍖呭惈1琛屾垨澶氳銆

         IsClosed锛氳幏鍙栧硷紝璇ュ兼寚鏄庝簡鍜岃嫃鍓ч槄璇诲櫒鏄惁宸插叧闂

         Item锛氫互鍥烘湁鏍煎紡鑾峰彇鍒楃殑鍊笺傚湪C#锛岃灞炴ф槸MySqlDataReader绫荤殑绱㈠紩灞炴с

         RecordsAffected锛氳幏鍙栭殣鎵цSQL璇彞鑰屾洿鏀广佹彃鍏ャ佹垨鍒犻櫎鐨勮鏁般

26.2.3.5.2. 鏂规硶
鍙敤鏂规硶濡備笅锛

         Close锛氬叧闂璏ySqlDataReader瀵硅薄銆

         GetBoolean锛氳幏鍙栨寚瀹氬垪鐨勫竷灏斿笺

         GetByte锛氫互瀛楄妭褰㈠紡鑾峰彇鎸囧畾鍒楃殑鍊笺

         GetBytes锛氳鍙栦粠鎸囧畾鍒楀亸绉昏嚦缂撳啿鐨勫瓧鑺傛祦锛屾暟缁勪粠缁欏畾鐨勭紦鍐插亸绉讳綅缃紑濮嬨

         GetChar锛氫互鍗曞瓧绗﹀舰寮忚幏鍙栨寚瀹氬垪鐨勫笺

         GetChars锛氳鍙栦粠鎸囧畾鍒楀亸绉昏嚦缂撳啿鐨勫瓧绗︽祦锛屾暟缁勪粠缁欏畾鐨勭紦鍐插亸绉讳綅缃紑濮嬨

         GetDataTypeName锛氳幏鍙栨簮鏁版嵁绫诲瀷鐨勫悕绉般

         GetDateTime锛氫互DateTime瀵硅薄褰㈠紡鑾峰彇鎸囧畾鍒楃殑鍊笺

         GetDecimal锛氫互DateTime瀵硅薄褰㈠紡鑾峰彇鎸囧畾鍒楃殑鍊笺

         GetDouble锛氫互鍙岀簿搴︽诞鐐规暟鐨勫舰寮忚幏鍙栨寚瀹氬垪鐨勫笺

         GetFieldType锛氳幏鍙栦綔涓哄璞℃暟鎹被鍨嬬殑绫诲瀷銆

         GetFloat锛氫互鍗曠簿搴︽诞鐐规暟鐨勫舰寮忚幏鍙栨寚瀹氬垪鐨勫笺

         GetGuid锛氫互GUID鐨勫舰寮忚幏鍙栨寚瀹氬垪鐨勫笺

         GetInt16锛氫互16浣嶅甫绗﹀彿鏁存暟鐨勫舰寮忚幏鍙栨寚瀹氬垪鐨勫笺

         GetInt32锛氫互32浣嶅甫绗﹀彿鏁存暟鐨勫舰寮忚幏鍙栨寚瀹氬垪鐨勫笺

         GetInt64锛氫互64浣嶅甫绗﹀彿鏁存暟鐨勫舰寮忚幏鍙栨寚瀹氬垪鐨勫笺

         GetMySqlDateTime锛氫互MySqlDateTime瀵硅薄鐨勫舰寮忚幏鍙栨寚瀹氬垪鐨勫笺

         GetName锛氳幏鍙栨寚瀹氬垪鐨勫悕绉般

         GetOrdinal锛氱粰瀹氬垪鍚嶏紝鑾峰彇鍒楃殑椤哄簭銆

         GetSchemaTable锛氳繑鍥炴弿杩颁簡MySqlDataReader鐨勫垪鍏冩暟鎹殑DataTable銆

         GetString锛氫互String瀵硅薄鐨勫舰寮忚幏鍙栨寚瀹氬垪鐨勫笺

         GetTimeSpan锛氫互TimeSpan瀵硅薄鐨勫舰寮忚幏鍙栨寚瀹氬垪鐨勫笺

         GetUInt16锛氫互16浣嶆棤绗﹀彿鏁存暟鐨勫舰寮忚幏鍙栨寚瀹氬垪鐨勫笺

         GetUInt32锛氫互32浣嶆棤绗﹀彿鏁存暟鐨勫舰寮忚幏鍙栨寚瀹氬垪鐨勫笺

         GetUInt64锛氫互64浣嶆棤绗﹀彿鏁存暟鐨勫舰寮忚幏鍙栨寚瀹氬垪鐨勫笺

         GetValue锛氫互鍥烘湁鏍煎紡鑾峰彇鎸囧畾鍒楃殑鍊笺

         GetValues锛氳幏鍙栧綋鍓嶈闆嗗悎涓殑鎵鏈夊睘鎬у垪銆

         IsDBNull锛氳幏鍙栧硷紝璇ュ兼寚鏄庝簡鍒椾腑鏄惁鍖呭惈涓嶅瓨鍦ㄦ垨涓㈠け鐨勫笺

         NextResult锛氳鍙栨壒SQL璇彞鐨勭粨鏋滄椂锛屼娇鏁版嵁闃呰鍣ㄨ烦鍒颁笅涓涓粨鏋溿

         Read锛氫娇MySqlDataReader璺冲埌涓嬩竴鏉¤褰曘

26.2.3.5.3. 鐢ㄦ硶
鍦ㄤ笅闈㈢殑绀轰緥涓紝鍒涘缓浜1涓狹ySqlConnection锛1涓狹ySqlCommand鍜1涓狹ySqlDataReader銆傝绀轰緥璇诲彇鏁版嵁锛屽苟灏嗘暟鎹緭鍑哄埌鎺у埗鍙般傛渶鍚庯紝鏈緥鍏抽棴浜哅ySqlDataReader锛岀劧鍚庡叧闂簡MySqlConnection銆
26.2.3.5.3.1.聽VB.NET

鍦ㄤ笅渚嬩腑锛屼粙缁嶄簡鍦╒B.NET涓娇鐢∕ySqlDataReader绫荤殑鏂规硶锛

Public Sub ReadMyData(myConnString As String)
    Dim mySelectQuery As String = "SELECT OrderID, CustomerID FROM Orders"
    Dim myConnection As New MySqlConnection(myConnString)
    Dim myCommand As New MySqlCommand(mySelectQuery, myConnection)
    myConnection.Open()
    Dim myReader As MySqlDataReader
    myReader = myCommand.ExecuteReader()
    ' Always call Read before accessing data.
    While myReader.Read()
        Console.WriteLine((myReader.GetInt32(0) & ", " & myReader.GetString(1)))
    End While
    ' always call Close when done reading.
    myReader.Close()
    ' Close the connection when done with it.
    myConnection.Close()
End Sub 'ReadMyData       
      
26.2.3.5.3.2.聽C#

鍦ㄤ笅渚嬩腑锛屼粙缁嶄簡鍦–#涓娇鐢∕ySqlDataReader绫荤殑鏂规硶锛

public void ReadMyData(string myConnString) {
    string mySelectQuery = "SELECT OrderID, CustomerID FROM Orders";
    MySqlConnection myConnection = new MySqlConnection(myConnString);
    MySqlCommand myCommand = new MySqlCommand(mySelectQuery,myConnection);
    myConnection.Open();
    MySqlDataReader myReader;
    myReader = myCommand.ExecuteReader();
    // Always call Read before accessing data.
    while (myReader.Read()) {
       Console.WriteLine(myReader.GetInt32(0) + ", " + myReader.GetString(1));
    }
    // always call Close when done reading.
    myReader.Close();
    // Close the connection when done with it.
    myConnection.Close();
 }     
      

26.2.3.6. MySqlException绫

褰揗ySql鏁版嵁鎻愪緵鏂归亣鍒版湇鍔″櫒鐢熸垚鐨勯敊璇椂灏嗗垱寤鸿绫汇

鎶涘嚭寮傚父鏃讹紝鎵撳紑鐨勮繛鎺ヤ笉浼氳嚜鍔ㄥ叧闂傚鏋滃鎴风搴旂敤绋嬪簭鍒ゅ畾璇ュ紓甯告槸鑷村懡鐨勶紝搴斿叧闂换浣曟墦寮鐨凪ySqlDataReader瀵硅薄鎴朚ySqlConnection瀵硅薄銆

26.2.3.6.1. 灞炴
鍙敤灞炴у涓嬶細

         HelpLink锛氳幏鍙栨垨璁剧疆鎸囧悜涓庤寮傚父鐩稿叧鐨勫府鍔╂枃浠剁殑閾炬帴銆

         InnerException锛氳幏鍙栧鑷村綋鍓嶅紓甯哥殑寮傚父瀹炰緥銆

         IsFatal锛氬鏋滆寮傚父鏄嚧鍛界殑锛屼负鈥滅湡鈥濓紝骞跺叧闂繛鎺ワ紝濡傛灉涓嶆槸鑷村懡鐨勶紝涓衡滃亣鈥濄

         Message锛氳幏鍙栨弿杩板綋鍓嶅紓甯哥殑娑堟伅銆

         Number锛氳幏鍙栨寚鏄庨敊璇被鍨嬬殑缂栧彿銆

         Source锛氳幏鍙栨垨璁剧疆瀵艰嚧閿欒鐨勫簲鐢ㄧ▼搴忔垨瀵硅薄鐨勫悕绉般

         StackTrace锛氳幏鍙栨姏鍑哄綋鍓嶅紓甯告椂鍦ㄨ皟鐢ㄥ爢鏍堜笂甯х殑瀛楃涓茶〃寰併

         TargetSite锛氳幏鍙栨姏鍑哄綋鍓嶅紓甯哥殑鏂规硶銆

26.2.3.6.2. 鏂规硶
MySqlException绫绘病鏈夌浉搴旂殑鏂规硶銆
26.2.3.6.3. 鐢ㄦ硶
鍦ㄤ笅杩扮ず渚嬩腑锛屽洜涓㈠け浜嗘湇鍔″櫒鑰岀敓鎴愪簡MySqlException锛岀劧鍚庢樉绀哄紓甯搞
26.2.3.6.3.1.聽VB.NET

璇ョず渚嬩粙缁嶅湪VB.NET涓嬩娇鐢∕ySqlException绫荤殑鏂规硶銆

Public Sub ShowException()
     Dim mySelectQuery As String = "SELECT column1 FROM table1"
     Dim myConnection As New MySqlConnection ("Data Source=localhost;Database=Sample;")
     Dim myCommand As New MySqlCommand(mySelectQuery, myConnection)

     Try
         myCommand.Connection.Open()
     Catch e As MySqlException
        MessageBox.Show( e.Message )
     End Try
 End Sub       
      
26.2.3.6.3.2.聽C#

璇ョず渚嬩粙缁嶅湪C#涓嬩娇鐢∕ySqlException绫荤殑鏂规硶銆

public void ShowException() 
{
   string mySelectQuery = "SELECT column1 FROM table1";
   MySqlConnection myConnection =
      new MySqlConnection("Data Source=localhost;Database=Sample;");
   MySqlCommand myCommand = new MySqlCommand(mySelectQuery,myConnection);

   try 
   {
      myCommand.Connection.Open();
   }
   catch (MySqlException e) 
   {
        MessageBox.Show( e.Message );
   }
}
    

26.2.3.7. MySqlHelper绫

鍔╂墜绫伙紝鑳戒娇涓庢彁渚涙柟锛圥rovider锛変竴璧疯繘琛岀殑宸ヤ綔鍙樼殑鏇寸畝鍗曘傚紑鍙戜汉鍛樺彲浠ヤ娇鐢ㄨ绫绘彁渚涚殑鏂规硶鑷姩鎵ц鍏卞悓浠诲姟銆
26.2.3.7.1. 灞炴
MySqlHelper绫绘病鏈夌浉搴旂殑灞炴с
26.2.3.7.2. 鏂规硶
鍙敤鏂规硶濡備笅锛

         ExecuteDataRow锛氭墽琛屽崟涓猄QL璇彞骞惰繑鍥炵粨鏋滈泦鐨勭1琛屻傚湪璇ユ柟娉曠殑鎵ц杩囩▼涓紝灏嗗垱寤恒佹墦寮骞跺叧闂1涓柊鐨凪ySqlConnection瀵硅薄銆

         ExecuteDataset锛氭墽琛屽崟涓猄QL鍛戒护骞惰繑鍥濪ataSet涓殑缁撴灉闆嗐傚湪璇ユ柟娉曠殑鎵ц杩囩▼涓紝灏嗗垱寤恒佹墦寮骞跺叧闂1涓柊鐨凪ySqlConnection瀵硅薄銆

         ExecuteNonQuery锛氬湪MySQL鏁版嵁搴撲笂鎵ц鍗曚釜鍛戒护銆傝皟鐢ㄨ鏂规硶鏃讹紝灏嗚涓篗ySqlConnection宸叉墦寮锛屾柟娉曟墽琛屽畬鍚庯紝MySqlConnection浠嶄繚鎸佹墦寮鐘舵併

         ExecuteReader锛歄verloaded锛氬湪MySQL鏁版嵁搴撲笂鎵ц鍗曚釜鍛戒护銆

         ExecuteScalar锛氬湪MySQL鏁版嵁搴撲笂鎵ц鍗曚釜鍛戒护銆

         UpdateDataSet锛氱敤鏉ヨ嚜缁欏畾DataSet鐨勬暟鎹洿鏂扮粰瀹氳〃銆

26.2.3.8. MySqlTransaction绫

浠h〃灏嗗湪MySQL鏁版嵁搴撲腑杩涜鐨凷QL浜嬪姟銆
26.2.3.8.1. 灞炴
鍙敤灞炴у涓嬶細

         Connection锛氳幏鍙栦笌浜嬪姟鐩稿叧鐨凪ySqlConnection瀵硅薄锛屽鏋滀簨鍔′笉鍐嶆湁鏁堬紝鑾峰彇绌哄紩鐢紙鍦╒isual Basic涓负Nothing锛夈

         IsolationLevel锛氫负璇ヤ簨鍔℃寚瀹欼solationLevel銆

26.2.3.8.2. 鏂规硶
鍙敤鏂规硶濡備笅锛

         Commit锛氭彁浜ゆ暟鎹簱浜嬪姟銆

         Rollback锛氫粠鎸傝捣鐘舵佸洖婊氫簨鍔°

26.2.3.8.3. 鐢ㄦ硶
鍦ㄤ笅闈㈢殑绀轰緥涓紝鍒涘缓浜1涓狹ySqlConnection鍜1涓狹ySqlTransaction銆傛澶栵紝鍦ㄧず渚嬩腑杩樹粙缁嶄簡濡備綍浣跨敤BeginTransaction銆丆ommit鍜孯ollback鏂规硶銆
26.2.3.8.3.1.聽VB.NET

鍦ㄤ笅渚嬩腑锛屼粙缁嶄簡鍦╒B.NET涓娇鐢∕ySqlTransaction绫荤殑鏂规硶锛

Public Sub RunTransaction(myConnString As String)
    Dim myConnection As New MySqlConnection(myConnString)
    myConnection.Open()
    
    Dim myCommand As MySqlCommand = myConnection.CreateCommand()
    Dim myTrans As MySqlTransaction
    
    ' Start a local transaction
    myTrans = myConnection.BeginTransaction()
    ' Must assign both transaction object and connection
    ' to Command object for a pending local transaction
    myCommand.Connection = myConnection
    myCommand.Transaction = myTrans
    
    Try
      myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (100, 'Description')"
      myCommand.ExecuteNonQuery()
      myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (101, 'Description')"
      myCommand.ExecuteNonQuery()
      myTrans.Commit()
      Console.WriteLine("Both records are written to database.")
    Catch e As Exception
      Try
        myTrans.Rollback()
      Catch ex As MySqlException
        If Not myTrans.Connection Is Nothing Then
          Console.WriteLine("An exception of type " & ex.GetType().ToString() & _
                            " was encountered while attempting to roll back the transaction.")
        End If
      End Try
    
      Console.WriteLine("An exception of type " & e.GetType().ToString() & _
                      "was encountered while inserting the data.")
      Console.WriteLine("Neither record was written to database.")
    Finally
      myConnection.Close()
    End Try
End Sub 'RunTransaction       
      
26.2.3.8.3.2.聽C#

鍦ㄤ笅渚嬩腑锛屼粙缁嶄簡鍦–#涓娇鐢∕ySqlTransaction绫荤殑鏂规硶锛

public void RunTransaction(string myConnString) 
 {
    MySqlConnection myConnection = new MySqlConnection(myConnString);
    myConnection.Open();

    MySqlCommand myCommand = myConnection.CreateCommand();
    MySqlTransaction myTrans;

    // Start a local transaction
    myTrans = myConnection.BeginTransaction();
    // Must assign both transaction object and connection
    // to Command object for a pending local transaction
    myCommand.Connection = myConnection;
    myCommand.Transaction = myTrans;

    try
    {
      myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (100, 'Description')";
      myCommand.ExecuteNonQuery();
      myCommand.CommandText = "Insert into Region (RegionID, RegionDescription) VALUES (101, 'Description')";
      myCommand.ExecuteNonQuery();
      myTrans.Commit();
      Console.WriteLine("Both records are written to database.");
    }
    catch(Exception e)
    {
      try
      {
        myTrans.Rollback();
      }
      catch (MySqlException ex)
      {
        if (myTrans.Connection != null)
        {
          Console.WriteLine("An exception of type " + ex.GetType() +
                            " was encountered while attempting to roll back the transaction.");
        }
      }
    
      Console.WriteLine("An exception of type " + e.GetType() +
                        " was encountered while inserting the data.");
      Console.WriteLine("Neither record was written to database.");
    }
    finally 
    {
      myConnection.Close();
    }
}       
      

26.2.4. 浣跨敤MySQL Connector/NET

26.2.4.1. 鍓嶈█

鍦ㄦ湰鑺備腑锛屼粙缁嶇殑Connector/NET鐨勪竴浜涘父鐢ㄦ柟寮忥紝鍖呮嫭BLOB澶勭悊锛屾棩鏈熷鐞嗭紝浠ュ強涓庤濡侰rystal Reports绛夊父瑙佸伐鍏蜂竴璧蜂娇鐢–onnector/NET鐨勬柟娉曘

26.2.4.2. 浣跨敤MySQL Connector/NET杩炴帴鍒癕ySQL

26.2.4.2.1. 鍓嶈█
.NET搴旂敤绋嬪簭鍜孧ySQL鏈嶅姟鍣ㄤ箣闂寸殑鎵鏈変氦浜掑潎鏄氳繃MySqlConnection瀵硅薄浼犻佺殑銆鍦ㄥ簲鐢ㄧ▼搴忚兘澶熶笌鏈嶅姟鍣ㄨ繘琛屼氦浜掍箣鍓嶏紝蹇呴』鑾峰彇銆侀厤缃佸苟鎵撳紑MySqlConnection瀵硅薄銆

鍗充娇鍦ㄤ娇鐢MySqlHelper绫绘椂锛MySqlConnection瀵硅薄涔熶細琚Helper绫诲垱寤恒

鍦ㄦ湰鑺備腑锛屼粙缁嶄簡浣跨敤MySqlConnection瀵硅薄杩炴帴鍒癕ySQL鐨勬柟娉曘

26.2.4.2.2. 鍒涘缓杩炴帴瀛楃涓

MySqlConnection瀵硅薄鏄娇鐢ㄨ繛鎺ュ瓧绗︿覆閰嶇疆鐨勩1涓繛鎺ュ瓧绗︿覆鍖呭惈鏈嶅姟鍣ㄩ敭锛忓煎锛岀敱鍒嗗彿闅斿紑銆傛瘡涓敭锛忓煎鐢辩瓑鍙疯繛鎺ャ

涓嬮潰缁欏嚭浜1涓畝鍗曠殑杩炴帴瀛楃涓茬ず渚嬶細

    Server=127.0.0.1;Uid=root;Pwd=12345;Database=test;
    

鍦ㄦ湰渚嬩腑锛屽MySqlConnection瀵硅薄杩涜浜嗛厤缃紝浣跨敤鐢ㄦ埛鍚root鍜屽瘑鐮12345涓庝綅浜127.0.0.1鐨MySQL鏈嶅姟鍣ㄧ浉杩炪傛墍鏈夎鍙ョ殑榛樿鏁版嵁搴撲负娴嬭瘯鏁版嵁搴撱

鍏稿瀷鐨勯夐」濡備笅锛堝叧浜庨夐」鐨勫畬鏁存竻鍗曪紝璇峰弬瑙丄PI鏂囨。锛夛細

         Server锛氬皢瑕佽繛鎺ョ殑MySQL瀹炰緥鐨勫悕绉版垨缃戠粶鍦板潃銆傞粯璁や负鏈湴涓绘満銆傚埆鍚嶅寘鎷琀ost, Data Source, DataSource, Address, AddrNetwork Address銆

         Uid锛氳繛鎺ユ椂浣跨敤鐨凪ySQL鐢ㄦ埛璐︽埛銆傚埆鍚嶅寘鎷User Id, UsernameUser name銆

         Pwd锛歁ySQL璐︽埛鐨勫瘑鐮併備篃鍙互浣跨敤鍒悕瀵嗙爜銆

         Database锛氭墍鏈夎鍙ヤ綔鐢ㄤ簬鐨勯粯璁ゆ暟鎹簱銆傞粯璁や负mysql銆備篃鍙互浣跨敤鍒悕Initial Catalog

         Port锛歁ySQL鐢ㄤ簬鐩戝惉杩炴帴鐨勭鍙c傞粯璁や负3306銆灏嗚鍊兼寚瀹氫负鈥-1灏嗕娇鐢ㄥ懡鍚嶇閬撹繛鎺ャ

26.2.4.2.3. 鎵撳紑杩炴帴

涓鏃﹀垱寤轰簡杩炴帴瀛楃涓诧紝鍙娇鐢ㄥ畠鎵撳紑涓嶮ySQL鏈嶅姟鍣ㄧ殑杩炴帴銆

涓嬭堪浠g爜鐢ㄤ簬鍒涘缓MySqlConnection瀵硅薄锛屾寚瀹氳繛鎺ュ瓧绗︿覆锛屽苟鎵撳紑杩炴帴銆

[VB]

Dim conn As New MySql.Data.MySqlClient.MySqlConnection
Dim myConnectionString as String

myConnectionString = "server=127.0.0.1;" _
            & "uid=root;" _
            & "pwd=12345;" _
            & "database=test;"

Try
  conn.ConnectionString = myConnectionString
  conn.Open()

Catch ex As MySql.Data.MySqlClient.MySqlException
  MessageBox.Show(ex.Message)
End Try
  

[C#]

MySql.Data.MySqlClient.MySqlConnection conn;
string myConnectionString;
    
myConnectionString = "server=127.0.0.1;uid=root;" +
    "pwd=12345;database=test;";
  
try
{
    conn = new MySql.Data.MySqlClient.MySqlConnection();
    conn.ConnectionString = myConnectionString;
    conn.Open();
}
catch (MySql.Data.MySqlClient.MySqlException ex)
{
    MessageBox.Show(ex.Message);
}

浣犱篃鍙互灏嗚繛鎺ュ瓧绗︿覆浼犻掔粰MySqlConnection绫荤殑鏋勯犲嚱鏁帮細

[VB]

Dim myConnectionString as String

myConnectionString = "server=127.0.0.1;" _
              & "uid=root;" _
              & "pwd=12345;" _
              & "database=test;" 

Try
    Dim conn As New MySql.Data.MySqlClient.MySqlConnection(myConnectionString)
    conn.Open()
Catch ex As MySql.Data.MySqlClient.MySqlException
   MessageBox.Show(ex.Message)
End Try
  

[C#]

MySql.Data.MySqlClient.MySqlConnection conn;
string myConnectionString;

myConnectionString = "server=127.0.0.1;uid=root;" +
    "pwd=12345;database=test;";

try
{
    conn = new MySql.Data.MySqlClient.MySqlConnection(myConnectionString);
    conn.Open();
}
catch (MySql.Data.MySqlClient.MySqlException ex)
{
    MessageBox.Show(ex.Message);
}
涓鏃︽墦寮浜嗚繛鎺ワ紝鍏朵粬MySQL Connector/NET绫讳篃鑳戒娇鐢ㄨ杩炴帴涓嶮ySQL鏈嶅姟鍣ㄨ繘琛岄氫俊銆
26.2.4.2.4. 澶勭悊杩炴帴閿欒

鐢变簬涓庡閮ㄦ湇鍔″櫒鐨勮繛鎺ヤ笉鍙娴嬶紝搴斾负浣犵殑.NET搴旂敤绋嬪簭娣诲姞閿欒澶勭悊鍔熻兘锛岃繖鐐瑰緢閲嶈銆傚嚭鐜拌繛鎺ラ敊璇椂锛MySqlConnection绫诲皢杩斿洖1涓MySqlException瀵硅薄銆璇ュ璞℃湁涓や釜鍦ㄥ鐞嗛敊璇椂鍗佸垎鏈夌敤鐨勫睘鎬э細

         Message锛氭弿杩板綋鍓嶅紓甯哥殑娑堟伅銆

         Number锛歁ySQL閿欒缂栧彿銆

澶勭悊閿欒鏃讹紝鍙牴鎹敊璇紪鍙蜂簡瑙e簲鐢ㄧ▼搴忕殑鍝嶅簲銆傝繘琛岃繛鎺ユ椂鏈甯歌鐨勪袱涓敊璇紪鍙峰涓嬶細

         0: 鏃犳硶杩炴帴鍒版湇鍔″櫒銆

         1045: 鏃犳晥鐨勭敤鎴峰悕鍜岋紡鎴栧瘑鐮併

鍦ㄤ笅闈㈢殑浠g爜涓紝浠嬬粛浜嗘牴鎹疄闄呴敊璇敼缂栧簲鐢ㄧ▼搴忕殑鏂规硶锛

[VB]

Dim myConnectionString as String

myConnectionString = "server=127.0.0.1;" _
          & "uid=root;" _
          & "pwd=12345;" _
          & "database=test;" 

Try
    Dim conn As New MySql.Data.MySqlClient.MySqlConnection(myConnectionString)
    conn.Open()
Catch ex As MySql.Data.MySqlClient.MySqlException
    Select Case ex.Number
        Case 0
            MessageBox.Show("Cannot connect to server. Contact administrator")
        Case 1045
            MessageBox.Show("Invalid username/password, please try again")
    End Select
End Try
  

[C#]

MySql.Data.MySqlClient.MySqlConnection conn;
string myConnectionString;

myConnectionString = "server=127.0.0.1;uid=root;" +  
    "pwd=12345;database=test;";

try
{
    conn = new MySql.Data.MySqlClient.MySqlConnection(myConnectionString);
    conn.Open();
}
    catch (MySql.Data.MySqlClient.MySqlException ex)
{
    switch (ex.Number)
    {
        case 0:
            MessageBox.Show("Cannot connect to server.  Contact administrator");
        case 1045:
            MessageBox.Show("Invalid username/password, please try again");
    }
}
  

26.2.4.3. 涓庨澶勭悊璇彞涓璧蜂娇鐢∕ySQL Connector/NET

26.2.4.3.1. 鍓嶈█
浠嶮ySQL 4.1寮濮嬶紝鑳藉涓嶮ySQL Connector/NET涓璧蜂娇鐢ㄩ澶勭悊璇彞銆備娇鐢ㄩ澶勭悊璇彞鑳藉鐜颁綇鏀瑰杽澶氭鎵ц鐨勬煡璇㈢殑鎬ц兘銆

瀵逛簬澶氭鎵ц鐨勮鍙ワ紝棰勫鐞嗘墽琛岀殑閫熷害蹇簬鐩存帴鎵ц锛岃繖鏄洜涓哄彧闇杩涜1娆¤В鏋愭搷浣溿傚湪鐩存帴鎵ц鐨勬儏鍐典笅锛屾瘡娆℃墽琛屾椂鍧囧皢杩涜瑙f瀽鎿嶄綔銆傞澶勭悊鎵ц杩樿兘闄嶄綆缃戠粶閫氫俊閲忥紝杩欐槸鍥犱负瀵逛簬棰勫鐞嗚鍙ョ殑姣忔鎵ц锛屼粎闇鍙戦佺敤浜庡弬鏁扮殑鏁版嵁銆

棰勫鐞嗚鍙ョ殑鍙︿竴浼樼偣鏄紝瀹冭兘浣跨敤浜岃繘鍒跺崗璁紝杩欎娇寰楀鎴风鍜屾湇鍔″櫒闂寸殑鏁版嵁浼犺緭鏇存湁鏁堢巼銆

26.2.4.3.2. 鍦∕ySQL Connector/NET涓噯澶囪鍙
涓轰簡鍑嗗濂借鍙ワ紝闇鍒涘缓1涓懡浠ゅ璞★紝骞朵负鏌ヨ璁剧疆.CommandText灞炴с

杈撳叆璇彞鍚庯紝璋冪敤MySqlCommand瀵硅薄鐨.Prepare鏂规硶銆瀹屾垚璇彞鐨勫噯澶囧悗锛屼负鏌ヨ涓殑姣忎釜鍏冪礌娣诲姞鍙傛暟銆

杈撳叆鏌ヨ骞惰緭鍏ュ弬鏁板悗锛屼娇鐢.ExecuteNonQuery().ExecuteScalar()銆佹垨.ExecuteReader鏂规硶鎵ц璇彞銆

瀵逛簬鍚庣画鐨勬墽琛屾搷浣滐紝浠呴渶鏇存敼鍙傛暟鍊煎苟鍐嶆璋冪敤鎵ц鏂规硶锛屾棤闇璁剧疆.CommandText灞炴ф垨閲嶆柊瀹氫箟鍙傛暟銆

[VB]

Dim conn As New MySqlConnection
Dim cmd As New MySqlCommand
  
conn.ConnectionString = strConnection
 
Try
   conn.Open()
   cmd.Connection = conn
 
   cmd.CommandText = "INSERT INTO myTable VALUES(NULL, ?number, ?text)"
   cmd.Prepare()
 
   cmd.Parameters.Add("?number", 1)
   cmd.Parameters.Add("?text", "One")
 
   For i = 1 To 1000
       cmd.Parameters("?number").Value = i
       cmd.Parameters("?text").Value = "A string value"
 
       cmd.ExecuteNonQuery()
     Next 
Catch ex As MySqlException
    MessageBox.Show("Error " & ex.Number & " has occurred: " & ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
  

[C#]

MySql.Data.MySqlClient.MySqlConnection conn;
MySql.Data.MySqlClient.MySqlCommand cmd;
  
conn = new MySql.Data.MySqlClient.MySqlConnection();
cmd = new MySql.Data.MySqlClient.MySqlCommand();
 
conn.ConnectionString = strConnection;
 
try
{
    conn.Open();
    cmd.Connection = conn;
 
    cmd.CommandText = "INSERT INTO myTable VALUES(NULL, ?number, ?text)";
    cmd.Prepare();
 
    cmd.Parameters.Add("?number", 1);
    cmd.Parameters.Add("?text", "One");
 
    for (int i=1; i <= 1000; i++)
    {
        cmd.Parameters["?number"].Value = i;
        cmd.Parameters["?text"].Value = "A string value";
 
        cmd.ExecuteNonQuery();
    }
}
catch (MySql.Data.MySqlClient.MySqlException ex)
{
    MessageBox.Show("Error " + ex.Number + " has occurred: " + ex.Message,
        "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}

26.2.4.4. 鐢∕ySQL Connector/NET璁块棶瀛樺偍绋嬪簭

26.2.4.4.1. 鍓嶈█

闅忕潃MySQL鐗堟湰5鐨勫彂甯冿紝MySQL鏈嶅姟鍣ㄧ洰鍓嶆敮鎸佸瓨鍌ㄧ▼搴忥紝瀹冮噰鐢ㄤ簡SQL 2003瀛樺偍绋嬪簭鐨勮娉曘

 

瀛樺偍绋嬪簭鎸囩殑鏄兘澶熶繚瀛樺湪鏈嶅姟鍣ㄤ笂鐨勪竴缁凷QL璇彞銆 涓鏃﹀畬鎴愪簡璇ユ搷浣滐紝瀹㈡埛绔棤闇鍐嶆鍙戝嚭鍗曠嫭璇彞锛岃屼粎闇寮曠敤瀛樺偍绋嬪簭鍙栬屼唬涔嬨

鍦ㄤ笅杩版儏鍐典笅锛屽瓨鍌ㄧ▼搴忓挨鍏舵湁鐢細

         澶氫釜瀹㈡埛绔簲鐢ㄧ▼搴忔槸閲囩敤涓嶅悓璇█缂栧啓鐨勬垨宸ヤ綔鍦ㄤ笉鍚屽钩鍙颁笂锛屼絾闇鎵ц鐩稿悓鐨勬暟鎹簱鎿嶄綔銆

         瀹夊叏鎬ф瀬鍏堕噸瑕佹椂銆備緥濡傦紝瀵逛簬鎵鏈夊叡鍚屾搷浣滐紝閾惰閲囩敤浜嗗瓨鍌ㄧ▼搴忋傝繖鏍凤紝灏辫兘鎻愪緵涓鑷翠笖瀹夊叏鐨勭幆澧冿紝鑰屼笖杩欑被瀛樺偍绋嬪簭鑳藉淇濊瘉姣忔鎿嶄綔鍧囧叿鏈夋伆褰撶櫥褰曘傚湪杩欑被璁剧疆涓嬶紝搴旂敤绋嬪簭鍜岀敤鎴锋棤娉曠洿鎺ヨ闂暟鎹簱琛紝浣嗚兘鎵ц鐗瑰畾鐨勫瓨鍌ㄧ▼搴忋

MySQL Connector/NET鏀寔閫氳繃MySqlCommand瀵硅薄鐨勫瓨鍌ㄧ▼搴忚皟鐢ㄣ浣跨敤MySqlCommand.Parameters闆嗭紝鑳藉灏嗘暟鎹紶鍏ュ拰浼犲嚭MySQL瀛樺偍绋嬪簭銆

鍦ㄦ湰鑺備腑锛屾湭娣卞害浠嬬粛鍒涘缓瀛樺偍绋嬪簭鏂归潰鐨勪俊鎭紝瑕佹兂浜嗚В杩欑被淇℃伅锛岃鍙傝MySQL鍙傝冩墜鍐岀殑瀛樺偍绋嬪簭

鍦∕ySQL Connector/NET瀹夎鐨Samples鐩綍涓嬶紝鍙壘鍒1涓浉搴旂殑绀轰緥锛岃绀轰緥婕旂ず浜嗕笌MySQL Connector/NET涓璧蜂娇鐢ㄥ瓨鍌ㄧ▼搴忕殑鏂规硶銆

26.2.4.4.2. 浠嶮ySQL Connector/NET鍒涘缓瀛樺偍绋嬪簭

鍙娇鐢ㄥ绉嶅伐鍏峰垱寤篗ySQL涓殑瀛樺偍绋嬪簭銆傞鍏堬紝鍙娇鐢mysql鍛戒护琛屽鎴风鍒涘缓瀛樺偍绋嬪簭銆傚叾娆★紝鍙娇鐢MySQL Query Browser GUI瀹㈡埛绔垱寤哄瓨鍌ㄧ▼搴忋傛渶鍚庯紝鍙娇鐢MySqlCommand瀵硅薄鐨.ExecuteNonQuery鏂规硶鍒涘缓瀛樺偍绋嬪簭銆

[VB]

Dim conn As New MySqlConnection
Dim cmd As New MySqlCommand

conn.ConnectionString = "server=127.0.0.1;" _
    & "uid=root;" _
    & "pwd=12345;" _
    & "database=test"

Try
    conn.Open()
    cmd.Connection = conn

    cmd.CommandText = "CREATE PROCEDURE add_emp(" _
        & "IN fname VARCHAR(20), IN lname VARCHAR(20), IN bday DATETIME, OUT empno INT) " _
        & "BEGIN INSERT INTO emp(first_name, last_name, birthdate) " _
        & "VALUES(fname, lname, DATE(bday)); SET empno = LAST_INSERT_ID(); END"
 
    cmd.ExecuteNonQuery()
Catch ex As MySqlException
    MessageBox.Show("Error " & ex.Number & " has occurred: " & ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try

[C#]

MySql.Data.MySqlClient.MySqlConnection conn;
MySql.Data.MySqlClient.MySqlCommand cmd;

conn = new MySql.Data.MySqlClient.MySqlConnection();
cmd = new MySql.Data.MySqlClient.MySqlCommand();

conn.ConnectionString = "server=127.0.0.1;uid=root;" +
    "pwd=12345;database=test;";

try
{
    conn.Open();
    cmd.Connection = conn;

    cmd.CommandText = "CREATE PROCEDURE add_emp(" +
        "IN fname VARCHAR(20), IN lname VARCHAR(20), IN bday DATETIME, OUT empno INT) " +
        "BEGIN INSERT INTO emp(first_name, last_name, birthdate) " +
        "VALUES(fname, lname, DATE(bday)); SET empno = LAST_INSERT_ID(); END";

    cmd.ExecuteNonQuery();
}
catch (MySql.Data.MySqlClient.MySqlException ex)
{
MessageBox.Show("Error " + ex.Number + " has occurred: " + ex.Message,
    "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
璇锋敞鎰忥紝涓嶅悓浜庡懡浠よ鍜孏UI瀹㈡埛绔紝鍦∕ySQL Connector/NET涓垱寤哄瓨鍌ㄧ▼搴忔椂涓嶉渶瑕佹寚瀹氱壒娈婄殑瀹氱晫绗︺
26.2.4.4.3. 浠嶮ySQL Connector/NET璋冪敤瀛樺偍绋嬪簭

瑕佹兂浣跨敤MySQL Connector/NET鏉ヨ皟鐢ㄥ瓨鍌ㄧ▼搴忥紝搴斿垱寤1涓MySqlCommand瀵硅薄锛屽苟灏嗗瓨鍌ㄧ▼搴忓悕浣滀负.CommandText灞炴т紶閫掋.CommandType灞炴ц缃负CommandType.StoredProcedure銆

鍛藉悕浜瀛樺偍绋嬪簭鍚庯紝涓哄瓨鍌ㄧ▼搴忎腑鐨勬瘡涓弬鏁板垱寤1涓狹ySqlCommand鍙傛暟銆鐢ㄥ弬鏁板悕鍜屽寘鍚肩殑瀵硅薄瀹氫箟IN鍙傛暟锛岀敤鍙傛暟鍚嶅拰棰勮灏嗚繑鍥炵殑鏁版嵁绫诲瀷瀹氫箟OUT鍙傛暟銆傚浜庢墍鏈夊弬鏁帮紝鍧囬渶瀹氫箟鍙傛暟鏂瑰悜銆

瀹氫箟瀹屽弬鏁板悗锛屼娇鐢MySqlCommand.ExecuteNonQuery()鏂规硶璋冪敤瀛樺偍绋嬪簭銆

[VB]

Dim conn As New MySqlConnection
Dim cmd As New MySqlCommand

conn.ConnectionString = "server=127.0.0.1;" _
    & "uid=root;" _
    & "pwd=12345;" _
    & "database=test"

Try
    conn.Open()
    cmd.Connection = conn

    cmd.CommandText = "add_emp"
    cmd.CommandType = CommandType.StoredProcedure

    cmd.Parameters.Add("?lname", 'Jones')
    cmd.Parameters("?lname").Direction = ParameterDirection.Input

    cmd.Parameters.Add("?fname", 'Tom')
    cmd.Parameters("?fname").Direction = ParameterDirection.Input

    cmd.Parameters.Add("?bday", #12/13/1977 2:17:36 PM#)
    cmd.Parameters("?bday").Direction = ParameterDirection.Input

    cmd.Parameters.Add("?empno", MySqlDbType.Int32)
    cmd.Parameters("?empno").Direction = ParameterDirection.Output

    cmd.ExecuteNonQuery()

    MessageBox.Show(cmd.Parameters("?empno").Value)
Catch ex As MySqlException
    MessageBox.Show("Error " & ex.Number & " has occurred: " & ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try

[C#]

MySql.Data.MySqlClient.MySqlConnection conn;
MySql.Data.MySqlClient.MySqlCommand cmd;

conn = new MySql.Data.MySqlClient.MySqlConnection();
cmd = new MySql.Data.MySqlClient.MySqlCommand();

conn.ConnectionString = "server=127.0.0.1;uid=root;" +
    "pwd=12345;database=test;";

try
{
    conn.Open();
    cmd.Connection = conn;

    cmd.CommandText = "add_emp";
    cmd.CommandType = CommandType.StoredProcedure;

    cmd.Parameters.Add("?lname", "Jones");
    cmd.Parameters("?lname").Direction = ParameterDirection.Input;

    cmd.Parameters.Add("?fname", "Tom");
    cmd.Parameters("?fname").Direction = ParameterDirection.Input;

    cmd.Parameters.Add("?bday", DateTime.Parse("12/13/1977 2:17:36 PM"));
    cmd.Parameters("?bday").Direction = ParameterDirection.Input;

    cmd.Parameters.Add("?empno", MySqlDbType.Int32);
    cmd.Parameters("?empno").Direction = ParameterDirection.Output;

    cmd.ExecuteNonQuery();

    MessageBox.Show(cmd.Parameters("?empno").Value);
}
catch (MySql.Data.MySqlClient.MySqlException ex)
{
    MessageBox.Show("Error " + ex.Number + " has occurred: " + ex.Message,
      "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
涓鏃﹁皟鐢ㄤ簡瀛樺偍绋嬪簭锛屽彲浣跨敤MySqlConnector.Parameters闆嗙殑.Value灞炴ф绱㈣緭鍑哄弬鏁扮殑鍊笺

26.2.4.5. 鐢–onnector/NET澶勭悊BLOB鏁版嵁

26.2.4.5.1. 鍓嶈█
MySQL鐨1绉嶇敤閫旀槸鍦˙LOB鍒椾腑淇濆瓨浜岃繘鍒舵暟鎹侻ySQL鏀寔4绉嶄笉鍚岀殑BLOB鏁版嵁绫诲瀷锛TINYBLOB, BLOB, MEDIUMBLOBLONGBLOB

鍙娇鐢–onnector/NET璁块棶淇濆瓨鍦˙LOB鍒椾腑鐨勬暟鎹紝骞惰兘浣跨敤瀹㈡埛绔唬鐮佸杩欑被鏁版嵁杩涜鎿嶄綔銆備娇鐢–onnector/NET鍜孊LOB鏁版嵁鏃讹紝鏃犵壒娈婅姹傘

鍦ㄦ湰鑺備腑锛岀粰鍑轰簡鏁颁釜绠鍗曠殑浠g爜绀轰緥锛屽湪MySQL Connector/NET瀹夎鐨Samples鐩綍涓嬶紝鍙壘鍒1涓畬鏁寸殑绀轰緥搴旂敤绋嬪簭銆

26.2.4.5.2. 鍑嗗MySQL鏈嶅姟鍣
涓嶣LOB鏁版嵁涓璧蜂娇鐢∕ySQL鐨勭1姝ユ槸閰嶇疆鏈嶅姟鍣ㄣ傞鍏堬紝璁╂垜浠粠鍒涘缓瑕佽闂殑琛ㄥ紑濮嬨傚湪鎴戠殑鏂囦欢琛ㄤ腑锛岄氬父鏈4鍒楋細1涓叿鏈夋伆褰撳ぇ灏忕殑AUTO_INCREMENT鍒楋紙UNSIGNED SMALLINT锛夛紝鐢ㄤ簬淇濆瓨璇嗗埆鏂囦欢鐨勪富閿紱1涓猇ARCHAR鍒楋紝鐢ㄤ簬淇濆瓨鏂囦欢鍚嶏紱1涓猆NSIGNED MEDIUMINT鍒楋紝鐢ㄤ簬淇濆瓨鏂囦欢鐨勫ぇ灏忥紱浠ュ強1涓敤浜庝繚瀛樻枃浠舵湰韬殑MEDIUMBLOB鍒椼傚浜庢湰渚嬶紝鎴戝皢浣跨敤涓嬭堪琛ㄥ畾涔夛細
CREATE TABLE file(
file_id SMALLINT UNSIGNED AUTO_INCREMENT NOT NULL PRIMARY KEY,
file_name VARCHAR(64) NOT NULL,
file_size MEDIUMINT UNSIGNED NOT NULL,
file MEDIUMBLOB NOT NULL);

瀹屾垚琛ㄧ殑鍒涘缓鍚庯紝鎴栬闇瑕佹洿鏀筸ax_allowed_packet绯荤粺鍙橀噺銆傝鍙橀噺鍐冲畾浜嗚兘澶熷彂閫佺粰MySQL鏈嶅姟鍣ㄧ殑淇℃伅鍖咃紙鍗冲崟涓锛夊ぇ灏忋傞粯璁ゆ儏鍐典笅锛屾湇鍔″櫒鑳藉鎺ュ彈鏉ヨ嚜瀹㈡埛绔簲鐢ㄧ▼搴忕殑淇℃伅鍖呮渶澶т负1MB銆傚鏋滀笉鎵撶畻瓒呰繃1MB锛屾儏鍐佃壇濂姐傚鏋滄墦绠楀湪鏂囦欢浼犺緭涓秴鍑1MB锛屽繀椤诲鍔犺鏁板笺

鍙互浣跨敤鈥淢ySQL绯荤粺绠$悊鍛樼殑鍚姩鍙橀噺鈥濆睆骞曟洿鏀筸ax_allowed_packet閫夐」銆傚湪鈥滆仈缃戔濋夐」鍗$殑鈥滃唴瀛樷濋儴鍒嗭紝鎭板綋璋冩暣鈥滃厑璁哥殑鏈澶у尖濋夐」銆傚畬鎴愬肩殑璋冩暣鍚庯紝鐐瑰嚮鈥滃簲鐢ㄦ洿鏀光濇寜閽紝骞朵娇鐢ㄢ淢ySQL绠$悊鍛樷濈殑鈥滄湇鍔℃帶鍒垛濆睆骞曢噸鏂板惎鍔ㄦ湇鍔″櫒銆備篃鍙互鍦╩y.cnf鏂囦欢涓洿鎺ヨ皟鏁磋鍊硷紙娣诲姞1琛岋紝max_allowed_packet=xxM锛夛紝鎴栧湪MySQL涓娇鐢⊿ET max_allowed_packet=xxM銆

璁剧疆max_allowed_packet鏃跺簲淇濆畧浜涳紝杩欐槸鍥犱负浼犺緭BLOB鏁版嵁闇瑕佷竴娈垫椂闂淬傛伆褰撳湴璁剧疆璇ュ硷紝浣夸箣涓庨鏈熶娇鐢ㄧ浉绗︼紝骞跺湪蹇呰鏃跺澶ц鍊笺

26.2.4.5.3. 灏嗘枃浠跺啓鍏ユ暟鎹簱

瑕佹兂灏嗘枃浠跺啓鍏ユ暟鎹簱锛岄渶瑕佸皢鏂囦欢杞崲涓哄瓧鑺傛暟缁勶紝鐒跺悗灏嗗瓧鑺傛暟缁勭敤浣淚NSERT鏌ヨ鐨勫弬鏁般

鍦ㄤ笅杩颁唬鐮佷腑锛屼娇鐢‵ileStream瀵硅薄鎵撳紑浜1涓枃浠讹紝灏嗗叾璇诲叆鑷冲瓧鑺傛暟缁勶紝鐒跺悗灏嗗叾鎻掑叆鍒版枃浠惰〃涓細

[VB]

Dim conn As New MySqlConnection
Dim cmd As New MySqlCommand

Dim SQL As String

Dim FileSize As UInt32
Dim rawData() As Byte
Dim fs As FileStream

conn.ConnectionString = "server=127.0.0.1;" _
    & "uid=root;" _
    & "pwd=12345;" _
    & "database=test"

Try
    fs = New FileStream("c:\image.png", FileMode.Open, FileAccess.Read)
    FileSize = fs.Length
    
    rawData = New Byte(FileSize) {}
    fs.Read(rawData, 0, FileSize)
    fs.Close()
    
    conn.Open()
    
    SQL = "INSERT INTO file VALUES(NULL, ?FileName, ?FileSize, ?File)"
    
    cmd.Connection = conn
    cmd.CommandText = SQL
    cmd.Parameters.Add("?FileName", strFileName)
    cmd.Parameters.Add("?FileSize", FileSize)
    cmd.Parameters.Add("?File", rawData)
    
    cmd.ExecuteNonQuery()
    
    MessageBox.Show("File Inserted into database successfully!", _
    "Success!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
    
    conn.Close()
Catch ex As Exception
    MessageBox.Show("There was an error: " & ex.Message, "Error", _
        MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
  

[C#]

MySql.Data.MySqlClient.MySqlConnection conn;
MySql.Data.MySqlClient.MySqlCommand cmd;

conn = new MySql.Data.MySqlClient.MySqlConnection();
cmd = new MySql.Data.MySqlClient.MySqlCommand();

string SQL;
UInt32 FileSize;
byte[] rawData;
FileStream fs;

conn.ConnectionString = "server=127.0.0.1;uid=root;" +
    "pwd=12345;database=test;";

try
{
    fs = new FileStream(@"c:\image.png", FileMode.Open, FileAccess.Read);
    FileSize = fs.Length;

    rawData = new byte[FileSize];
    fs.Read(rawData, 0, FileSize);
    fs.Close();

    conn.Open();

    SQL = "INSERT INTO file VALUES(NULL, ?FileName, ?FileSize, ?File)";

    cmd.Connection = conn;
    cmd.CommandText = SQL;
    cmd.Parameters.Add("?FileName", strFileName);
    cmd.Parameters.Add("?FileSize", FileSize);
    cmd.Parameters.Add("?File", rawData);

    cmd.ExecuteNonQuery();

    MessageBox.Show("File Inserted into database successfully!",
        "Success!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

    conn.Close();
}
catch (MySql.Data.MySqlClient.MySqlException ex)
{
    MessageBox.Show("Error " + ex.Number + " has occurred: " + ex.Message,
        "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
 
FileStream瀵硅薄鐨Read鏂规硶鍙敤浜庡皢鏂囦欢鍔犺浇鍒板瓧鑺傛暟缁勪腑锛岃瀛楄妭鏁扮粍鐨勫ぇ灏忔槸鏍规嵁FileStream瀵硅薄鐨Length灞炴х‘瀹氱殑銆

灏嗗瓧鑺傛暟缁勬寚瀹氫负MySqlCommand瀵硅薄鐨勫弬鏁板悗锛岃皟鐢‥xecuteNonQuery鏂规硶锛屽苟灏咮LOB鎻掑叆鍒版枃浠惰〃涓

26.2.4.5.4. 灏咮LOB浠庢暟鎹簱璇诲彇鍒扮鐩樹笂鐨勬枃浠

涓鏃﹀皢鏂囦欢鍔犺浇鍒颁簡鏂囦欢琛ㄤ腑锛屽氨鑳戒娇鐢MySqlDataReader绫绘潵妫绱㈠畠銆

鍦ㄤ笅杩颁唬鐮佷腑锛屼粠鏂囦欢琛ㄦ彁鍙栦簡1琛岋紝鐒跺悗灏嗘暟鎹杞藉埌瑕佸啓鍏ヨ嚦纾佺洏鐨FileStream瀵硅薄銆

[VB]

Dim conn As New MySqlConnection
Dim cmd As New MySqlCommand
Dim myData As MySqlDataReader
Dim SQL As String
Dim rawData() As Byte
Dim FileSize As UInt32
Dim fs As FileStream

conn.ConnectionString = "server=127.0.0.1;" _
    & "uid=root;" _
    & "pwd=12345;" _
    & "database=test"

SQL = "SELECT file_name, file_size, file FROM file"

Try
    conn.Open()
    
    cmd.Connection = conn
    cmd.CommandText = SQL
    
    myData = cmd.ExecuteReader
    
    If Not myData.HasRows Then Throw New Exception("There are no BLOBs to save")
    
    myData.Read()
    
    FileSize = myData.GetUInt32(myData.GetOrdinal("file_size"))
    rawData = New Byte(FileSize) {}
    
    myData.GetBytes(myData.GetOrdinal("file"), 0, rawData, 0, FileSize)
    
    fs = New FileStream("C:\newfile.png", FileMode.OpenOrCreate, FileAccess.Write)
    fs.Write(rawData, 0, FileSize)
    fs.Close()
    
    MessageBox.Show("File successfully written to disk!", "Success!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
    
    myData.Close()
    conn.Close()
Catch ex As Exception
    MessageBox.Show("There was an error: " & ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
  

[C#]

MySql.Data.MySqlClient.MySqlConnection conn;
MySql.Data.MySqlClient.MySqlCommand cmd;
MySql.Data.MySqlClient.MySqlDataReader myData;

conn = new MySql.Data.MySqlClient.MySqlConnection();
cmd = new MySql.Data.MySqlClient.MySqlCommand();

string SQL;
UInt32 FileSize;
byte[] rawData;
FileStream fs;

conn.ConnectionString = "server=127.0.0.1;uid=root;" +
    "pwd=12345;database=test;";

SQL = "SELECT file_name, file_size, file FROM file";

try
{
    conn.Open();

    cmd.Connection = conn;
    cmd.CommandText = SQL;

    myData = cmd.ExecuteReader();

    if (! myData.HasRows)
        throw new Exception("There are no BLOBs to save");

    myData.Read();

    FileSize = myData.GetUInt32(myData.GetOrdinal("file_size"));
    rawData = new byte[FileSize];

    myData.GetBytes(myData.GetOrdinal("file"), 0, rawData, 0, FileSize);

    fs = new FileStream(@"C:\newfile.png", FileMode.OpenOrCreate, FileAccess.Write);
    fs.Write(rawData, 0, FileSize);
    fs.Close();

    MessageBox.Show("File successfully written to disk!",
        "Success!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);

    myData.Close();
    conn.Close();
}
catch (MySql.Data.MySqlClient.MySqlException ex)
{
    MessageBox.Show("Error " + ex.Number + " has occurred: " + ex.Message,
        "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
 
杩炴帴鍚庯紝鏂囦欢琛ㄧ殑鍐呭灏嗚鍔犺浇鍒MySqlDataReader瀵硅薄涓浣跨敤MySqlDataReader鐨GetBytes鏂规硶灏咮LOB鍔犺浇鍒板瓧鑺傛暟缁勶紝鐒跺悗浣跨敤FileStream瀵硅薄灏嗗瓧鑺傛暟鎹啓鍏ョ鐩樸

MySqlDataReader鐨GetOrdinal鏂规硶鍙敤浜庣‘瀹氬懡鍚嶅垪鐨勬暣鏁扮储寮曘濡傛灉SELECT鏌ヨ鐨勫垪椤哄簭鍙戠敓鍙樺寲锛屼娇鐢GetOrdinal鏂规硶鑳藉闃叉閿欒銆

26.2.4.6. 涓嶤rystal Reports涓璧蜂娇鐢∕ySQL Connector/NET

26.2.4.6.1. 鍓嶈█
Crystal Reports鏄疻indows搴旂敤绋嬪簭寮鍙戜汉鍛樼敤浜庨氭姤鏂囨。鐢熸垚鐨勫父鐢ㄥ伐鍏枫傚湪鏈妭涓紝浠嬬粛浜咰rystal Reports XI涓嶮ySQL鍜孋onnector/NET涓璧蜂娇鐢ㄧ殑鏂规硶銆

鍦∕ySQL Connector/NET瀹夎鐨凷amples鐩綍鐨凜rystalDemo瀛愮洰褰曚笅锛屽彲鎵惧埌瀹屾暣鐨勭ず渚嬪簲鐢ㄧ▼搴忋

26.2.4.6.2. 鍒涘缓鏁版嵁婧

鍦–rystal Reports涓垱寤烘姤鍛婃椂锛屽湪璁捐鎶ュ憡鏃讹紝鏈変袱涓敤浜庤闂甅ySQL鏁版嵁鐨勯夐」銆

绗1涓夐」鏄紝璁捐鎶ュ憡鏃讹紝浣跨敤Connector/ODBC浣滀负ADO鏁版嵁婧愩備綘鑳藉娴忚鏁版嵁搴擄紝骞朵娇鐢ㄦ嫋鏀惧紡鎿嶄綔閫夋嫨琛ㄥ拰瀛楁浠ュ垱寤烘姤鍛娿傝鏂规硶鐨勭己鐐规槸锛屽繀椤诲湪搴旂敤绋嬪簭涓墽琛岄澶栨搷浣滀互鐢熸垚涓庢姤鍛婇鏈熺殑鏁版嵁闆嗗尮閰嶇殑鏁版嵁闆嗐

绗2涓夐」鏄湪VB.NET涓垱寤烘暟鎹泦锛屽苟灏嗗叾淇濆瓨涓篨ML鏍煎紡銆傞殢鍚庯紝璇ML鏂囦欢鍙鐢ㄤ簬璁捐鎶ュ憡銆傚湪搴旂敤绋嬪簭涓樉绀烘姤鍛婃椂锛屽畠鐨勮〃鐜扮浉褰撹壇濂斤紝浣嗚璁℃椂鐨勯氱敤鎬ц緝宸紝杩欐槸鍥犱负鍦ㄥ垱寤烘暟鎹泦鏃讹紝蹇呴』閫夋嫨鎵鏈夌殑鐩稿叧鍒椼傚鏋滃繕璁伴夋嫨浜嗘煇涓鍒楋紝鍦ㄨ兘澶熷皢鍒楁坊鍔犲埌鎶ュ憡鍓嶏紝蹇呴』閲嶆柊鍒涘缓鏁版嵁闆嗐

浣跨敤涓嬭堪浠g爜锛屽彲鏍规嵁鏌ヨ鎿嶄綔鍒涘缓鏁版嵁闆嗭紝骞跺皢鍏跺啓鍏ョ鐩樸

[VB]

Dim myData As New DataSet
Dim conn As New MySqlConnection
Dim cmd As New MySqlCommand
Dim myAdapter As New MySqlDataAdapter

conn.ConnectionString = "server=127.0.0.1;" _
    & "uid=root;" _
    & "pwd=12345;" _
    & "database=world"

Try
    conn.Open()
    cmd.CommandText = "SELECT city.name AS cityName, city.population AS CityPopulation, " _ 
        & "country.name, country.population, country.continent " _
        & "FROM country, city ORDER BY country.continent, country.name"
    cmd.Connection = conn
    
    myAdapter.SelectCommand = cmd
    myAdapter.Fill(myData)
    
    myData.WriteXml("C:\dataset.xml", XmlWriteMode.WriteSchema)
Catch ex As Exception
    MessageBox.Show(ex.Message, "Report could not be created", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
 

[C#]

DataSet myData = new DataSet();
MySql.Data.MySqlClient.MySqlConnection conn;
MySql.Data.MySqlClient.MySqlCommand cmd;
MySql.Data.MySqlClient.MySqlDataAdapter myAdapter;

conn = new MySql.Data.MySqlClient.MySqlConnection();
cmd = new MySql.Data.MySqlClient.MySqlCommand();
myAdapter = new MySql.Data.MySqlClient.MySqlDataAdapter();

conn.ConnectionString = "server=127.0.0.1;uid=root;" +
  "pwd=12345;database=test;";
  
try
{
  cmd.CommandText = "SELECT city.name AS cityName, city.population AS CityPopulation, " +
  "country.name, country.population, country.continent " +
  "FROM country, city ORDER BY country.continent, country.name";
  cmd.Connection = conn;
  
  myAdapter.SelectCommand = cmd;
  myAdapter.Fill(myData);
  
  myData.WriteXml(@"C:\dataset.xml", XmlWriteMode.WriteSchema);
}
catch (MySql.Data.MySqlClient.MySqlException ex)
{
  MessageBox.Show(ex.Message, "Report could not be created",
  MessageBoxButtons.OK, MessageBoxIcon.Error);
}
璁捐鎶ュ憡鏃讹紝鍙皢璇ヤ唬鐮佺敓鎴愮殑XML鏂囦欢鐢ㄤ綔ADO.NET XML鏁版嵁婧愩

濡傛灉浣犻夋嫨浣跨敤Connector/ODBC鏉ヨ璁℃姤鍛婏紝鍙粠dev.mysql.com涓嬭浇瀹冦

26.2.4.6.3. 鍒涘缓鎶ュ憡
瀵逛簬澶у鏁板簲鐢ㄧ洰鐨勶紝鏍囧噯鐨勬姤鍛婂悜瀵煎簲鑳藉府鍔╀綘瀹屾垚鎶ュ憡鐨勬渶鍒濆垱寤恒傝鎯冲惎鍔ㄥ悜瀵硷紝鎵撳紑Crystal Reports骞朵粠鈥滄枃浠垛濊彍鍗曢夋嫨鈥淣ew > Standard Report鈥濋夐」銆

鍚戝棣栧厛瑕佹眰浣犳彁渚涙暟鎹簮銆傚鏋滀綘姝d娇鐢–onnector/ODBC浣滀负鏁版嵁婧愶紝閫夋嫨鏁版嵁婧愭椂锛岃浣跨敤OLE DB (ADO)鏍戠殑鈥滅敤浜嶰DBC鐨凮LEDB provider鈥濋夐」锛岋紝鑰屼笉鏄潵鑷狾DBC (RDO)鐨勫搴旈夐」銆傚鏋滀綘浣跨敤鐨勬槸宸蹭繚瀛樼殑鏁版嵁闆嗭紝璇烽夋嫨ADO.NET (XML)閫夐」锛屽苟娴忚浣犱繚瀛樼殑鏁版嵁闆嗐

鍦ㄦ姤鍛婄殑鍒涘缓杩囩▼涓紝鍓╀綑閮ㄥ垎灏嗙敱鍚戝鑷姩瀹屾垚銆

鍒涘缓瀹屾姤鍛婂悗锛岄夋嫨鈥滄枃浠垛濊彍鍗曚腑鐨勨淩eport Options...鈥濊彍鍗曢」銆傚彇娑堝鈥淪ave Data With Report鈥濓紙涓庢姤鍛婁竴璧蜂繚瀛樻暟鎹級閫夐」鐨勯夋嫨銆傝繖鏍凤紝灏辫兘闃叉淇濆瓨鐨勬暟鎹共鎵板簲鐢ㄧ▼搴忎腑鐨勬暟鎹姞杞芥搷浣溿

26.2.4.6.4. 鏄剧ず鎶ュ憡

瑕佹兂鏄剧ず鎶ュ憡锛岄鍏堢敤鎶ュ憡鎵闇鐨勬暟鎹~鍏呮暟鎹泦锛岀劧鍚庡姞杞芥姤鍛婏紝骞跺皢鍏朵笌缁戝畾鍒版暟鎹泦銆傛渶鍚庯紝灏嗘姤鍛婁紶閫掔粰crViewer鎺у埗锛屼互渚垮悜鐢ㄦ埛鏄剧ず瀹冦

鍦ㄦ樉绀烘姤鍛婄殑椤圭洰涓紝闇瑕佷笅杩板紩鐢細

         CrytalDecisions.CrystalReports.Engine

         CrystalDecisions.ReportSource

         CrystalDecisions.Shared

         CrystalDecisions.Windows.Forms

鍦ㄤ笅杩颁唬鐮佷腑锛屽亣瀹氫綘浣跨敤鏁版嵁闆嗭紙鐢鍒涘缓鏁版嵁婧涓粰鍑虹殑浠g爜淇濆瓨鐨勬暟鎹泦锛夊垱寤轰簡鎶ュ憡锛屽苟鍦ㄥ悕涓衡myViewer鈥濈殑琛ㄥ崟涓婃湁1涓猚rViewer鎺т欢銆

[VB]

Imports CrystalDecisions.CrystalReports.Engine
Imports System.Data
Imports MySql.Data.MySqlClient

Dim myReport As New ReportDocument
Dim myData As New DataSet
Dim conn As New MySqlConnection
Dim cmd As New MySqlCommand
Dim myAdapter As New MySqlDataAdapter

conn.ConnectionString = _
    "server=127.0.0.1;" _
    & "uid=root;" _
    & "pwd=12345;" _
    & "database=test"

Try
    conn.Open()
    
    cmd.CommandText = "SELECT city.name AS cityName, city.population AS CityPopulation, " _ 
        & "country.name, country.population, country.continent " _
        & "FROM country, city ORDER BY country.continent, country.name"
    cmd.Connection = conn
    
    myAdapter.SelectCommand = cmd
    myAdapter.Fill(myData)
    
    myReport.Load(".\world_report.rpt")
    myReport.SetDataSource(myData)
    myViewer.ReportSource = myReport
Catch ex As Exception
    MessageBox.Show(ex.Message, "Report could not be created", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try

[C#]

using CrystalDecisions.CrystalReports.Engine;
using System.Data;
using MySql.Data.MySqlClient;

ReportDocument myReport = new ReportDocument();
DataSet myData = new DataSet();
MySql.Data.MySqlClient.MySqlConnection conn;
MySql.Data.MySqlClient.MySqlCommand cmd;
MySql.Data.MySqlClient.MySqlDataAdapter myAdapter;

conn = new MySql.Data.MySqlClient.MySqlConnection();
cmd = new MySql.Data.MySqlClient.MySqlCommand();
myAdapter = new MySql.Data.MySqlClient.MySqlDataAdapter();

conn.ConnectionString = "server=127.0.0.1;uid=root;" +
    "pwd=12345;database=test;";

try
{
    cmd.CommandText = "SELECT city.name AS cityName, city.population AS CityPopulation, " +
        "country.name, country.population, country.continent " +
        "FROM country, city ORDER BY country.continent, country.name";
    cmd.Connection = conn;

    myAdapter.SelectCommand = cmd;
    myAdapter.Fill(myData);

    myReport.Load(@".\world_report.rpt");
    myReport.SetDataSource(myData);
    myViewer.ReportSource = myReport;
}
catch (MySql.Data.MySqlClient.MySqlException ex)
{
    MessageBox.Show(ex.Message, "Report could not be created",
        MessageBoxButtons.OK, MessageBoxIcon.Error);
}

浣跨敤鐩稿悓鐨勬煡璇紙鐢ㄤ簬鐢熸垚鍓嶉潰淇濆瓨鐨勬暟鎹泦锛夛紝鍙敓鎴愭柊鐨勬暟鎹泦銆備竴鏃﹀~鍏呬簡鏁版嵁闆嗭紝鍙娇鐢≧eportDocument鍔犺浇鎶ュ憡鏂囦欢锛屽苟灏嗗叾涓庢暟鎹泦缁戝畾鍦ㄤ竴璧枫俁eportDocument鏄綔涓篶rViewer鐨凴eportSource鑰屼紶閫掔殑銆

浣跨敤Connector/ODBC浠庡崟涓〃鍒涘缓鎶ュ憡鏃讹紝閲囩敤浜嗙浉鍚岀殑鏂规硶銆傛暟鎹泦鏇挎崲鎶ュ憡涓娇鐢ㄧ殑琛紝骞舵伆褰撴樉绀烘姤鍛娿

濡傛灉鎶ュ憡鏄娇鐢–onnector/ODBC浠庡涓〃鍒涘缓鐨勶紝鍦ㄦ垜浠殑搴旂敤绋嬪簭涓繀椤诲垱寤哄叿鏈夊涓〃鐨勬暟鎹泦銆傝繖鏍凤紝灏辫兘鐢ㄦ暟鎹泦涓殑鎶ュ憡鏇挎崲鎶ュ憡鏁版嵁婧愪腑鐨勫悇涓〃銆

鍦ㄦ垜浠殑MySqlCommand瀵硅薄涓彁渚涘鏉ELECT璇彞锛岄氳繃璇ユ柟寮忥紝鐢ㄥ涓〃濉厖鏁版嵁闆嗐傝繖浜汼ELECT璇彞鍩轰簬SQL鏌ヨ锛屽鏁版嵁搴撹彍鍗曗淪how SQL Query鈥濋夐」涓殑鈥淐rystal Reports鈥濅腑鏄剧ず鐨勯偅鏍枫傚亣瀹氭湁涓嬭堪鏌ヨ锛

SELECT `country`.`Name`, `country`.`Continent`, `country`.`Population`, `city`.`Name`, `city`.`Population`
FROM `world`.`country` `country` LEFT OUTER JOIN `world`.`city` `city` ON `country`.`Code`=`city`.`CountryCode`
ORDER BY `country`.`Continent`, `country`.`Name`, `city`.`Name`

璇ユ煡璇㈠皢琚浆鎹负涓ゆ潯SELECT鏌ヨ锛屽苟浠ヤ笅杩颁唬鐮佹樉绀猴細

[VB]

Imports CrystalDecisions.CrystalReports.Engine
Imports System.Data
Imports MySql.Data.MySqlClient

Dim myReport As New ReportDocument
Dim myData As New DataSet
Dim conn As New MySqlConnection
Dim cmd As New MySqlCommand
Dim myAdapter As New MySqlDataAdapter

conn.ConnectionString = "server=127.0.0.1;" _
    & "uid=root;" _
    & "pwd=12345;" _
    & "database=world"

Try
    conn.Open()
    cmd.CommandText = "SELECT name, population, countrycode FROM city ORDER BY countrycode, name; " _
        & "SELECT name, population, code, continent FROM country ORDER BY continent, name"
    cmd.Connection = conn
    
    myAdapter.SelectCommand = cmd
    myAdapter.Fill(myData)
    
    myReport.Load(".\world_report.rpt")
    myReport.Database.Tables(0).SetDataSource(myData.Tables(0))
    myReport.Database.Tables(1).SetDataSource(myData.Tables(1))
    myViewer.ReportSource = myReport
Catch ex As Exception
    MessageBox.Show(ex.Message, "Report could not be created", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try

[C#]

using CrystalDecisions.CrystalReports.Engine;
using System.Data;
using MySql.Data.MySqlClient;

ReportDocument myReport = new ReportDocument();
DataSet myData = new DataSet();
MySql.Data.MySqlClient.MySqlConnection conn;
MySql.Data.MySqlClient.MySqlCommand cmd;
MySql.Data.MySqlClient.MySqlDataAdapter myAdapter;

conn = new MySql.Data.MySqlClient.MySqlConnection();
cmd = new MySql.Data.MySqlClient.MySqlCommand();
myAdapter = new MySql.Data.MySqlClient.MySqlDataAdapter();

conn.ConnectionString = "server=127.0.0.1;uid=root;" +
    "pwd=12345;database=test;";

try
{
    cmd.CommandText = "SELECT name, population, countrycode FROM city ORDER " +
        "BY countrycode, name; SELECT name, population, code, continent FROM " +
        "country ORDER BY continent, name";
    cmd.Connection = conn;

    myAdapter.SelectCommand = cmd;
    myAdapter.Fill(myData);

    myReport.Load(@".\world_report.rpt");
    myReport.Database.Tables(0).SetDataSource(myData.Tables(0));
    myReport.Database.Tables(1).SetDataSource(myData.Tables(1));
    myViewer.ReportSource = myReport;
}
catch (MySql.Data.MySqlClient.MySqlException ex)
{
    MessageBox.Show(ex.Message, "Report could not be created",
        MessageBoxButtons.OK, MessageBoxIcon.Error);
}  
 
搴斿皢SELECT璇彞鎸夊瓧姣嶉『搴忔帓鍒楋紝杩欑偣寰堥噸瑕侊紝鍘熷洜鍦ㄤ簬锛岃繖鏄姤鍛婂笇鏈涘叾婧愯〃鎵鍏锋湁鐨勯『搴忋傚浜庢姤鍛婁腑鐨勬瘡涓〃锛屽潎闇瑕佷竴鏉etDataSource璇彞銆

璇ユ柟娉曚細瀵艰嚧鎬ц兘闂锛岃繖鏄洜涓篊rystal Reports蹇呴』鍦ㄥ鎴风涓渚у皢琛ㄧ粦瀹氬湪涓璧凤紝涓庝娇鐢ㄤ互鍓嶄繚瀛樼殑鏁版嵁闆嗙浉姣旓紝閫熷害杈冩參銆

26.2.4.7. 鍦∕ySQL Connector/NET涓鐞嗘棩鏈熷拰鏃堕棿淇℃伅

26.2.4.7.1. 鍓嶈█
MySQL鍜.NET璇█澶勭悊鏃ユ湡鍜屾椂闂翠俊鎭殑鏂瑰紡鏄笉鍚岀殑锛孧ySQL鍏佽浣跨敤鏃犳硶鐢.NET鏁版嵁绫诲瀷琛ㄧず鐨勬棩鏈燂紝濡傗0000-00-00 00:00:00濡傛灉澶勭悊姝ュ綋锛岃宸紓浼氬鑷撮棶棰樸

鍦ㄦ湰鑺備腑锛屼粙缁嶄簡浣跨敤MySQL Connector/NET鏃舵伆褰撳鐞嗘棩鏈熷拰鏃堕棿淇℃伅鐨勬柟娉曘

26.2.4.7.2. 浣跨敤鏃犳晥鏃ユ湡鏃剁殑闂
瀵逛簬浣跨敤鏃犳晥鏃ユ湡鐨勫紑鍙戜汉鍛樻潵璇达紝鏁版嵁澶勭悊鏂归潰鐨勫樊寮備細瀵艰嚧闂銆傛棤鏁堢殑MySQL鏃ユ湡鏃犳硶琚姞杞藉埌.NET DateTime瀵硅薄涓紝鍖呮嫭NULL鏃ユ湡銆

鐢变簬璇ュ師鍥狅紝涓嶈兘鐢MySqlDataAdapter绫荤殑Fill鏂规硶濉厖.NET DataSet瀵硅薄锛岃繖鏄洜涓烘棤鏁堟棩鏈熶細瀵艰嚧System.ArgumentOutOfRangeException寮傚父銆

26.2.4.7.3. 闄愬埗鏃犳晥鏃ユ湡
瀵规棩鏈熼棶棰樼殑鏈浣宠В鍐虫柟妗堟槸锛岄檺鍒剁敤鎴疯緭鍏ユ棤鏁堟棩鏈熴傝繖鍗冲彲鍦ㄥ鎴风涓婅繘琛岋紝涔熷彲鍦ㄦ湇鍔″櫒绔繘琛屻

鍦ㄥ鎴风涓婇檺鍒舵棤鏁堟棩鏈熷崄鍒嗙畝鍗曪紝鍗虫讳娇鐢.NET DateTime绫绘潵澶勭悊鏃ユ湡銆侱ateTime绫讳粎鍏佽鏈夋晥鏃ユ湡锛屼粠鑰岀‘淇濅簡鏁版嵁搴撲腑鐨勫间篃鏄湁鏁堢殑銆璇ユ柟娉曠殑缂虹偣鏄紝鍦ㄤ娇鐢.NET鍜岄潪.NET浠g爜鎿嶄綔鏁版嵁搴撶殑娣峰悎鐜涓嬩笉鑳戒娇鐢ㄥ畠锛岃繖鏄洜涓哄悇搴旂敤绋嬪簭蹇呴』鎵ц鑷繁鐨勬棩鏈熼獙璇併

MySQL 5.0.2鍜屾洿楂樼増鏈殑鐢ㄦ埛鍙娇鐢ㄦ柊鐨勪紶缁烻QL妯″紡鏉ラ檺鍒舵棤鏁堟棩鏈熷笺傚叧浜庝娇鐢ㄤ紶缁烻QL妯″紡鐨勬洿澶氫俊鎭紝璇峰弬瑙http://dev.mysql.com/doc/mysql/en/server-sql-mode.html

26.2.4.7.4. 澶勭悊鏃犳晥鏃ユ湡
寮虹儓寤鸿鍦ㄤ綘鐨.NET搴旂敤绋嬪簭涓簲閬垮厤浣跨敤鏃犳晥鏃ユ湡锛屽敖绠″姝わ紝涔熻兘tongguo MySqlDateTime鏁版嵁绫诲瀷浣跨敤鏃犳晥鏃ユ湡銆

MySqlDateTime鏁版嵁绫诲瀷鏀寔MySQL鏈嶅姟鍣ㄦ敮鎸佺殑鐩稿悓鏃ユ湡鍊笺侻ySQL Connector/NET鐨勯粯璁よ涓烘槸锛屽鏈夋晥鐨勬棩鏈熷艰繑鍥1涓.NET DateTime瀵硅薄锛屽鏃犳晥鏃ユ湡鍊艰繑鍥為敊璇傚彲浠ユ洿鏀硅榛樿鏂瑰紡锛屼娇MySQL Connector/NET涓烘棤鏁堟棩鏈熻繑鍥MySqlDateTime瀵硅薄銆

瑕佹兂浣縈ySQL Connector/NET涓烘棤鏁堟棩鏈熻繑鍥MySqlDateTime瀵硅薄锛屽彲鍦ㄨ繛鎺ュ瓧绗︿覆涓坊鍔犱笅琛岋細

  Allow Zero Datetime=True
  

璇锋敞鎰忥紝浣跨敤MySqlDateTime绫讳粛浼氫骇鐢熼棶棰樸涓嬮潰浠嬬粛浜嗕竴浜涘凡鐭ラ棶棰橈細

1.    鏃犳晥鏃ユ湡鐨勬暟鎹粦瀹氫粛浼氬鑷撮敊璇紙闆舵棩鏈0000-00-00鐪嬩笂鍘讳笉瀛樺湪璇ラ棶棰橈級銆

2.    ToString鏂规硶杩斿洖鎸夋爣鍑哅ySQL鏍煎紡杩涜鏍煎紡澶勭悊鐨勬棩鏈燂紙渚嬪锛2005-02-23 08:50:25锛夈傝繖涓.NET DateTime绫荤殑ToString琛屼负涓嶅悓銆

3.    MySqlDateTime绫绘敮鎸丯ULL鏃ユ湡锛屼絾.NET DateTime绫讳笉鏀寔NULL鏃ユ湡銆傚鏋滄湭棣栧厛妫鏌ULL锛屽湪璇曞浘灏哅ySQLDateTime杞崲涓篋ateTime鏃讹紝浼氬鑷撮敊璇

鐢变簬瀛樺湪涓婅堪宸茬煡浜嬪疁锛屾渶浣冲缓璁粛鏄紝鍦ㄤ綘鐨勫簲鐢ㄧ▼搴忎腑浠呬娇鐢ㄦ湁鏁堟棩鏈熴

26.2.4.7.5. 澶勭悊NULL鏃ユ湡

.NET DateTime鏁版嵁绫诲瀷涓嶈兘澶勭悊NULL鍊笺鍚屾牱锛屽湪鏌ヨ涓负DateTime鍙橀噺璧嬪兼椂锛屽繀椤婚鍏堟鏌ュ兼槸鍚︽槸NULL銆

浣跨敤MySqlDataReader鏃讹紝鍦ㄨ祴鍊煎墠锛屽簲浣跨敤.IsDBNull鏂规硶妫鏌ュ兼槸鍚︿负NULL锛

[VB]

If Not myReader.IsDBNull(myReader.GetOrdinal("mytime")) Then
    myTime = myReader.GetDateTime(myReader.GetOrdinal("mytime"))
Else
    myTime = DateTime.MinValue
End If
  

[C#]

if (! myReader.IsDBNull(myReader.GetOrdinal("mytime")))
    myTime = myReader.GetDateTime(myReader.GetOrdinal("mytime"));
else
    myTime = DateTime.MinValue;
  
NULL鍊艰兘澶熷湪鏁版嵁闆嗕腑浣跨敤锛屼篃鑳藉皢鍏剁粦瀹氫互鏋勬垚鎺т欢锛屾棤闇鐗规畩澶勭悊銆

26.2.5. MySQL Connector/NET鍙樻洿鍙

26.2.5.1. 鐗堟湰2.0.0

         鏇存浜嗗湪鏈~鍏匔onnection.Database鐨勬儏鍐典笅浣跨敤瀛樺偍绋嬪簭鏃跺嚭鐜扮殑寮傚父 (Bug #11450) 銆

         鐗瑰畾鐨勬畫缂烘煡璇㈠皢瑙﹀彂鈥滆繛鎺ュ繀椤绘槸鏈夋晥鍜屾墦寮鐨勨濋敊璇秷鎭 (Bug #11490) 銆

26.2.5.2. 鐗堟湰1.0.7

         璋冪敤鍏舵煇涓鍙傛暟鍚湁鐗规畩瀛楃锛堝鈥淍鈥濓級鐨勫瓨鍌ㄧ▼搴忓皢浜х敓寮傚父銆傛敞鎰忥紝蹇呴』鍚敤ANSI_QUOTES鎵嶄細浣夸箣鎴愪负鍙兘 (Bug #13753) 銆

         濡傛灉璇彞鍖呭惈瀵圭浉鍚屽弬鏁扮殑澶氫釜寮曠敤锛屾棤娉曞鍏惰繘琛岄澶勭悊 (Bug #13541) 銆

         Ping()鏂规硶涓嶆洿鏂癈onnection瀵硅薄鐨凷tate灞炴 (Bug #13658) 銆

26.2.5.3. 鐗堟湰1.0.6

         Nant鏋勫缓搴忓垪鏈夐棶棰(Bug #12978)

         濡傛灉浼犻掔殑绗1涓兼槸NULL锛屽弬鏁扮殑涓茶鍖栨搷浣滃け璐 (Bug #13276) 銆

         鍚笅杩板瓧绗︾殑瀛楁鍚嶅皢瀵艰嚧閿欒锛()%<>/ (Bug #13036) 銆

         MySQL Connector/NET 1.0.5瀹夎绋嬪簭涓嶈兘鍚屾椂瀹夎MySQL Connector/NET 1.0.4. (Bug #12835)銆

         鍦∕ono涓奙ySQL Connector/NET 1.0.5涓嶈兘杩炴帴 (Bug #13345) 銆

26.2.5.4. 鐗堟湰1.0.5

         杩炴帴瀛楃涓蹭腑鏈夊涓富鏈烘椂锛孧ySQL Connector/NET鏃犳硶涓庡垪琛ㄤ腑鐨1涓富鏈虹浉杩 (Bug #12628) 銆

         MySQL Connector/NET灏嗘柊鐨勫崄杩涘埗鏁版嵁绫诲瀷瑙i噴涓哄瓧鑺傛暟缁 (Bug #11294) 銆

         涓嶆敮鎸cp1250瀛楃闆 (Bug #11621) 銆

         褰.NET绾跨▼姹犳棤鍙敤鐨勫伐浣滅嚎绋嬫椂锛岃繛鎺ュ彲鑳藉け璐 (Bug #10637) 銆

         鍗佽繘鍒跺弬鏁板鑷磋娉曢敊璇 (Bug #11550, Bug #10486, Bug #10152)銆

         濡傛灉瀛樺偍绋嬪簭涓嶅惈鍙傛暟锛岃皟鐢ㄥ瓨鍌ㄧ▼搴忓皢瀵艰嚧寮傚父 (Bug #11542) 銆

         鐗瑰畾鐨勬畫缂烘煡璇㈠皢瑙﹀彂鈥滆繛鎺ュ繀椤绘槸鏈夋晥鍜屾墦寮鐨勨濋敊璇秷鎭 (Bug #11490) 銆

         闄や簡榛樿鏁版嵁搴撳锛MySqlCommandBuilder绫讳笉鑳藉鐞嗗紩鐢ㄤ簡鍏朵粬鏁版嵁搴撲腑琛ㄧ殑鏌ヨ (Bug #8382) 銆

         MySQL Connector/NET鏃犳硶鐗瑰畾鐨勫眬閮ㄨ缃竴璧锋甯稿伐浣 (WL#8228)銆

         鏈~鍏Connection.Database鏃朵娇鐢ㄥ瓨鍌ㄧ▼搴忓鑷村紓甯 (Bug #11450) 銆

         璇诲彇TIMESTAMP鍒楁椂浜х敓寮傚父 (Bug #7951) 銆

         鐢ㄦ崲琛岀闅斿紑鍙傛暟鏃讹紝鏃犳硶璇嗗埆鍙傛暟 (Bug #9722) 銆

         鍦ㄥ垵濮嬭繛鎺ヤ笂鏈缃繛鎺ュ瓧绗︿覆鏃讹紝璋冪敤MySqlConnection.clone灏嗗鑷撮敊璇 (Bug #10281) 銆

         澧炲姞浜嗗浠嶮ySQL Connector/NET璋冪敤瀛樺偍鍑芥暟鐨勬敮鎸 (Bug #10644) 銆

         MySQL Connector/NET涓嶈兘杩炴帴鍒癕ySQL 4.1.14. (Bug #12771)銆

         鐢ㄨ璁″櫒娣诲姞浜MySqlConnection瀵硅薄鏃讹紝鏃犳硶璁剧疆ConnectionString灞炴 (Bug #12551, Bug #8724)銆

26.2.5.5. 鐗堟湰1.0.4 1-20-05

         Bug #7243锛氳皟鐢ㄥ噯澶囧鑷村紓甯竅宸叉洿姝銆

         鏇存浜嗕笌棰勫鐞嗚鍙ユ湁鍏崇殑鍙︿竴涓皬闂銆

         Bug #7258锛歁ySqlCommand.Connection杩斿洖IDbConnection [宸叉洿姝銆

         Bug #7345锛歁ySqlAdapter.Fill鏂规硶鎶涘嚭閿欒娑堟伅锛氶渶瑕侀潪璐熸暟鍊糩宸叉洿姝銆

         Bug #7478锛歁ySqlCommand涓殑鍏嬮殕鏂规硶缂洪櫡[宸叉洿姝銆

         Bug #7612锛氬綋瀛楁涓篘ULL鏃讹紝MySqlDataReader.GetString(index)杩斿洖浜嗛潪Null鍊糩宸叉洿姝銆

         Bug #7755锛氬鏋滃垪鏄棤绗﹀彿绫诲瀷锛孧ySqlReader.GetInt32鎶涘嚭寮傚父[宸叉洿姝銆

         Bug #7704锛欸etBytes涓嶅啀宸ヤ綔[宸叉洿姝銆

         Bug #7724锛氬紩鐢ㄥ瓧绗︹\222鈥濆湪EscapeString涓湭琚紩鐢╗宸叉洿姝銆

         鏇存浜嗗懡鍚嶇閬撲笉鑳戒笌鏌愪簺Blob鍔熻兘涓璧峰伐浣滅殑闂銆

         鏇存浜嗕笌鍏变韩鍐呭瓨杩炴帴鏈夊叧鐨勯棶棰樸

         Bug #7436锛氫笌澶氫釜缁撴灉闆嗘湁鍏崇殑闂 [宸叉洿姝銆

         鍦ˋPI鍙傝冩枃妗d腑澧炲姞浜嗗涓富棰樸

26.2.5.6. 鐗堟湰1.0.3-gamma 12-10-04

         浣縈ySQL鎴愪负榛樿鐨勫懡鍚嶇閬撳悕绉般

         鐜板湪锛岃繛鎺ユ椂SHOW COLLATION鍙敤浜庢绱㈠畬鏁寸殑瀛楃闆咺D鍒楄〃銆

         鏇存浜嗘棤鏁堝瓧绗﹂泦绱㈠紩锛200 (Bug #6547) 銆

         瀹夎鍣ㄧ幇鍦ㄥ寘鍚簡澶氫釜閫夐」锛屽彲瀹夎鑷矴AC涓紝骞跺垱寤衡滃紑濮嬧濊彍鍗曢」銆

         Bug #6863锛歁ySqlCommand鍙傛暟涓殑Int64鏀寔[宸叉洿姝銆

         瀵逛簬杩炴帴锛岀幇鍦ㄦ棤闇鍦ㄨ繛鎺ュ瓧绗︿覆涓婄粰鍑烘暟鎹簱銆

         Bug #6770锛歁ySqlDataReader.GetChar(int i)鎶涘嚭IndexOutOfRange寮傚父[宸叉洿姝銆

         鏇存浜嗗洜鍏锋湁涓嶅悓琛屾暟鐨勫涓粨鏋滈泦鑰屽鑷寸殑闂銆

         Bug #6983锛氬啀娆℃姏鍑哄紓甯告椂寮傚父鍫嗘爤璺熻釜涓㈠け[宸叉洿姝銆

         鏇存浜嗕笌浣跨敤棰勫鐞嗚鍙ユ娴婲ull鍊兼湁鍏崇殑涓昏闂銆

         Bug #6902锛氳В鏋愬瓨鍌ㄧ▼搴忓弬鏁版椂鐨勯敊璇痆宸叉洿姝銆

         Bug #6668锛氬瓨鍌ㄧ▼搴忕殑鏁存暟杈撳嚭鍙傛暟杩斿洖涓哄瓧绗︿覆[宸叉洿姝銆

         Bug #7032锛氭寜鏂囨湰鍒嗙被鐨勬暟鎹〃涓殑MySqlDateTime锛屾棤鏁版嵁 [宸叉洿姝銆

         Bug #7133锛氫娇鐢╥nout鍙傛暟鏃剁殑鏃犳晥鏌ヨ瀛楃涓瞇宸叉洿姝銆

         Bug #6831锛氫笌MySQL 4.0涓璧锋椂锛屾祴璇曞け璐ワ紝鍘熷洜鍦ㄤ簬琛ㄥ悕鐨勫ぇ灏忓啓鏁忔劅鎬宸叉洿姝銆

         Bug #7132锛氭彃鍏ateTime瀵艰嚧System.InvalidCastException鐨勬姏鍑篬宸叉洿姝銆

         Bug #6879锛氫娇鐢―ATE_ADD-function鏃剁殑InvalidCast[宸叉洿姝銆

         Bug #6634锛1涓墦寮鐨勮繛鎺ヨ涓绘満绯荤粺鍏抽棴[宸叉洿姝銆

         涓篗ySqlConnection娣诲姞浜哠erverThread灞炴т互鏄剧ず鏈嶅姟鍣ㄧ嚎绋婭D銆

         涓篗ySqlConnection澧炲姞浜哖ing鏂规硶銆

         灏嗘祴璇曞寘鐨勫悕绉版洿鏀逛负MySql.Data.Tests.dll銆

26.2.5.7. 鐗堟湰1.0.2-gamma 04-11-15

         鏇存浜嗕笌MySqlBinary鏈夊叧鐨勯棶棰橈紝鍏朵腑锛屾棤娉曚娇鐢ㄥ瓧绗︿覆鍊兼洿鏂版墿灞曠殑鏂囨湰鍒椼

         鏇存浜嗕娇鐢ㄥ畾鍒跺畨瑁呮椂蹇界暐鐨勫畨瑁呯洰褰曢棶棰(Bug #6329)銆

         鏇存浜嗚缃懡浠ゆ枃鏈皢鍛戒护鐣欏湪棰勫鐞嗙姸鎬佺殑闂銆

         鏇存浜哅ySqlParameter鍙岀被鍨嬪鐞嗛棶棰橈紙瀛楃涓瞤arameterName锛屽璞″硷級(Bug #6428)銆

         鏇存浜嗗~鍏呮暟鎹泦鏃惰繑鍥為浂鏃ユ湡鈥0000-00-00鈥濋敊璇(Bug #6429)銆

         鏇存浜嗚皟鐢ㄥ瓨鍌ㄧ▼搴忓彲鑳戒細瀵艰嚧鈥淚llegal mix of collations鈥濓紙闈炴硶鏍″缁勫悎锛夌殑闂銆

         澧炲姞浜哻harset杩炴帴瀛楃涓查夐」銆

         鏇存浜#HY000鈥淚llegal mix of collations鈥濓紙闈炴硶鏍″缁勫悎锛(latin1_swedish_ci,IMPLICIT)鍜(utf8_general_ (Bug #6322)闂銆

         澧炲姞浜員ableEditor CS鍜孷B绀轰緥銆

         鏇存浜嗗叧浜嶶CS-2鐨凜harset-map闂(Bug #6541)銆

         鏇存柊浜嗗畨瑁呭櫒锛屽寘鍚簡鏂扮殑绀轰緥銆

         鏇存瑙勪簡Long鎻掑叆鑰楁椂寰堥暱鐨勯棶棰(Bug #5453)銆

         鏇存浜嗗璞℃棤娉曡澶勭悊鐨勯棶棰(Bug #6649)銆

         鎻愪緵鏂规灏嗘湇鍔″櫒鎸囧畾鐨勫瓧绗﹂泦鐢ㄤ綔榛樿瀛楃闆嗐

26.2.5.8. 鐗堟湰1.0.1-beta2 04-10-27

         鏇存浜哅ySqlParameter(string, object)鏋勯犲嚱鏁颁腑鐨勫彲鑳界己闄BUG #5602

         鏇存浜BUG #5458锛屽湪longtext鍒椾笂璋冪敤GetChars灏嗘姏鍑哄紓甯搞

         鏇存浜BUG #5474锛屾棤娉曡繍琛屽瓨鍌ㄧ▼搴忔潵濉厖mysqlcommand.parameters銆

         鏇存浜BUG #5469锛岃缃瓺bType鏃舵姏鍑篘ullReferenceException銆

         鏇存浜嗗湪鍏抽棴濂楁帴瀛椾箣鍓嶈繛鎺ュ櫒鏃犳硶鍙戝嚭CMD_QUIT鐨勯棶棰樸

         鏇存浜BUG #5392锛孧ySqlCommand鍦ㄥ瓧绗︿覆鏂囨湰鍐呭涓彂鐜颁綔涓哄弬鏁扮殑鈥?鈥濄

         鏇存浜嗕笌ConnectionInternal鏈夊叧鐨勯棶棰橈紝鍏朵腑锛1涓敭鍙兘浼氳娣诲姞澶氭銆

         褰撴湇鍔″櫒鐗堟湰涓4.1.2鎴栨洿楂樻椂锛孋P1252浠呯敤浜嶭atin1銆

         鏇存浜BUG #5388锛屽鏋1琛屼负NULL锛孌ataReader閫氭姤鎵鏈夎鍧囦负NULL銆

         铏氭嫙鍖栦簡椹卞姩瀛愮郴缁燂紝浠ヤ究鏈潵鐗堟湰鑳借交鏄撳湴鏀寔瀹㈡埛绔垨宓屽叆寮忔湇鍔″櫒銆

         鍐嶆浣跨敤瀛楁缂撳啿锛屼互鍑忓皯鍐呭瓨鍒嗛厤骞跺鍔犻熷害銆

         鏇存浜嗙浉搴旂殑闂锛屼娇鐢ㄦ帴鍙f椂浣跨敤鏃ц娉曞皢瀵艰嚧闂銆

         瀵逛簬鍐欏叆娴佹搷浣滐紝浣跨敤PacketWriter鍙栦唬Packet銆

         鍦–ompressedStream涓啀鍒嗚В鍘嬬缉浠g爜锛屼互娓呯悊NativeDriver銆

         澧炲姞浜嗙敤浜庡湪棰勫鐞嗗懡浠や笂閲嶇疆鍛戒护鏂囨湰鐨勬祴璇曡寖渚嬨

         鏇存浜嗙粰瀹歂ull鍊兼椂MySqlParameterCollection.Add()灏嗘姏鍑轰笉鏄庡紓甯哥殑闂(Bug #5621)銆

         鏇存浜哅ySqlCommand()涓殑鏋勯犲嚱鏁板垵濮嬪寲闂(Bug #5613)銆

         鏇存浜嗚В鏋愨;鈥濆瓧绗︾殑闂(Bug #5876)銆

         鏇存浜嗗湪DbType璁剧疆鍣ㄤ腑涓㈠け寮曠敤鐨勯棶棰(Bug #5897)銆

         鏇存浜嗕娇鐢╕EAR鏁版嵁绫诲瀷鏃剁殑System.OverflowException闂(Bug #6036)銆

         澧炲姞浜嗚仛鍚堝嚱鏁版祴璇曪紙瀹為檯涓婁笉鏄己闄凤級銆

         鏇存浜嗘诞鐐瑰弬鏁(double, numeric, single, decimal)鐨勫簭鍒楀寲闂(Bug #5900)銆

         IsNullable閿欒(Bug #5796)銆

         鏇存浜嗕笉閬靛畧杩炴帴瀛楃涓蹭笂缁欏嚭鐨勮繛鎺ュ鍛界殑闂銆

         鏇存浜嗕笉閬靛畧Min Pool Size锛堟渶灏忔睜澶у皬锛夌殑闂銆

         鏇存浜哅ySqlDataReader鍜屸渟how tables from ...鈥濓紙浠鏄剧ず琛級琛屼负(Bug #5256)銆

         瀹炴柦浜哠equentialAccess銆

         鏇存浜嗗彂鐜扮1涓0鍚嶮ySqlDateTime鍦ㄦ墍鏈塻ubseq.records涓婅缃甀sZero灞炴х殑闂(Bug #6006)銆

         鏇存浜嗘棤娉曟纭樉绀轰腑鏂囧瓧鐨勯棶棰(Bug #5288)銆

         杩樻洿姝d簡淇勬枃瀛楃鏀寔銆

         鏇存浜哅ethod TokenizeSql()浠呭皢鏈夐檺鐨勬湁鏁堝瓧绗︾敤浜庡弬鏁扮殑闂(Bug #6217)銆

         鏇存浜嗕涪澶眗esx鏂囦欢鐨凬ET Connector婧(Bug #6216)銆

         鏇存浜嗕笌妫绱紡鏇存柊鏌ヨ涓璧蜂娇鐢ㄦ槸浼氬鑷撮棶棰樼殑DBNull鍊 (Bug #5798) 銆

         鏇存浜嗕粛鏈夊彟涓涓滄湭璁剧疆缁欏璞″疄渚嬬殑瀵硅薄寮曠敤鈥(Bug #5496)銆

         鏇存浜哖acketReader涓殑闂锛屽叾涓紝浼氳瘯鍥惧湪EnsureCapacity涓垎閰嶉敊璇殑缂撳啿澶у皬銆

         鏇存浜咷etBoolean杩斿洖閿欒鍊肩殑闂(Bug #6227)銆

         鏇存浜嗗甫鏈塆etString(index)鐨凞ataReader涓璧疯鍙朆LOB鏃剁殑IndexOutOfBounds闂(Bug #6230)銆

26.2.5.9. 鐗堟湰1.0.0 04-09-01

         鏇存浜咮UG# 3889锛屼笉鑳芥纭敮鎸乀hai缂栫爜銆

         鏇存柊浜嗗緢澶氭祴璇曡寖渚嬨

         鏇存浜嗕笌浣跨敤鍘嬬缉鏈夊叧鐨勯棶棰樸

         灏嗚礉濉1鐗堟湰鐨勭増鏈彿鎵╁厖涓1.0.0銆

         澧炲姞浜嗙敤浜庡畨瑁呭櫒鐨凜OPYING.rtf鏂囦欢銆

         鍒犻櫎浜嗘墍鏈夌殑XML娉ㄩ噴璀﹀憡锛堜互鍚庡皢鏇村ソ鍦版竻鐞嗗畠浠級銆

         鍒犻櫎浜嗕竴浜涘ByteFX鐨勬渶杩戝紩鐢ㄣ

26.2.5.10. 鐗堟湰0.9.0 04-08-30

         涓洪澶勭悊璇彞澧炲姞浜嗘祴璇曞畾浣嶅櫒銆

         鐩墠锛屾墍鏈夌被鍨嬬殑绫诲潎瀹炴柦浜哠erializeBinary鏂规硶锛岀敤浜庡皢鍏舵暟鎹彂閫佺粰PacketWriter銆

         澧炲姞浜哖acketWriter绫伙紝鍏佽灏嗘潵鐨勪綆鍐呭瓨澶у璞″鐞嗐

         鏇存浜嗚繍琛岄澶勭悊璇彞鍜屽瓨鍌ㄧ▼搴忎腑瀛樺湪鐨勫緢澶氬皬缂洪櫡銆

         鏇存敼浜嗗鏉″懡浠わ紝浣垮緱鍦ㄦ墽琛屽甫鏈夌壒瀹氬弬鏁帮紙閲囩敤鏃ц娉曟ā寮忥級鐨勫瓨鍌ㄧ▼搴忔椂涓嶅啀鎶涘嚭寮傚父銆

         SingleRow鐜板湪宸ヤ綔姝e父锛屽嵆浣垮湪瀛樺湪闄愬埗鐨勬儏鍐典笅涔熷悓鏍枫

         GetBytes鐩墠浠呬綔鐢ㄥ湪浜岃繘鍒跺垪涓娿

         Logger鐜板湪鑳藉鎴煭闀跨殑SQL鍛戒护锛屼粠鑰屼娇寰梑lob鍒椾笉浼氣滄拺鐖嗏濇棩蹇椼

         涓绘満鍜屾暟鎹簱鐩墠鐨勯粯璁ゅ间负鈥溾濓紝闄ら潪浣滀簡鍏朵粬璁剧疆銆

         鏇存浜咮UG# 5214锛屽拷鐣ヤ簡杩炴帴瓒呮椂銆

         澧炲姞浜嗘祴璇曡寖渚嬶紝閽堝bug# 5051锛欸etSchema涓嶈兘姝g‘宸ヤ綔銆

         鏇存浜嗗綋鍒椾负鍏抽敭瀛楁椂GetSchema涓篒sUnique杩斿洖鈥滃亣鈥濈殑闂銆

         MySqlDataReader GetXXX鏂规硶鐩墠閲囩敤浜嗗瓧娈电骇MySqlValue瀵硅薄锛屼笉鎵ц杞崲銆

         鏇存浜咮UG# 5097锛欴ataReader涓烘椂闂村垪杩斿洖NULL銆

         A澧炲噺浜嗛拡瀵筁OAD DATA LOCAL INFILE鐨勬祴璇曡寖渚嬨

         澧炲姞浜唕eplacetext custom nant浠诲姟銆

         澧炲姞浜咰ommandBuilderTest瀹氫綅鍣ㄣ

         涓篊ommandBuilder澧炲姞浜哃ast One Wins锛堟渶鍚庝竴涓儨鍑猴級鐗规с

         鏇存浜嗘寔缁у畨鍏ㄤ俊鎭棶棰樸

         鏇存浜咷etBool锛屼娇寰1, true, "true"鍜"yes"鍧囧彲琛ㄧずtrueWL# 2024锛屼粠鑰屼娇寰楀弬鏁版爣蹇楁垚涓哄彲閰嶇疆鐨勩

         澧炲姞浜"old syntax"杩炴帴瀛楃涓插弬鏁帮紝鍏佽浣跨敤鈥淍鈥濆弬鏁版爣璁扮銆

         鏇存浜Bug #4658锛孧ySqlCommandBuilder銆

         鏇存浜Bug #4864锛屽鏋溾淧ersist Security Info鈥濓紙鎸佺画鎬у畨鍏ㄤ俊鎭級涓哄亣锛孊yteFX.MySqlClient灏嗗瀵嗙爜杩涜缂撳啿澶勭悊銆

         鍦ㄦ墍鏈夌殑婧愭枃浠朵腑鏇存柊浜嗚鍙爣蹇楋紝浠ュ寘鍚獸LOSS寮傚父銆

         閽堝鐩墠鎵鏈夌殑MySql绫诲瀷锛屽鍔犱簡鏂扮殑.Types鍚嶇О绌洪棿鍜屽叿浣撳疄鏂姐

         澧炲姞浜嗕綔涓篗ySqlField瀛愮被鐨凪ySqlField41銆

         鏇存敼浜嗗緢澶氱被锛屼娇涔嬭兘澶熶娇鐢ㄦ柊鐨.Types绫诲瀷銆

         灏唀num int绫诲瀷鏇存敼涓篒nt32锛屽皢short绫诲瀷鏇存敼涓篒nt16锛屽苟灏哹igint绫诲瀷鏇存敼涓篒nt64銆

         澧炲姞浜嗕吉绫诲瀷UInt16銆乁Int32鍜孶Int64锛屽厑璁稿垱寤烘棤绗﹀彿鍙傛暟銆

         鐜板湪锛屼粠杩炴帴姹犳媺鍑鸿繛鎺ユ椂锛岃繛鎺ュ皢琚浣嶃

         鍦ㄩ┍鍔ㄧ▼搴忎腑鍐嶆鍒嗚В浜哸uth浠g爜锛屼娇寰楀叾鍗宠兘鐢ㄤ簬auth锛屼篃鑳界敤浜巖eset銆

         鍦≒oolingTests.cs涓鍔犱簡UserReset娴嬭瘯銆

         鐜板湪锛屼娇鐢–OM_CHANGE_USER浠庢睜涓媺鍑鸿繛鎺ユ椂锛岃繛鎺ュ皢琚浣嶃

         瀹炵幇浜哠ingleResultSet琛屼负銆

         瀹炵幇浜嗗unicode鐨勬敮鎸併

         涓簎tf-8鍜寀cs-2澧炲姞浜嗗瓧绗﹂泦鏄犲皠銆

         鏇存浜Bug #4520锛屼娇鐢╞ytefx .net mysql椹卞姩鏃讹紝鏃堕棿瀛楁婧㈠嚭銆

         鍦ㄦ暟鎹被鍨嬫祴璇曞畾浣嶅櫒涓慨鏀逛簡鏃堕棿娴嬭瘯锛屼互渚胯兘澶熸鏌モ渉ours > 24鈥濈殑鏃堕棿璺ㄥ害銆

         鏇存浜Bug #4505锛屽湪ByteFx.Data.MySqlClient.MySqlParameter涓甫鏈夊弽鏂滄潬杞箟鐨勯敊璇瓧绗︿覆銆

         涓哄弬鏁版祴璇曡寖渚婽estQuoting澧炲姞浜嗕唬鐮侊紝浠ユ祴璇曞弽鏂滅嚎绗﹀彿銆

         鏇存浜Bug #4486锛屼笌multi-word鍒楀悕涓璧峰伐浣滄椂锛宮ysqlcommandbuilder澶辫触銆

         鏇存浜員okenizeSql涓殑缂洪櫡锛屽叾涓紝涓嬪垝绾垮皢涓鑾峰彇鍙傛暟鍚嶄腑鐨勫瓧绗︺

         涓哄垪鍚嶇┖闂村鍔犱簡娴嬭瘯鑼冧緥銆

         鏇存浜哹ug# 4324锛孧ySqlDataReader.GetBytes涓嶈兘姝g‘宸ヤ綔銆

         涓篋ataReader娴嬭瘯瀹氫綅鍣ㄥ鍔犱簡GetBytes()娴嬭瘯鑼冧緥銆

         鐜板湪锛岃兘澶熷皢InternalConnection.Configure涓殑鎵鏈夋湇鍔″櫒鍙橀噺璇诲叆鍒癏ashtable銆

         鐩墠浣跨敤瀛楃涓瞇]锛岀敤浜嶤harSetMap涓殑绱㈠紩鏄犲皠銆

         涓篠QL涓殑carriage杩斿洖澧炲姞浜咰RInSQL娴嬭瘯鑼冧緥銆

         鍦―river.ctor涓紝灏唌axPacketSize璁句负榛樿鍊笺

         鏇存浜bug #4442锛屽湪鍙傛暟涓婅缃甅ySqlDbType鐨勬搷浣滀笉璁剧疆涓鑸被鍨嬨

         鍒犻櫎浜嗚繃鏃剁殑鍒楃被鍨婰ong鍜孡ongLong銆

         鏇存浜哹ug# 4071锛屽湪杩炴帴瀛楃涓蹭笂浣跨敤鈥渦se pipe鈥濇椂锛屾姏鍑烘孩鍑哄紓甯搞

         灏嗗叧閿瓧鈥渦se pipe鈥濇洿鏀逛负鈥減ipe name鈥濇垨鈥減ipe鈥濄

         鍏佽浠庡崟涓煡璇㈣鍙栧涓粨鏋滈泦銆

         涓篠erverStatusFlags enum澧炲姞浜嗘爣蹇楀睘鎬с

         灏哠erverStatus enum鐨勫悕绉版洿鏀逛负ServerStatusFlags銆

         鏇存浜BUG #4386锛屾彃鍏ョ殑鏁版嵁琛屾湭姝g‘鏇存柊銆

         鏇存浜bug #4074锛岄敊璇鐞嗚〃鏄庡垱寤轰簡琛ㄣ

         灏哖acket.ReadLenInteger鏇存敼涓篟eadPackedLong锛屽苟澧炲姞浜唒acket.ReadPackedInteger锛屽畠鎬昏鍙栫敤2銆3銆4缁勮鐨勬暣鏁般

         澧炲姞浜唖yntax.cs娴嬭瘯瀹氫綅鍣紝浠ユ祴璇曞悇绉峉QL璇硶缂洪櫡銆

         鏇存浜哹ug# 4149锛屽鏃堕棿鍊肩殑涓嶅綋澶勭悊銆傜幇鍦紝鍊尖00:00:00鈥濅笉鍐嶈褰撲綔Null銆

         灏嗘墍鏈夌殑娴嬭瘯鍖呮枃浠剁Щ鍒颁簡TestSuite鏂囦欢澶广

         鏇存浜嗙┖鍒椾細灏嗙粨鏋滀俊鎭寘鎸囬拡鍚戝悗绉荤殑闂銆

         澧炲姞浜嗘柊鐨刵ant鍒涘缓鑴氭湰銆

         鏇存浜BUG #3917锛屾竻闄よ〃鍚嶏紝浠ヤ究鑳藉湪涓嬩竴GenerateSchema鎵ц鏈熼棿鎭板綋鍦伴噸鏂扮敓鎴愬畠銆

         鏇存浜bug #3915锛孏etValues鎬昏繑鍥0锛岃屼笖鎬绘槸璇曞浘澶嶅埗鎵鏈夊瓧娈碉紝鑰屼笉鏄牴鎹墍浼犲叆鏁扮粍鐨勫ぇ灏忋

         瀹炴柦浜嗗叡浜唴瀛樿闂崗璁

         瀹炴柦浜嗛拡瀵圭殑MySQL 4.1鐨勯澶勭悊璇彞銆

         瀹炴柦浜嗛拡瀵筂ySQL 5.0鐨勫瓨鍌ㄧ▼搴忋

         灏哅ySqlInternalConnection閲嶆柊鍛藉悕涓篒nternalConnection銆

         SQL鐜板湪琚В閲婁负瀛楃锛屾洿姝d簡涓庡叾浠栬瑷鏈夊叧鐨勯棶棰樸

         澧炲姞浜嗘棩蹇楀姛鑳斤紝骞跺厑璁告壒杩炴帴瀛楃涓查夐」銆

         鏇存浜bug #3888锛岃缃瓺ataAdapter灞炴ф椂鏈缃甊owUpdating浜嬩欢銆

         鏇存浜嗗瓧绗﹂泦鏄犲皠涓瓨鍦ㄧ殑缂洪櫡銆

         瀹炴柦浜4.1閴村畾銆

         鏀瑰杽浜嗛┍鍔ㄤ腑鐨刼pen/auth浠g爜銆

         鏀瑰杽浜嗗湪杩炴帴杩囩▼涓繛鎺ヤ綅鐨勮缃柟寮忋

         鐜板湪锛屽湪鍒濆鐨勬彙鎵嬮樁娈碉紝灏嗘暟鎹簱鍚嶄紶閫掔粰浜嗘湇鍔″櫒銆

         灏嗗鎴风鐨勫悕绉扮┖闂存洿鏀逛负MySql.Data.MySqlClient銆

         灏嗗鎴风鐨勮閰嶅悕绉版洿鏀逛负MySql.Data.dll銆

         灏嗘墍鏈夋簮鏂囦欢涓殑璁稿彲鏂囨湰鏇存敼涓轰簡GPL銆

         澧炲姞浜哅ySqlClient.build Nant鏂囦欢銆

         鍒犻櫎浜唌ono鎵瑰鐞嗘枃浠躲

         灏嗕竴浜涙湭浣跨敤鐨勬枃浠剁Щ鍒颁簡notused鏂囦欢澶癸紝浠庤屼娇寰梟ant鍒涘缓鏂囦欢鑳藉浣跨敤閫氶厤绗︺

         瀹炴柦浜嗗叡浜唴瀛樿闂

         瀵逛唬鐮佺粨鏋勮繘琛屼簡杈冨ぇ淇ˉ銆

         鐜板湪锛岄澶勭悊璇彞鑳藉鍦∕ySql 4.1.1鍜屾洿楂樼増鏈腑浣跨敤銆

         瀵4.0銆4.1.0鍜4.1.1瀹屾垚浜哸uth瀹炴柦銆

         灏嗗悕绉扮┖闂翠粠MySQL.Data.MySQLClient鏇存敼涓篗ySql.Data.MySqlClient銆

         鏇存浜咰harSetMapping涓瓨鍦ㄧ殑缂洪櫡锛屽叾涓紝瀹冭瘯鍥惧皢鏂囨湰鍚嶇О鐢ㄤ綔ints銆

         灏嗗悕绉扮┖闂存洿鏀逛负MySQL.Data.MySQLClient銆

         闆嗘垚浜嗘潵鑷猆C2004鐨刟uth鍙樺姩銆

         鏇存浜嗗湪璇诲彇鏁版嵁涔嬪墠鍜屽煎悗銆佸湪datareader涓婅皟鐢ㄤ换浣旼etXXX鏂规硶鏃朵笉鑳芥姏鍑烘伆褰撳紓甯哥殑缂洪櫡锛堟劅璋uca Morelli morelli.luca@iol.it锛夈

         鍦╬arameter.cs涓鍔犱簡TimeSpan浠g爜锛屼互渚胯兘鎭板綋鍦板皢timespan瀵硅薄澶勭悊涓簃ysql鏃堕棿鏍煎紡锛堟劅璋ianluca Colombo g.colombo@alfi.it锛夈

         涓哄弬鏁板簭鍒楀寲浠g爜澧炲姞浜員imeStamp銆傞槻姝ataAdatper涓嶆甯哥殑鏇存柊锛堟劅璋Ichael King锛夈

         鏇存浜哅ySqlHelper.cs涓殑鎷煎啓閿欒锛堟劅璋atrick Kristiansen锛夈

26.2.5.11. 鐗堟湰0.76

         椹卞姩绋嬪簭鐜板湪鑳戒娇鐢ㄦ彙鎵嬪崗璁腑缁欏畾鐨勫瓧绗﹂泦缂栧彿鍒涘缓缂栫爜銆

         鏇存敼浜嗗懡浠ょ紪杈戝櫒锛屼娇涔嬫寚鍚慚ySqlClient.Design銆

         鏇存浜哣ersion.isAtLeast涓殑缂洪櫡銆

         鏇存敼浜咲BConnectionString锛屼娇涔嬭兘澶熸敮鎸佸MySqlConnectionString鎵浣滅殑鏇存敼銆

         鍒犻櫎浜哠qlCommandEditor鍜孌ataAdapterPreviewDialog銆

         鍦ㄥ緢澶氬湴鏂归噰鐢ㄤ簡鏂扮殑Long杩斿洖鍊笺

         闆嗘垚浜嗘柊鐨凜ompressedStream绫汇

         鏇存敼浜咰onnectionString骞跺鍔犱簡澶氶」灞炴э紝浠庤屼娇涔嬭兘澶熷湪MySqlClient.Design涓娇鐢ㄣ

         鏇存敼浜唒acket.cs锛屼互鏀寔ReadLenInteger涓殑杈冩柊闀垮害銆

         鏇存敼浜嗗叾浠栫被锛屼互浣跨敤MySqlConnectionString鐨勬柊灞炴у拰瀛楁銆

         鐜板湪锛孋onnectionInternal鑳藉浣跨敤PING鍛戒护鏌ョ湅鏈嶅姟鍣ㄦ槸鍚﹀彲鐢ㄣ

         灏嗗伐鍏风浣嶅浘绉诲埌浜唕esource/涓嬨

         鏇存敼field.cs锛屽厑璁稿肩洿鎺ユ潵鑷缂撳啿鍣ㄣ

         杩涜浜嗙浉搴旂殑鏇存敼锛屼互浣跨敤鏂扮殑driver.Send璇硶銆

         浣跨敤浜嗘柊鐨勪俊鎭寘鎺掗槦绯荤粺銆

         寮濮嬬潃鎵嬭繘琛屸滄崯鍧忕殑鈥濆帇缂╀俊鎭寘澶勭悊銆

         鏇存浜哠treamCreator涓殑缂洪櫡锛屾棤娉曡繛鎺ュ埌涓绘満灏嗗鑷存棤闄愬惊鐜紙鎰熻阿Kevin Casella锛夈

         鏀瑰杽浜哻onnectstring澶勭悊銆

         灏嗚璁″櫒绉诲埌浜哖ro浜у搧涓

         浠巆ommand.cs鍒犻櫎浜嗕竴浜涙棫鐨勩佽娉ㄩ噴鎺夌殑浠g爜銆

         鏇存浜嗕笌鍘嬬缉鏈夊叧鐨1涓棶棰樸

         鏇存浜嗚繛鎺ュ璞★紝鎵撳紑杩炴帴鍓嶆姏鍑虹殑寮傚父涓嶄細浣胯繛鎺ヤ繚鎸佸湪杩炴帴鐘舵侊紙鎰熻阿Chris Cline锛夈

         澧炲姞浜咷UID鏀寔銆

         鏇存浜嗗簭鍒楁贩涔辩己闄凤紙鎰熻阿Mark Reay锛夈

26.2.5.12. 鐗堟湰0.75

         鐜板湪锛屽彲灏咵num鍊间綔涓哄弬鏁板煎姞浠ユ敮鎸侊紙鎰熻阿Philipp Sumi锛夈

         鏀寔Year鏁版嵁绫诲瀷銆

         鏇存浜嗗帇缂╅棶棰樸

         鏇存浜嗕互TimeSpan浣滀负鍊肩殑鍙傛暟鏃犳硶鎭板綋搴忓垪鍖栫殑缂洪櫡銆

         鏇存浜嗛粯璁tor涓嶈兘璁剧疆榛樿杩炴帴瀛楃涓插肩殑缂洪櫡銆

         涓轰竴浜涙柊鎴愬憳澧炲姞浜嗕竴浜沊ML娉ㄩ噴銆

         鐫鎵嬫洿姝o紡鏀瑰杽鍘嬬缉澶勭悊浜嬪疁銆

         鏀瑰杽浜咰onnectionString澶勭悊鍔熻兘锛屼娇涔嬭兘澶熶笌SqlClient璁惧畾鐨勬爣鍑嗘洿濂藉湴鍖归厤銆

         濡傛灉鐢ㄦ埛鍚嶆湭鍖呭惈鍦ㄨ繛鎺ュ瓧绗︿覆涓紝灏嗘姏鍑篗ySqlException銆

         濡傛灉鍦ㄨ繛鎺ュ瓧绗︿覆涓湭鎸囧畾锛屾湰鍦颁富鏈哄皢鐢ㄤ綔榛樿涓绘満銆

         濡傛灉鍦ㄨ繛鎺ユ墦寮鐨勫悓鏃惰瘯鍥捐缃繛鎺ュ瓧绗︿覆锛屽皢鎶涘嚭寮傚父銆

         瀵笴onnectionString鏂囨。杩涜浜嗗皬鐨勪慨鏀广

         鍒犻櫎浜哅ultiHostStream鍜孧ySqlStream銆傞噰鐢–ommon/StreamCreator鍙栬屼唬涔嬨

         澧炲姞浜嗗鈥淯se Pipe鈥濊繛鎺ュ瓧绗︿覆鍊肩殑鏀寔銆

         澧炲姞浜哖latform绫伙紝浠ヤ究鑳芥洿瀹规槗鍦拌闂钩鍙扮殑瀹炵敤宸ュ叿鍔熻兘銆

         鏇存浜嗗皬鐨勮繛鎺ユ睜缂洪櫡锛屽嵆锛屽湪IsAlive澶辫触鍚庯紝涓嶈兘鍒涘缓鏂扮殑杩炴帴銆

         澧炲姞浜哖latform.cs鍜孲treamCreator.cs銆

         鏇存浜咶ield.cs锛屼互渚胯兘鎭板綋澶勭悊4.1鐗堝垎鏍肩殑鏃堕棿鎴炽

         灏咰ommon.Version鏇存敼涓篊ommon.DBVersion锛屼互閬垮厤鍚嶇О鍐茬獊銆

         鏇存浜唂ield.cs锛屼粠鑰屼娇寰楁枃鏈垪鑳借繑鍥炴纭殑瀛楁绫诲瀷锛堟劅璋eni27@gmx.net锛夈

         澧炲姞浜哅ySqlError绫伙紝浠ユ彁渚涘閿欒浠g爜鐨勪竴浜涘紩鐢紙鎰熻阿Geert Veenstra锛夈

26.2.5.13. 鐗堟湰0.74

         澧炲姞浜哢nix濂楁帴瀛楁敮鎸侊紙鎰熻阿Mohammad DAMT [md@mt.web.id]锛夈

         娌℃湁鍙敤鏁版嵁鏃讹紝浠呰皟鐢═hread.Sleep銆

         璇ヤ簳浜嗗弬鏁版暟鎹腑寮曠敤瀛楃鐨勮浆涔夌壒鎬с

         鍒犻櫎浜唒arameter.cs涓槗閫犳垚璇В鐨勬敞閲娿

         鏇存浜嗚繛鎺ユ睜缂洪櫡銆

         鍐嶆鏇存浜嗙浉鍚岀殑杩炴帴姹犵己闄凤紒锛 ;-)

         鏇存浜咰onnectionSTring缂栬緫鍣ㄥ璇濇锛堟劅璋arco p (pomarc)锛夈

         鐜板湪锛屽湪杩炴帴瀛楃涓蹭腑鏀寔UserId锛堟劅璋eff Neeley锛夈

         鍒涘缓闈炶緭鍏ュ弬鏁版椂鎶涘嚭寮傚父锛堟劅璋yan Gregg锛夈

         澧炲姞浜嗘洿澶氭枃妗c

         鎻愪緵浜嗘柊鐨凪ultiHostStream鑳藉姏銆傝瘹鎸氭劅璋an Guisinger瀵规鐨勮础鐚傛槸浠栭娆℃彁渚涗簡鍦ㄨ繛鎺ュ瓧绗︿覆涓婃敮鎸佸鍙版満鍣ㄧ殑浠g爜鍜岃蹇点

         澧炲姞浜嗗ぇ閲忔枃妗c備粛鏈夊緢澶氭枃妗i渶瑕佸鍔犮

         鏇存浜嗕笌0.73鏈夊叧鐨勯熷害浜嬪疁銆

         鏇存敼浜哅ySqlDataStream涓殑Thread.Sleep(0)锛屼互渚垮湪涓嶉渶瑕佺瓑寰呮椂浼樺寲鎬ц兘锛堟劅璋odd German锛夈

         棰勫厛灏唅dlepools濉厖鍒颁簡MinPoolSize銆

         涓珮璐ㄩ噺MySqlPool姝婚攣鏉′欢浠ュ強鎰氳牏鐨勭己闄凤紝鍏朵腑锛孋reateNewPooledConnection浠庝笉涓鸿繛鎺ユ睜娣诲姞鏂拌繛鎺ャ傛澶栵紝杩樻洿姝d簡MySqlStream.ReadBytes鍜孯eadByte锛屼粠鑰屼笉鍐嶄娇鐢ㄥ苟闈炲缁堟纭殑TicksPerSecond銆傦紙鎰熻阿Matthew J. Peddlesden锛夈

         淇浜嗙簿搴﹀拰鏍囧害锛堟劅璋atthew J. Peddlesden锛夈

         涓烘祦璇诲彇鏂规硶澧炲姞浜員hread.Sleep(1)锛屼娇涔嬪CPU鏇村弸濂斤紙鎰熻阿Sean McGinnis锛夈

         鏇存浜咵xecuteReader鏈夋椂浼氳繑鍥濶ull鐨勯棶棰橈紙鎰熻阿Lloyd Dupont锛夈

         鏇存浜嗕笌Null瀛楁澶勭悊鏈夊叧鐨勪富瑕佺己闄凤紙鎰熻阿Naucki锛夈

         灏佽浜嗛拡瀵筸ax_allowed_packet鐨勬煡璇紝浠ュ強Try Catch涓殑瀛楃闆嗭紙骞惰缃负榛樿锛夈

         鏇存浜嗗鎺ュ瓧鏈兘鎭板綋鍏抽棴鐨勯棶棰橈紙鎰熻阿Steve锛夈

         鏇存浜咵xecuteNonQuery涓嶈兘濮嬬粓杩斿洖姝g‘鍊肩殑闂銆

         鏇存浜咺nternalConnection锛屼笉浣跨敤@@session.max_allowed_packet锛岃屾槸浣跨敤@@max_allowed_packet銆傦紙鎰熻阿Miguel锛夈

         澧炲姞浜嗗緢澶氭柊XML鏂囨。琛屻

         鏇存浜哠QL瑙f瀽鍔熻兘锛屼笉鍙戦佹帶鏌ヨ锛堟劅璋ory锛夈

         鏇存浜嗛槄璇诲櫒鍦ㄥ叧闂椂涓嶈兘unpeeking淇℃伅鍖呯殑闂銆

         鏇存浜嗕笉鑳藉鐞嗙敤鎴峰彉閲忕殑闂锛堟劅璋ami Vaaraniemi锛夈

         鏇存浜哅ySqlPool涓殑寰幆妫鏌ュ姛鑳斤紙鎰熻阿Steve M. Brown锛夈

         鏇存浜哖arameterCollection.Add鏂规硶锛屼互涓嶴qlClient鍖归厤锛堟劅璋oshua Mouch锛夈

         鏇存浜咰onnectionSTring瑙f瀽鍔熻兘锛屼互澶勭悊甯冨皵绫诲瀷鐨凬O鍜孻ES锛屼互鍙婇潪灏忓啓鍊硷紙鎰熻阿Naucki锛夈

         澧炲姞浜咺nternalConnection绫伙紝淇敼浜嗚繛鎺ユ睜鍔熻兘銆

         瀹炵幇浜哖ersist Security Info锛堟寔缁у畨鍏ㄤ俊鎭級銆

         涓洪」鐩鍔犱簡security.cs鍜寁ersion.cs銆

         鏇存浜哖arameter.cs涓殑DateTime澶勭悊鍔熻兘锛堟劅璋urkhard Perkens-Golomb锛夈

         鏇存浜嗘煇浜涚被鍨嬫姏鍑篶ast寮傚父鐨勫弬鏁板簭鍒楀寲闂銆

         鏇存浜咲ataReader锛岃浆鎹㈡墍鏈夌殑杩斿洖鍊间互闃叉鎶涘純閿欒锛堟劅璋eith Murray锛夈

         涓篊ommand.ExecuteReader澧炲姞浜嗕唬鐮侊紝濡傛灉鍒濆SQL鍛戒护鎶涘嚭寮傚父锛屽皢杩斿洖Null锛堟劅璋urkhard Perkens-Golomb锛夈

         鏋勯犱簡涓庨噸缁勪竴璧峰紩鍏xecuteScalar缂洪櫡銆

         杩涜浜嗛噸鏂版瀯閫狅紝鍏佽LOCAL DATA INFILE锛屼互鍙婃洿濂界殑淇℃伅鍖呮帓搴忋

         鏇存浜嗕笌閲嶇粍鏈夊叧鐨勬暟涓己闄枫

         瀹屾垚浜嗗墠鏈熷伐浣滐紝鏀寔Mysql 4.1涓洿瀹夊叏鐨勫瘑鐮併備笉鍐嶆敮鎸4.1鐗堜腑鐨勬棫瀵嗙爜銆

         姝g‘澶勭悊绯荤粺鍙傛暟鍚庢樉绀哄弬鏁帮紙Adam M. (adammil)锛夈

         鐜板湪锛屽彲灏嗗瓧绗︿覆鐩存帴璧嬬粰blob瀛楁锛圓dam M.锛夈

         鏇存浜嗘诞鐐瑰弬鏁帮紙鎰熻阿Pent锛夈

         鏀瑰杽浜嗗弬鏁癱tor鍜孭arameterCollection.Add鏂规硶锛屼互鏇村ソ鍦板尮閰峉qlClient锛堟劅璋oshua Mouch锛夈

         鏇存浜咰onnection.CreateCommand浠ヨ繑鍥濵ySqlCommand绫诲瀷銆

         鏇存浜嗚繛鎺ュ瓧绗︿覆璁捐鍣ㄧ殑瀵硅瘽妗嗛棶棰橈紙鎰熻阿Abraham Guyt锛夈

         鏇存浜嗕笌鍙戦佸懡浠ゆ棤娉曟绘槸璇诲彇鍝嶅簲淇℃伅鍖呮湁鍏崇殑闂锛堟劅璋oshua Mouch锛夈

         鏇存浜嗘煇浜汢lob绫诲瀷鏃犳硶琚鐞嗙殑鍙傛暟搴忓垪鍖栭棶棰橈紙鎰熻阿Sean McGinnis锛夈

         浠嶥ataReader浠g爜涓垹闄や簡浼狹essageBox.show锛堟劅璋oshua Mouch锛夈

         鏇存浜唖plit sql浠g爜涓殑涓戦檵缂洪櫡锛堟劅璋㈡墍鏈変汉锛 :-) )

26.2.5.14. 鐗堟湰0.71

         鏇存浜哅ySqlStream涓殑缂洪櫡锛屽嵆鍙兘浼氳鍙栬繃澶氭暟鎹紙鎰熻阿Peter Belbin锛夈

         瀹炵幇浜咹asRows锛堟劅璋ash Pherson锛夈

         鏇存浜嗗ぇ浜256鍒楃殑琛ㄤ細瀵艰嚧寮傚父鐨勯棶棰橈紙鎰熻阿Joshua Kessler锛夈

         鏇存浜嗕互鈥;鈥濈粨鏉熺殑SQL璇彞浼氬鑷撮棶棰樼殑缂洪櫡锛堟劅璋hane Krueger锛夈

         鏇存浜嗛┍鍔ㄤ腑鐨勭己闄凤紝鍗筹紝閿欒娑堟伅琚埅鍘1涓瓧绗︼紙鎰熻阿Shane Krueger锛夈

         浣垮緱MySqlException鎴愪负鍙簭鍒楀寲鐨勶紙鎰熻阿Mathias Hasselmann锛夈

26.2.5.15. 鐗堟湰0.70

         鏇存柊浜嗕竴浜涘瓧绗︿唬鐮侀〉锛屼娇涔嬫洿鍔犲噯纭

         鏇存浜嗛槄璇诲櫒鑳藉鍦ㄥ凡鏈夋墦寮闃呰鍣ㄧ殑杩炴帴涓婃墦寮鐨勯棶棰樸

         鍙戝竷浜0.70銆

         灏嗘祴璇曠Щ鑷冲崟鐙殑MySqlClientTests涓嬨

         鏇存浜嗛┍鍔ㄧ▼搴忓簭鍒楁贩涔辩殑鎰氳牏闂锛堟劅璋eter Belbin锛夈

         澧炲姞浜嗕竴浜涚閬撴祴璇曘

         灏嗛粯璁ゆ渶澶ф睜澶у皬澧炲姞鍒50銆

         涓嶮ono 0-24涓璧疯繘琛屼簡缂栬瘧銆

         鏇存浜嗚繛鎺ュ拰鏁版嵁闃呰鍣ㄥ鐞嗛棶棰樸

         涓哄弬鏁板簭鍒楀寲澧炲姞浜嗗瓧绗︿覆鏁版嵁绫诲瀷澶勭悊鍔熻兘銆

         鏇存浜嗘姏鍑哄紓甯稿悗鍦ㄩ┍鍔ㄧ▼搴忎腑鍑虹幇鐨勯『搴忛棶棰橈紙鎰熻阿Burkhard Perkens-Golomb锛夈

         澧炲姞浜嗗CommandBehavior.SingleRow鍒癉ataReader鐨勬敮鎸併

         鏇存浜嗗懡浠ql鐨勫鐞嗗姛鑳斤紝浠ヤ究鑳芥洿濂藉湴澶勭悊寮曠敤锛堟劅璋heo Spears锛夈

         鏇存浜哾ouble銆乻ingle鍜宒ecimal鍊肩殑瑙f瀽闂锛屼互瑙i噴闈炶嫳鏂囧垎闅旂銆傚鏋滀綘姝d娇鐢ㄧ‖缂栫爜sql锛屼粛椤讳娇鐢ㄦ纭殑璇硶锛屼絾鏄紝濡傛灉浣犱娇鐢ㄥ弬鏁帮紝浠g爜灏嗚浆鎹㈡诞鐐圭被鍨嬶紝浠ヤ究鍦ㄨ繘鍑烘湇鍔″櫒鐨勮繃绋嬩腑鎭板綋鍦板湪鍐呴儴浣跨敤鈥.鈥濄俒鎰熻阿鍖垮悕浜篯銆

         澧炲姞浜哅ySqlStream绫伙紝浠ョ畝鍖栬秴鏃跺拰椹卞姩缂栫爜銆

         鏇存浜咲ataReader锛屼互渚垮湪鐩稿叧杩炴帴鍏抽棴鏃舵伆褰撳湴鍏抽棴瀹冦俒鎰熻阿smishra]銆

         浣垮緱瀹㈡埛绔洿鍏煎SqlClient锛屽湪杩炴帴鑳藉鐢ㄤ簬杩愯鍙︿竴鍛戒护鍓嶅叧闂璂ataReaders銆

         鏀硅繘浜嗗瓧娈典腑鐨凞BNull.Value澶勭悊鍔熻兘銆

         澧炲姞浜嗘暟涓崟鍏冩祴璇曘

         鏇存浜哅ySqlException锛屼互渚胯兘璋冪敤鍩烘湰绫伙細-o

         鏀硅繘浜嗛┍鍔ㄧ紪鐮併

         鏇存浜哊extResult鍦ㄦ渶鍚1涓粨鏋滈泦涓婅繑鍥炩滃亣鈥濈殑缂洪櫡銆

         涓篗ySQL澧炲姞浜嗗涓祴璇曘

         閫氳繃绛夊寲鏃犵鍙32bit鍊煎拰Int64锛屼互鍙婃棤绗﹀彿16bit鍊煎拰Int32绛夛紝鏀硅繘浜嗘姏寮冮棶棰樸

         涓篗ySqlParameter澧炲姞浜嗘柊鐨刢tor锛堝悕绉般佺被鍨嬨佸ぇ灏忋乻rccol锛夈

         鏇存浜哅ySqlDataReader涓瓨鍦ㄧ殑闂锛屽嵆锛屽湪杩斿洖瀛楁璁℃暟鍓嶏紝涓嶈兘妫鏌ョ┖鐨勫瓧娈靛垪琛ㄣ

         寮濮嬪鍔犱簡MySqlClient鍗曞厓娴嬭瘯锛堝鍔犱簡MySqlClient/Tests鏂囦欢澶逛互鍙婁竴浜涙祴璇曡寖渚嬶級銆

         鏇存浜嗚繛鎺ュ瓧绗︿覆澶勭悊涓殑涓浜涢棶棰樸

         灏咺NIT_DB绉诲埌MySqlPool銆傚彲鎴栬浼氬湪姝ょЩ鍔ㄥ畠锛岃繖鏄湪鍗忓晢鐨勫噯澶囪繃绋嬩腑銆

         鏇存浜咰ommandBuilder涓瓨鍦ㄧ殑缂洪櫡锛岃缂洪櫡浼氶樆姝㈡彃鍏ユ纭嚭鐜般

         鏀瑰啓浜嗕竴浜涘唴閮ㄦ瀯浠讹紝浠庤屼娇寰桟ommand鐨勬墍鏈変笁绉嶆墽琛屾柟娉曞潎鑳芥纭伐浣溿

         鏇存浜嗗湪鍩哄噯娴嬭瘯杩囩▼涓彂鐜扮殑涓浜涘皬闂銆

         CoonectionPooling鐨勯娆℃埅闄ゅ伐浣滄伆褰撱備繚鐣欎簡鈥渕in pool size鈥濆拰鈥渕ax pool size鈥濄

         杩涜澶勭悊锛屽厑璁歌繑鍥炲涓粨鏋滈泦銆

         鐜板湪锛屽瓧绗﹂泦鐨勫鐞嗘洿涓烘櫤鑳藉寲銆傚惎鍔ㄦ椂锛岄┍鍔ㄧ▼搴忔煡璇ySQL锛屽鎵鹃粯璁ょ殑瀛楃闆嗐傞殢鍚庯紝濡傛灉鑳藉鍔犺浇浠g爜椤碉紝璇ュ瓧绗﹂泦灏嗙敤浜庤浆鎹€傚涓嶇劧锛屽皢浣跨敤褰撳墠鎿嶄綔绯荤粺鐨勯粯璁や唬鐮侀〉銆

         澧炲姞浜嗕唬鐮侊紝浠ヤ究灏嗘帹鏂殑绫诲瀷淇濆瓨鍦ㄥ悕绉帮紝浠ュ強鍙傛暟鐨勫糲tor涓

         姝ゅ锛屽鏋滀娇鐢╒alue灞炴ф洿鏀逛簡绌哄弬鏁扮殑鍊硷紝杩樿兘鎺ㄦ柇绫诲瀷銆

         杞崲浜嗘墍鏈夌殑鏂囦欢浠ヤ娇鐢ㄦ伆褰撶殑Camel鑼冧緥銆傜幇鍦紝鍦ㄦ墍鏈夋枃浠朵腑锛孧ySQL鏄疢ySql銆侾gSQL鐜板湪鏄疨gSql銆

         涓篜gSql浠g爜澧炲姞浜嗗睘鎬э紝浠ラ槻姝㈣璁″櫒鏄剧ず瀹冦

         涓哄弬鏁板璞″鍔犱簡MySQLDbType灞炴э紝骞朵负浠嶥bType鍒癕ySQLDbType鐨勮浆鎹㈠鍔犱簡鎭板綋鐨勮浆鎹唬鐮併

         浠嶮ySQLParameter.cs涓垹闄や簡浠庢湭浣跨敤鐨凮bjectToString鏂规硶銆

         鏇存浜哖arameterCollection涓殑Add(..)鏂规硶锛屼笉蹇呬娇鐢ˋdd(name, value)鍙栬屼唬涔嬨

         鏇存浜哖arameterCollection涓殑IndexOf鍜孋ontains锛屼娇涔嬫竻妤氫繚瀛樺弬鏁板悕鏃朵笉闇瑕丂銆

         鏇存浜咰ommand.ConvertSQLToBytes锛屼粎鍏佽鑳藉鏋勫嚭鐜板湪MySQL鍙橀噺鍚嶄腑鐨勫瓧绗︺

         鏇存浜咲ataReader鍜屽瓧娈碉紝浠庤屼娇寰桞lob瀛楁鑳藉浠嶧ield.cs璇诲彇鍏舵暟鎹紝鑰屼笖GetBytes宸ヤ綔姝g‘銆

         涓篗ySQLCommand鐨凜ommandText灞炴у鍔犱簡绠鍗曠殑鏋勯犲櫒缂栬緫鍣ㄣ

         鏇存浜咰ommandBuilder鍜孭arameter搴忓垪鍖栵紝鎸囨槑鍦ㄥ弬鏁板悕绉颁腑涓嶄繚瀛楡銆

         浠嶧ield.cs鍒犻櫎浜哅ySQLFieldType enum锛岀幇浣跨敤MySQLDbType enum銆

         涓烘暟涓被澧炲姞浜咲esigner灞炴э紝闃叉浜嗕娇鐢╒S.Net鏃剁殑璁捐鍣ㄨ鍥俱

         鏇存浜咰onnectionString璁捐鍣ㄤ腑鐨勫垵濮嬬洰褰曠被鍨嬨

         鍒犻櫎浜嗕笌锛堝悕绉般佺被鍨嬨佸硷級鍐茬獊鐨3绉峂ySQLParameter鍙傛暟ctor銆

         鏇存敼浜哅ySQLParameter锛岀幇鍦ㄨ兘澶熶繚瀛榩aramName鑰屾棤闇鍓嶅@锛堣繖淇浜嗕娇鐢ㄨ璁″櫒鏄殑Null鎻掑叆闂锛夈

         鏇存敼浜嗙敤浜嶮ySQLParameter鐨凾ypeConverter锛屼互渚胯兘澶熶笌鎵鏈夊睘鎬т竴璧蜂娇鐢╟tor銆

26.2.5.16. 鐗堟湰0.68

         鏇存浜嗛┍鍔ㄧ▼搴忎腑鐨勯『搴忛棶棰樸

         澧炲姞浜咲bParametersEditor锛屼娇寰楀弬鏁扮紪杈戞洿鍍廠qlClient銆

         鏇存浜咰ommand绫伙紝浠ヤ究鑳藉浣跨敤璁捐鍣ㄧ紪杈戝弬鏁般

         鏇存柊浜嗚繛鎺ュ瓧绗︿覆璁捐鍣紝鏀寔浣跨敤鍘嬬缉鏍囧織銆

         鏇存浜嗗瓧绗︿覆缂栫爜鍔熻兘锛屼粠鑰屼娇寰楁娲插瓧绗︼紙濡锛夎兘澶熸纭伐浣溿

         鍒涘缓浜嗗熀鏈被锛屼互甯姪鍒涘缓鏂扮殑鏁版嵁Provider銆

         鍦ㄨ繛鎺ュ瓧绗︿覆涓鍔犱簡瀵筓ID鍏抽敭瀛楃殑鏀寔銆

         瀛楁銆佸弬鏁板拰鍛戒护鐜板湪閮借兘浣跨敤DBNull.Value锛岃屼笉鏄痭ull銆

         浣跨敤DBNull.Value鐨凜ommandBuilder銆

         鏈嚭鐜癮uto_insert瀛楁鏃讹紝CommandBuilder鐜板湪鑳芥纭垱寤烘彃鍏ュ懡浠ゃ

         鐜板湪锛屽瓧娈典娇鐢╰ypeof鍏抽敭瀛楁潵杩斿洖System.Types锛堟ц兘锛夈

26.2.5.17. 鐗堟湰0.65

         鐩墠瀹炵幇浜哅ySQLCommandBuilder銆

         鐩墠瀹炵幇浜嗕簨鍔℃敮鎸侊紙骞堕潪鎵鏈夌殑琛ㄧ被鍨嬪潎鏀寔瀹冿級銆

         鏇存浜咷etSchemaTable锛屼笉鍐嶄娇鐢▁sd锛堝浜嶮ono锛夈

         椹卞姩绋嬪簭鍏堣兘鍏煎Mono锛侊紒

         鐜板湪鏀寔TIME鏁版嵁绫诲瀷銆

         闇瑕佹洿澶氬伐浣滀互鏀瑰杽Timestamp鏁版嵁绫诲瀷澶勭悊銆

         鏇存敼浜嗘墍鏈夌被鐨勭壒寰佷互鍖归厤瀵瑰簲鐨凷qlClient绫汇

26.2.5.18. 鐗堟湰0.60

         閲囩敤SharpZipLib鐨勫崗璁帇缂╋紙www.icsharpcode.net锛夈

         Windows骞冲彴涓婄殑鍛藉悕绠¢亾鐜板伐浣滄甯搞

         瀹屾垚浜嗘洿澶氬伐浣滐紝鏀瑰杽浜員imestamp鏁版嵁绫诲瀷澶勭悊銆

         鍦―ataReader涓婂疄鐜颁簡Ienumerable锛屼互浣緿ataGrid鑳芥伆褰撳伐浣溿

26.2.5.19. 鐗堟湰0.50

         閫氳繃鍒犻櫎缃戠粶鍚屾浠g爜涓殑缂洪櫡锛屽ぇ骞呭害鎻愰珮浜嗛熷害銆

         椹卞姩绋嬪簭涓嶅啀瀵规暟鎹杩涜缂撳啿澶勭悊锛堟洿鍏煎ADO.Net锛夈

         鏇存浜嗕笌TIMESTAMP鍜孌ATETIME瀛楁鏈夊叧鐨勮浆鎹㈢己闄枫

26.3.聽MySQL Connector/J

閫氳繃JDBC椹卞姩锛孧ySQL鎻愪緵浜嗕笌浣跨敤Java缂栫▼璇█寮鍙戠殑瀹㈡埛绔簲鐢ㄧ▼搴忕殑杩為氭э紝璇ラ┍鍔ㄧО涓篗ySQL Connector/J銆

MySQL Connector/J鏄竴绉岼DBC-3.0鈥滅被鍨4鈥濋┍鍔紝杩欐剰鍛崇潃瀹冩槸涓绉嶇函Java绋嬪簭锛屽疄鏂戒簡3.0鐗圝DBC瑙勮寖锛屽苟鑳戒娇鐢∕ySQL鍗忚涓嶮ySQL鏈嶅姟鍣ㄧ洿鎺ラ氫俊銆

鏈枃妗f槸涓哄垵绾DBC寮鍙戜汉鍛樺噯澶囧拰瀹夋帓鐨勩傚鏋滀綘宸叉湁浜嗕娇鐢↗DBC鏂归潰鐨勭粡楠岋紝鍙洿鎺ヤ粠瀹夎 Connector/J寮濮嬨

灏界JDBC鏈韩寰堟湁鐢紝浣嗘垜浠笇鏈涳紝濡傛灉浣犲湪闃呰瀹屾湰鎵嬪唽鐨勫墠鍑犺妭鍚庡皻鏈啛鎮塉DBC锛岄櫎浜嗘渶骞冲父鐨勯棶棰樺搴旈伩鍏嶅叏闈娇鐢ㄢ滆8鈥滼DBC锛屽簲鑰冭檻浣跨敤娴佽鐨勬灦鏋勶紝濡HibernateSpringJDBC妯℃澘Ibatis SQL Maps绛夛紝浣跨敤瀹冧滑鏉ュ畬鎴愬ぇ澶氭暟閲嶅鎬у伐浣滐紝浠ュ強鍦ㄦ煇浜涙椂渚渶瑕佺敤鍒癑DBC鐨勭箒閲嶄换鍔°

鏈妭涓嶆槸浣滀负瀹屾暣鐨凧DBC鏁欑▼鑰岃璁$殑銆傚鏋滈渶瑕佷簡瑙d娇鐢↗DBC鏂归潰鐨勬洿澶氫俊鎭紝鎴栬浼氬涓嬭堪鍦ㄧ嚎鏁欑▼鎰熷叴瓒o紝涓庤繖閲屾彁渚涚殑淇℃伅鐩告瘮锛屽畠浠粙缁嶇殑鏇翠负璇︾粏鍜屾洿鍏锋繁搴︺

         JDBC鍩虹锛孲un鍏徃鎻愪緵鐨勬暀绋嬶紝娑电洊浜咼DBC鐨勫熀鏈富棰樸傘

         JDBC绠鏄庤绋锛孲un鍜孞Guru鎻愪緵浜嗘洿娣辩殑鏁欑▼銆

26.3.1. 鍩烘湰鐨凧DBC姒傚康

鍦ㄦ湰鑺備腑锛屼粙缁嶄竴浜涗竴鑸х殑JDBC鑳屾櫙鐭ヨ瘑銆

26.3.1.1. 浣跨敤DriverManager鎺ュ彛杩炴帴鍒癕ySQL

鍦ㄥ簲鐢ㄦ湇鍔″櫒澶栦娇鐢↗DBC鏃讹紝DriverManager绫诲皢鐢ㄤ簬绠$悊杩炴帴鐨勫缓绔嬨

闇瑕佸憡璇塂riverManager搴斾笌鍝釜JDBC椹卞姩寤虹珛杩炴帴銆傚畬鎴愯浠诲姟鐨勬渶绠鍗曟柟娉曟槸锛氬湪瀹炴柦浜唈ava.sql.Driver鎺ュ彛鐨勭被涓婁娇鐢–lass.forName()銆傚浜嶮ySQL Connector/J锛岃绫荤殑鍚嶇О鏄痗om.mysql.jdbc.Driver銆傞噰鐢ㄨ鏂规硶锛屽彲浣跨敤澶栭儴閰嶇疆鏂囦欢鏉ユ彁渚涜繛鎺ュ埌鏁版嵁搴撴椂灏嗕娇鐢ㄧ殑椹卞姩绫诲悕鍜岄┍鍔ㄥ弬鏁般

鍦ㄤ笅闈㈢殑Java浠g爜涓紝浠嬬粛浜嗗湪搴旂敤绋嬪簭鐨刴ain()鏂规硶涓敞鍐孧ySQL Connector/J鐨勬柟寮忥細

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
 
// Notice, do not import com.mysql.jdbc.*
// or you will have problems!锛堟敞鎰忥紝涓嶈瀵煎叆com.mysql.jdbc.*锛屽惁鍒// 灏嗗嚭鐜伴棶棰橈紒锛
 
public class LoadDriver {
    public static void main(String[] args) {
        try {
            // The newInstance() call is a work around for some
            // broken Java implementations
 
            Class.forName("com.mysql.jdbc.Driver").newInstance();
        } catch (Exception ex) {
            // handle the error
        }
}

鍦―riverManager涓敞鍐屼簡椹卞姩鍚庯紝閫氳繃璋冪敤DriverManager.getConnection()锛岃兘澶熻幏寰椾笌鐗规畩鏁版嵁搴撶浉杩炵殑杩炴帴瀹炰緥銆

绀轰緥26.1锛氫粠DriverManager鑾峰緱杩炴帴

鍦ㄦ湰绀轰緥涓紝浠嬬粛浜嗕粠DriverManager鑾峰緱杩炴帴瀹炰緥鐨勬柟娉曘傚浜巊etConnection()鏂规硶锛屾湁涓浜涗笉鍚岀殑鐗规с傚叧浜庡浣曚娇鐢ㄥ畠浠殑鏇村淇℃伅锛岃鍙傞槄涓嶫DK涓璧锋彁渚涚殑API鏂囨。銆

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
 
    ... try {
            Connection conn = DriverManager.getConnection("jdbc:mysql://localhost/test?user=monty&password=greatsqldb");
 
            // Do something with the Connection
 
           ....
        } catch (SQLException ex) {
            // handle any errors
            System.out.println("SQLException: " + ex.getMessage());
            System.out.println("SQLState: " + ex.getSQLState());
            System.out.println("VendorError: " + ex.getErrorCode());
        }

涓鏃﹀缓绔嬩簡杩炴帴锛屽畠鍙鐢ㄤ簬鍒涘缓璇彞鍜孭reparedStatements锛屽苟妫绱㈠叧浜庢暟鎹簱鐨勫厓鏁版嵁銆傚湪涓嬮潰鏁拌妭鍐咃紝缁欏嚭浜嗚繘涓姝ョ殑瑙i噴銆

26.3.1.2. 浣跨敤璇彞浠ユ墽琛孲QL

浣跨敤璇彞锛屽彲鎵ц鍩烘湰鐨凷QL鏌ヨ锛屽苟閫氳繃涓嬮潰浠嬬粛鐨凴esultSet绫绘绱㈢粨鏋溿

瑕佹兂鍒涘缓璇彞瀹炰緥锛屽簲閫氳繃鍓嶉潰浠嬬粛鐨凞riverManager.getConnection()鎴朌ataSource.getConnection()鏂规硶涔嬩竴锛屽湪妫绱㈢殑杩炴帴瀵硅薄涓婅皟鐢╟reateStatement()鏂规硶銆

涓鏃︽嫢鏈変簡璇彞瀹炰緥锛屽彲浠ヤ笌甯屾湜浣跨敤鐨凷QL涓璧烽氳繃璋冪敤executeQuery(String)鏂规硶鎵цSELECT鏌ヨ銆

瑕佹兂鏇存柊鏁版嵁搴撲腑鐨勬暟鎹紝鍙娇鐢╡xecuteUpdate(String SQL)鏂规硶銆傝鏂规硶灏嗚繑鍥炲彈鏇存柊璇彞褰卞搷鐨勮鏁般

濡傛灉浣犱簨鍏堜笉娓呮SQL璇彞鏄疭ELECT鎴朥PDATE/INSERT锛屽簲浣跨敤execute(String SQL)鏂规硶銆傚鏋淪QL鏌ヨ鏄疭ELECT锛屾湰鏂规硶灏嗚繑鍥炩滅湡鈥濓紝濡傛灉SQL鏌ヨ鏄疷PDATE/INSERT/DELETE锛屾湰鏂规硶灏嗚繑鍥炩滃亣鈥濄傚鏋滄槸SELECT鏌ヨ锛岃兘澶熼氳繃璋冪敤getResultSet()鏂规硶妫绱㈢粨鏋溿傚鏋滄槸UPDATE/INSERT/DELETE鏌ヨ锛岃兘澶熼氳繃鍦ㄨ鍙ュ疄渚嬩笂璋冪敤getUpdateCount()妫绱㈠彈褰卞搷鐨勮璁℃暟銆

绀轰緥26.2锛氫娇鐢╦ava.sql.Statement鎵цSELECT鏌ヨ

// assume conn is an already created JDBC connection
Statement stmt = null;
ResultSet rs = null;

try {
    stmt = conn.createStatement();
    rs = stmt.executeQuery("SELECT foo FROM bar");

    // or alternatively, if you don't know ahead of time that
    // the query will be a SELECT...

    if (stmt.execute("SELECT foo FROM bar")) {
        rs = stmt.getResultSet();
    }

    // Now do something with the ResultSet ....
} finally {
    // it is a good idea to release
    // resources in a finally{} block
    // in reverse-order of their creation
    // if they are no-longer needed

    if (rs != null) {
        try {
            rs.close();
        } catch (SQLException sqlEx) { // ignore }

        rs = null;
    }

    if (stmt != null) {
        try {
            stmt.close();
        } catch (SQLException sqlEx) { // ignore }

        stmt = null;
    }
}

26.3.1.3. 浣跨敤CallableStatements浠ユ墽琛屽瓨鍌ㄧ▼搴

浠嶮ySQL鏈嶅姟鍣5.0鐗堝紑濮嬶紝涓嶤onnector/J 3.1.1鎴栨洿鏂扮増鏈竴璧蜂娇鐢ㄦ椂锛屽彲瀹屽叏瀹炵幇java.sql.CallableStatement鎺ュ彛锛getParameterMetaData()鏂规硶渚嬪銆

鍦∕ySQL鍙傝冩墜鍐岀殑鈥瀛樺偍绋嬪簭鍜屽嚱鏁鈥濅竴鑺備腑锛屼粙缁嶄簡MySQL瀛樺偍绋嬪簭鐨勮娉曘

閫氳繃JDBC鐨CallableStatement鎺ュ彛锛Connector/J鎸囨槑浜嗗瓨鍌ㄧ▼搴忕殑鍔熻兘銆

鍦ㄤ笅闈㈢殑绀轰緥涓紝缁欏嚭浜1涓瓨鍌ㄧ▼搴忥紝瀹冭繑鍥炲閲忎负1鐨inOutParam鐨勫硷紝骞堕氳繃inputParam浼犻掍簡浣滀负ResultSet鐨勫瓧绗︿覆銆

绀轰緥26.3. 瀛樺偍绋嬪簭绀轰緥

CREATE PROCEDURE demoSp(IN inputParam VARCHAR(255), INOUT inOutParam INT)
BEGIN
    DECLARE z INT;
    SET z = inOutParam + 1;
    SET inOutParam = z;
 
    SELECT inputParam;
 
    SELECT CONCAT('zyxw', inputParam);
END

瑕佹兂涓嶤onnector/J涓璧蜂娇鐢demoSp锛屽彲閲囧彇涓嬭堪姝ラ锛

1.    浣跨敤Connection.prepareCall()鍑嗗鍙皟鐢ㄨ鍙ャ

娉ㄦ剰锛屽繀椤讳娇鐢↗DBC杞箟璇硶锛岃屼笖蹇呴』浣跨敤鍖呭惈鍗犱綅绗︾殑鍦嗘嫭鍙凤細

绀轰緥26.4. 浣跨敤Connection.prepareCall()

瀵煎叆java.sql.CallableStatement
 
...
 
    //
    // Prepare a call to the stored procedure 'demoSp'
    // with two parameters
    //
    // Notice the use of JDBC-escape syntax ({call ...})
    //
 
    CallableStatement cStmt = conn.prepareCall("{call demoSp(?, ?)}");
 
 
 
    cStmt.setString(1, "abcdefg");

娉ㄩ噴锛

Connection.prepareCall()鏄竴绉嶅紑閿寰堝ぇ鐨勬柟娉曪紝鍘熷洜鍦ㄤ簬椹卞姩绋嬪簭鎵ц鐨勬敮鎸佽緭鍑哄弬鏁扮殑鍏冩暟鎹绱€傚嚭浜庢ц兘鏂归潰鐨勫師鍥狅紝搴斿湪浣犵殑浠g爜涓啀娆′娇鐢CallableStatement瀹炰緥锛岄氳繃璇ユ柟寮忥紝浣垮Connection.prepareCall()鐨勪笉蹇呰璋冪敤闄嶈嚦鏈浣庛

2.      娉ㄥ唽杈撳嚭鍙傛暟锛堝鏋滄湁鐨勮瘽锛

涓轰簡妫绱㈣緭鍑哄弬鏁扮殑鍊硷紙鍒涘缓瀛樺偍绋嬪簭鏃舵寚瀹氫负OUT鎴朓NOUT鐨勫弬鏁帮級锛JDBC瑕佹眰鍦CallableStatement鎺ュ彛涓娇鐢ㄥ悇绉峳egisterOutputParameter()鏂规硶鏉ユ墽琛岃鍙ヤ箣鍓嶆寚瀹氬畠浠細

绀轰緥26.5. 娉ㄥ唽杈撳嚭鍙傛暟

瀵煎叆java.sql.Types
 
...
    //
    // Connector/J supports both named and indexed
    // output parameters. You can register output
    // parameters using either method, as well
    // as retrieve output parameters using either
    // method, regardless of what method was
    // used to register them.
    //
    // The following examples show how to use
    // the various methods of registering
    // output parameters (you should of course
    // use only one registration per parameter).
    //
 
    //
    // Registers the second parameter as output
    //
 
    cStmt.registerOutParameter(2);
 
    //
    // Registers the second parameter as output, and
    // uses the type 'INTEGER' for values returned from
    // getObject()
    //
 
    cStmt.registerOutParameter(2, Types.INTEGER);
 
    //
    // Registers the named parameter 'inOutParam'
    //
 
    cStmt.registerOutParameter("inOutParam");
 
    //
    // Registers the named parameter 'inOutParam', and
    // uses the type 'INTEGER' for values returned from
    // getObject()
    //
 
    cStmt.registerOutParameter("inOutParam", Types.INTEGER);
 
...

3.      璁剧疆杈撳叆鍙傛暟锛堝鏋滄湁鐨勮瘽锛

杈撳叆浠ュ強杈撳叆锛忚緭鍑哄弬鏁版槸浣滀负PreparedStatement瀵硅薄鑰岃缃殑銆浣嗘槸锛CallableStatement涔熸敮鎸佹寜鍚嶇О璁剧疆鍙傛暟锛

绀轰緥26.6. 璁剧疆CallableStatement杈撳叆鍙傛暟

...
 
    //
    // Set a parameter by index
    //
 
    cStmt.setString(1, "abcdefg");
 
    //
    // Alternatively, set a parameter using
    // the parameter name
    //
 
    cStmt.setString("inputParameter", "abcdefg");
 
    //
    // Set the 'in/out' parameter using an index
    //
 
    cStmt.setInt(2, 1);
 
    //
    // Alternatively, set the 'in/out' parameter
    // by name
    //
 
    cStmt.setInt("inOutParam", 1);
 
...

4.    鎵цCallableStatement锛屽苟妫绱换浣曠粨鏋滈泦鎴栬緭鍑哄弬鏁般

灏界CallableStatement鏀寔璋冪敤浠讳綍璇彞鎵ц鏂规硶锛executeUpdate()executeQuery()execute()锛夛紝鏈鐏垫椿鐨勬柟娉曟槸璋冪敤execute()锛岃繖鏄洜涓猴紝閲囩敤璇ユ柟娉曪紝浣犳棤闇浜嬪厛鐭ラ亾瀛樺偍绋嬪簭鏄惁灏嗚繑鍥炵粨鏋滈泦锛

绀轰緥26.7. 妫绱㈢粨鏋滃拰杈撳嚭鍙傛暟鍊

...
 
    boolean hadResults = cStmt.execute();
 
    //
    // Process all returned result sets
    //
 
    while (hadResults) {
        ResultSet rs = cStmt.getResultSet();
 
        // process result set
        ...
 
        hadResults = cStmt.getMoreResults();
    }
 
    //
    // Retrieve output parameters
    //
    // Connector/J supports both index-based and
    // name-based retrieval
    //
 
    int outputValue = cStmt.getInt(1); // index-based
 
    outputValue = cStmt.getInt("inOutParam"); // name-based
 
...

26.3.1.4. 妫绱UTO_INCREMENT鍒楃殑鍊

鍦↗DBC API 3.0鐗堜箣鍓嶏紝娌℃湁浠庢敮鎸佲滆嚜鍔ㄥ閲忊濇垨ID鍒楃殑鏁版嵁搴撲腑妫绱㈠叧閿肩殑鏍囧噯鏂规硶銆傚浜庨拡瀵筂ySQL鐨勬棭鏈烰DBC椹卞姩锛屾绘槸涓嶅緱涓嶅湪璇彞鎺ュ彛涓婁娇鐢ㄧ壒瀹氱殑MySQL鏂规硶锛屾垨鍦ㄥ悜鎷ユ湁AUTO_INCREMENT鍏抽敭瀛楃殑琛ㄥ彂鍑衡淚NSERT鍚庘濆彂鍑衡淪ELECT LAST_INSERT_ID()鈥濄傜壒娈婄殑MySQL鏂规硶璋冪敤鏄笉鍙Щ妞嶇殑锛岃屼笖瀵逛簬鍙戝嚭鈥淪ELECT鈥濅互鑾峰彇AUTO_INCREMENT鍏抽敭瀛楃殑鍊兼潵璇达紝闇瑕佸鏁版嵁搴撴墽琛屽彟涓寰杩旀搷浣滐紝鍏舵晥鐜囦笉楂樸傚湪涓嬮潰鐨勪唬鐮佺墖娈典腑锛屼粙缁嶄簡妫绱UTO_INCREMENT鍊肩殑涓夌涓嶅悓鏂瑰紡銆傞鍏堬紝浠嬬粛浜咼DBC-3.0鏂版柟娉曗済etGeneratedKeys()鈥濈殑浣跨敤鏂瑰紡锛屽綋浣犻渶瑕佹绱UTO_INCREMENT鍏抽敭瀛楀苟璁块棶JDBC-3.0锛屽畠鏄洰鍓嶇殑棣栭夋柟娉曘傚湪绗2涓ず渚嬩腑锛屼粙缁嶄簡浣跨敤鏍囧噯鈥淪ELECT LAST_INSERT_ID()鈥濇煡璇㈡绱㈢浉鍚屽肩殑鏂规硶銆傚湪鏈鍚庝竴涓ず渚嬩腑锛屼粙缁嶄簡浣跨敤鈥渋nsertRow()鈥濇柟娉曟椂锛岀敤鍙洿鏂扮粨鏋滈泦妫绱UTO_INCREMENT鍊肩殑鏂瑰紡銆

绀轰緥26.8. 浣跨敤Statement.getGeneratedKeys()妫绱UTO_INCREMENT鍒楃殑鍊

   Statement stmt = null;
   ResultSet rs = null;

   try {

    //
    // Create a Statement instance that we can use for
    // 'normal' result sets assuming you have a
    // Connection 'conn' to a MySQL database already
    // available

    stmt = conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY,
                                java.sql.ResultSet.CONCUR_UPDATABLE);

    //
    // Issue the DDL queries for the table for this example
    //

    stmt.executeUpdate("DROP TABLE IF EXISTS autoIncTutorial");
    stmt.executeUpdate(
            "CREATE TABLE autoIncTutorial ("
            + "priKey INT NOT NULL AUTO_INCREMENT, "
            + "dataField VARCHAR(64), PRIMARY KEY (priKey))");

    //
    // Insert one row that will generate an AUTO INCREMENT
    // key in the 'priKey' field
    //

    stmt.executeUpdate(
            "INSERT INTO autoIncTutorial (dataField) "
            + "values ('Can I Get the Auto Increment Field?')",
            Statement.RETURN_GENERATED_KEYS);

    //
    // Example of using Statement.getGeneratedKeys()
    // to retrieve the value of an auto-increment
    // value
    //

    int autoIncKeyFromApi = -1;

    rs = stmt.getGeneratedKeys();

    if (rs.next()) {
        autoIncKeyFromApi = rs.getInt(1);
    } else {

        // throw an exception from here
    }

    rs.close();

    rs = null;

    System.out.println("Key returned from getGeneratedKeys():"
        + autoIncKeyFromApi);
} finally {

    if (rs != null) {
        try {
            rs.close();
        } catch (SQLException ex) {
            // ignore
        }
    }

    if (stmt != null) {
        try {
            stmt.close();
        } catch (SQLException ex) {
            // ignore
        }
    }
}

绀轰緥26.9. 浣跨敤SELECT LAST_INSERT_ID()妫绱UTO_INCREMENT鍒楃殑鍊

   Statement stmt = null;
   ResultSet rs = null;

   try {

    //
    // Create a Statement instance that we can use for
    // 'normal' result sets.

    stmt = conn.createStatement();

    //
    // Issue the DDL queries for the table for this example
    //

    stmt.executeUpdate("DROP TABLE IF EXISTS autoIncTutorial");
    stmt.executeUpdate(
            "CREATE TABLE autoIncTutorial ("
            + "priKey INT NOT NULL AUTO_INCREMENT, "
            + "dataField VARCHAR(64), PRIMARY KEY (priKey))");

    //
    // Insert one row that will generate an AUTO INCREMENT
    // key in the 'priKey' field
    //

    stmt.executeUpdate(
            "INSERT INTO autoIncTutorial (dataField) "
            + "values ('Can I Get the Auto Increment Field?')");

    //
    // Use the MySQL LAST_INSERT_ID()
    // function to do the same thing as getGeneratedKeys()
    //

    int autoIncKeyFromFunc = -1;
    rs = stmt.executeQuery("SELECT LAST_INSERT_ID()");

    if (rs.next()) {
        autoIncKeyFromFunc = rs.getInt(1);
    } else {
        // throw an exception from here
    }

    rs.close();

    System.out.println("Key returned from " + "'SELECT LAST_INSERT_ID()': "
        + autoIncKeyFromFunc);

} finally {

    if (rs != null) {
        try {
            rs.close();
        } catch (SQLException ex) {
            // ignore
        }
    }

    if (stmt != null) {
        try {
            stmt.close();
        } catch (SQLException ex) {
            // ignore
        }
    }
}
   

绀轰緥26.10. 鍦ㄥ彲鏇存柊鐨凴esultSets涓绱UTO_INCREMENT鍒楃殑鍊

   Statement stmt = null;
   ResultSet rs = null;

   try {

    //
    // Create a Statement instance that we can use for
    // 'normal' result sets as well as an 'updatable'
    // one, assuming you have a Connection 'conn' to
    // a MySQL database already available
    //

    stmt = conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY,
                                java.sql.ResultSet.CONCUR_UPDATABLE);

    //
    // Issue the DDL queries for the table for this example
    //

    stmt.executeUpdate("DROP TABLE IF EXISTS autoIncTutorial");
    stmt.executeUpdate(
            "CREATE TABLE autoIncTutorial ("
            + "priKey INT NOT NULL AUTO_INCREMENT, "
            + "dataField VARCHAR(64), PRIMARY KEY (priKey))");

    //
    // Example of retrieving an AUTO INCREMENT key
    // from an updatable result set
    //

    rs = stmt.executeQuery("SELECT priKey, dataField "
       + "FROM autoIncTutorial");

    rs.moveToInsertRow();

    rs.updateString("dataField", "AUTO INCREMENT here?");
    rs.insertRow();

    //
    // the driver adds rows at the end
    //

    rs.last();

    //
    // We should now be on the row we just inserted
    //

    int autoIncKeyFromRS = rs.getInt("priKey");

    rs.close();

    rs = null;

    System.out.println("Key returned for inserted row: "
        + autoIncKeyFromRS);

} finally {

    if (rs != null) {
        try {
            rs.close();
        } catch (SQLException ex) {
            // ignore
        }
    }

    if (stmt != null) {
        try {
            stmt.close();
        } catch (SQLException ex) {
            // ignore
        }
    }
}


   
杩愯涓婇潰鐨勭ず渚嬩唬鐮佹椂锛屽皢鑾峰緱涓嬭堪杈撳嚭锛氫粠getGeneratedKeys():杩斿洖鐨勯敭锛 浠庘淪ELECT LAST_INSERT_ID():鈥濊繑鍥1涓敭锛 浠庢彃鍏ョ殑琛岃繑鍥1涓敭銆傝娉ㄦ剰锛屾湁浜涙椂鍊欙紝浣跨敤鈥淪ELECT LAST_INSERT_ID()鈥濇煡璇㈠崄鍒嗗鏉傦紝鍘熷洜鍦ㄤ簬鍑芥暟鍊间笌杩炴帴鐩稿叧銆傚洜姝わ紝濡傛灉鍦ㄧ浉鍚岃繛鎺ヤ笂瀛樺湪鍏朵粬鏌ヨ锛屽嚱鏁板煎皢琚鐩栥傚彟涓鏂归潰锛屸済etGeneratedKeys()鈥濇柟娉曟槸鐢辫鍙ュ疄渚嬬‘瀹氱殑锛屽洜姝わ紝鍗充娇鍦ㄧ浉鍚岃繛鎺ヤ笂瀛樺湪鍏朵粬鏌ヨ涔熻兘浣跨敤瀹冿紝浣嗗湪鐩稿悓璇彞瀹炰緥涓婂瓨鍦ㄥ叾浠栨煡璇㈡椂鍒欎笉鑳戒娇鐢ㄣ

26.3.2. 瀹夎 Connector/J

璇锋寜鐓т笅杩拌鏄庡畨瑁匔onnector/J銆

26.3.2.1. 鎵闇鐨勮蒋浠剁増鏈

26.3.2.1.1. 鏀寔鐨凧ava鐗堟湰
MySQL Connector/J鏀寔Java-2 JVMs锛屽寘鎷琂DK-1.2.x銆丣DK-1.3.x銆丣DK-1.4.x鍜孞DK-1.5.x锛屽苟闇瑕丣DK-1.4.x鎴栨洿鏂扮殑鐗堟湰杩涜缂栬瘧锛堣屼笉鏄繍琛岋級銆侻ySQL Connector/J涓嶆敮鎸丣DK-1.1.x鎴朖DK-1.0.x銆

鐢变簬瀹炵幇浜唈ava.sql.Savepoint锛孋onnector/J 3.1.0鍜屾洿鏂扮増鏈笉浼氳繍琛屽湪鏃╀簬1.4鐗堢殑JDK涓婏紝闄ら潪鍏抽棴浜嗙被楠岃瘉鍣紙-Xverify:none锛夛紝杩欐槸鍥犱负锛岀被楠岃瘉鍣ㄥ皢璇曞浘鍔犺浇鐢ㄤ簬java.sql.Savepoint鐨勭被瀹氫箟锛岄櫎闈炰娇鐢ㄤ簡savepoint鍔熻兘锛屽惁鍒欓┍鍔ㄧ▼搴忎笉浼氳闂被楠岃瘉鍣ㄣ

鏃╀簬1.4.x鐗堢殑JVM涓婏紝涓嶈兘浣跨敤Connector/J 3.1.0鎴栨洿楂樼増鏈彁渚涚殑鏂扮紦鍐插姛鑳斤紝杩欐槸鍥犱负璇ュ姛鑳戒緷璧JDK-1.4.0涓棣栨鎻愪緵鐨java.util.LinkedHashMap銆

26.3.2.1.2. MySQL鏈嶅姟鍣ㄧ増鏈寚鍗
MySQL Connector/J鏀寔鎵鏈夎憲鍚嶇殑MySQL鏈嶅姟鍣ㄧ増鏈傛煇浜涚壒鎬э紙澶栭敭锛屽彲鏇存柊缁撴灉闆嗭級闇瑕佹洿鏂扮殑MySQL鐗堟湰鎵嶈兘宸ヤ綔銆

涓嶮ySQL鏈嶅姟鍣4.1鐗堟垨鏇撮珮鐗堟湰寤虹珛杩炴帴鏃讹紝鏈濂戒娇鐢∕ySQL Connector/J 3.1鐗堬紝杩欐槸鍥犱负瀹冨叏闈㈡敮鎸佽緝鏂扮増鏈殑鏈嶅姟鍣ㄦ彁渚涚殑鐗规э紝鍖呮嫭Unicode瀛楃銆佽鍥俱佸瓨鍌ㄧ▼搴忓拰鏈嶅姟鍣ㄧ棰勫鐞嗚鍙ャ

灏界3.0鐗圕onnector/J鑳藉涓嶮ySQL鏈嶅姟鍣4.1鎴栨洿楂樼増鏈缓绔嬭繛鎺ワ紝浣嗙敱浜庡疄鐜颁簡Unicode瀛楃鍜屾柊鐨勯壌瀹氭満鍒讹紝灏嗘棤娉曟洿鏂癈onnector/J 3.0浠ユ敮鎸佸綋鍓嶅拰鏈潵鏈嶅姟鍣ㄧ増鏈腑鎻愪緵鐨勬柊鐗规с

26.3.2.1.3. 瀹夎椹卞姩绋嬪簭骞堕厤缃瓹LASSPATH
MySQL Connector/J鏄互.zip鎴.tar.gz褰㈠紡鍒嗗彂鐨勶紝鍏朵腑鍖呭惈婧愮爜銆佺被鏂囦欢銆佷互鍙婁粎涓衡滀簩杩涘埗鈥.jar鐨勭被鏂囦欢锛堝悕涓mysql-connector-java-[version]-bin.jar锛夛紝浠Connector/J 3.1.8寮濮嬶紝椹卞姩绋嬪簭鐨勨滆皟璇曠増鈥濅綅浜庡悕涓衡mysql-connector-java-[version]-bin-g.jar鈥濈殑鏂囦欢涓

浠嶤onnector/J 3.1.9寮濮嬶紝鎴戜滑涓嶅啀鍗曠嫭鎻愪緵.class鏂囦欢锛屼粎鍦ㄤ笌椹卞姩绋嬪簭涓璧锋彁渚涚殑JAR鏂囦欢涓彁渚涘畠浠

涓嶅簲浣跨敤椹卞姩绋嬪簭鐨勨滆皟璇曠増鈥濓紝闄ら潪鏄湪鍚慚ySQL AB閫氭姤闂鎴栫己闄锋椂闇瑕佺敤鍒板畠锛岃繖鏄洜涓衡滆皟璇曠増鈥濅笉鏄负鐢熶骇鐜涓嬬殑杩愯鑰岃璁$殑锛屽鏋滀娇鐢ㄥ畠锛屼細瀵规ц兘閫犳垚璐熼潰褰卞搷銆備簩杩涘埗浠g爜鐨勮皟璇曞彇鍐充簬Aspect/J杩愯鏃跺簱锛岃搴撲綅浜庝笌Connector/J鍒嗗彂鐗堜竴璧锋彁渚涚殑src/lib/aspectjrt.jar鏂囦欢涓

闇瑕佷娇鐢ㄦ伆褰撶殑GUI鎴栧懡浠よ浣跨敤宸ュ叿鏉ヨВ寮鍒嗗彂鏂囦欢锛堜緥濡傦紝鐢ㄤ簬.zip鏂囦欢鐨刉inZip锛屼互鍙婄敤浜.tar.gz鏂囦欢鐨勨渢ar鈥濓級銆傜敱浜庡湪鍒嗗彂鐗堜腑鍙兘瀛樺湪闀挎枃浠跺悕锛屾垜浠噰鐢ㄤ簡GNU tar妗f鏍煎紡銆傞渶瑕佷娇鐢℅NU tar锛堟垨鑳界悊瑙NU tar妗f鏍煎紡鐨勫叾浠栧簲鐢ㄧ▼搴忥級鏉ヨВ寮鍒嗗彂鐗堢殑.tar.gz鏂囦欢銆

涓鏃﹁В鍖呬簡鍒嗗彂鐗堟。妗堟枃浠讹紝鍙互灏唌ysql-connector-java-[version]-bin.jar鏀惧湪浣犵殑绫昏矾寰勪腑锛屾垨鏄湪浣犵殑CLASSPATH鐜鍙橀噺涓坊鍔犲畠鐨勫畬鏁磋矾寰勶紝鎴栨槸鍦ㄥ惎鍔↗VM锛圝ava铏氭嫙鏈猴級鏃剁敤鍛戒护琛屽紑鍏斥-cp鈥濈洿鎺ユ寚瀹氬畠锛岄氳繃璇ユ柟寮忓畨瑁呴┍鍔ㄣ

濡傛灉浣犳墦绠楃敤JDBC DriverManager鏉ヤ娇鐢ㄩ┍鍔紝鍙娇鐢ㄢ渃om.mysql.jdbc.Driver鈥濓紝灏嗗叾鐢ㄤ綔瀹炴柦浜嗏渏ava.sql.Driver鈥濈被銆

绀轰緥26.11. 璁剧疆Unix鐜涓嬬殑CLASSPATH

鍦║nix鐜涓嬶紝涓嬭堪鍛戒护鐢ㄤ簬鈥渃sh鈥濓細

$ setenv CLASSPATH /path/to/mysql-connector-java-[version]-bin.jar:$CLASSPATH

鍙互灏嗕笂杩板懡浠ゆ坊鍔犲埌鎭板綋鐨勩佺敤浜庣櫥褰晄hell鐨勫惎鍔ㄦ枃浠朵腑锛屼粠鑰屼娇寰楁墍鏈夌殑Java搴旂敤绋嬪簭鍧囪兘浣跨敤MySQL Connector/J銆

濡傛灉甯屾湜涓庤濡俆omcat鎴朖boss绛夊簲鐢ㄦ湇鍔″櫒涓璧蜂娇鐢∕ySQL Connector/J锛屽簲浠旂粏闃呰渚涘簲鍟嗘彁渚涚殑鏂囨。锛屼互浜嗚В濡備綍閰嶇疆绗笁鏂圭被搴撶殑鏇村淇℃伅锛岃繖鏄洜涓哄ぇ澶氭暟搴旂敤鏈嶅姟鍣ㄥ潎浼氬拷鐣LASSPATH鐜鍙橀噺銆傚湪鈥涓嶫2EE鍜屽叾浠朖ava妗嗘灦涓璧蜂娇鐢 Connector/J鈥濅竴鑺備腑锛岀粰鍑轰簡閽堝涓浜汮2EE搴旂敤鏈嶅姟鍣ㄧ殑閰嶇疆绀轰緥锛屼絾鏄紝瀵逛簬鐗瑰畾鐨勫簲鐢ㄦ湇鍔″櫒锛孞DBC杩炴帴姹犻厤缃俊鎭殑鏉冨▉淇℃伅婧愭槸璇ュ簲鐢ㄦ湇鍔″櫒鐨勬枃妗c

濡傛灉浣犲噯澶囧紑鍙戝皬鏈嶅姟绋嬪簭鍜岋紡鎴朖SP锛岃屼笖浣犵殑搴旂敤鏈嶅姟鍣ㄦ槸J2EE鍏煎鐨勶紝鍙互灏嗛┍鍔ㄧ殑.jar鏂囦欢鏀惧埌webapp鐨刉EB-INF/lib瀛愮洰褰曚笅锛屽湪J2EE Web搴旂敤绋嬪簭涓紝杩欐槸绗笁鏂圭被搴撶殑鏍囧噯浣嶇疆銆

濡傛灉浣犵殑J2EE搴旂敤鏈嶅姟鍣ㄦ敮鎸佹垨瑕佹眰锛屼篃鍙互浣跨敤com.mysql.jdbc.jdbc2.optional鍙夎蒋浠跺寘涓殑MysqlDataSource鎴朚ysqlConnectionPoolDataSource绫汇傚绉峂ysqlDataSource绫诲潎鏀寔涓嬭堪鍙傛暟锛堥氳繃鏍囧噯鐨勨淪et鈥濆瓨鍙栧櫒锛夛細

         user

         password

         serverName锛堝弬瑙佸墠闈㈠叧浜庢晠闅滃垏鎹富鏈虹殑绔犺妭锛

         databaseName

         port

26.3.2.2. 鍗囩骇鏃х増鏈

MySQL AB璇曞浘浣垮崌绾ц繘绋嬪敖鍙兘绠鍗曪紝浣嗘槸锛屽浜庝换浣曡蒋浠舵潵璇达紝鏌愪簺鏃朵警闇瑕佸湪鏂扮増鏈腑杩涜涓浜涙洿鏀规墠鑳芥敮鎸佹柊鐨勭壒鎬э紝鏀硅繘宸叉湁鐨勫姛鑳斤紝鎴栦笌鏂版爣鍑嗙浉绗︺

鍦ㄦ湰鑺備腑锛屼粙缁嶄簡鎵撶畻浠嶤onnector/J鐨勪竴涓増鏈崌绾у埌鍙︿竴鐗堟湰锛堟垨鑰冭檻鍒癑DBC鐨勫姛鑳斤紝鍗囩骇鍒癕ySQL鏈嶅姟鍣ㄧ殑鏂扮増鏈級鐨勭敤鎴峰簲浜嗚В鐨勪俊鎭

26.3.2.2.1. 浠嶮ySQL Connector/J 3.0鍗囩骇鍒3.1

璁捐Connector/J 3.1鏃讹紝灏介噺浣垮畠鑳藉悜鍚庡吋瀹笴onnector/J 3.0銆傚ぇ鐨勫彉鍖栬鍗曠嫭浣滀负MySQL-4.1鍜屾洿鏂扮増涓殑鏂板姛鑳斤紝鍖呮嫭Unicode瀛楃闆嗐佹湇鍔″櫒绔澶勭悊璇彞銆佺敱鏈嶅姟鍣ㄨ繑鍥炵殑閿欒淇℃伅涓殑SQLState浠g爜銆佷互鍙婂悇绉嶆ц兘澧炲己鐗规э紙鍙氳繃閰嶇疆灞炴у惎鐢ㄦ垨绂佹锛夈

         Unicode瀛楃闆嗭細鍏充簬MySQL鏂扮壒鎬х殑鏇村淇℃伅锛岃鍙傝涓嬩竴鑺傦紝浠ュ強鏈嶅姟鍣ㄦ墜鍐屼腑鐨勨滃瓧绗﹂泦鈥濅竴鑺傘傚鏋滄湁浜涗簨椤归厤缃笉褰擄紝閫氬父浼氭樉绀洪敊璇紝鍚屾椂缁欏嚭閿欒娑堟伅锛屽鈥滈潪娉曟牎瀵圭粍鍚堚濄

         鏈嶅姟鍣ㄧ棰勫鐞嗚鍙ワ細Connector/J 3.1灏嗚嚜鍔ㄦ娴嬫湇鍔″櫒绔澶勭悊璇彞锛屽苟鍦ㄥ彲鐢ㄦ椂鑷姩浣跨敤瀹冧滑锛圡ySQL鏈嶅姟鍣4.1.0鐗堟垨鏇存柊锛夈

浠3.1.7鐗堝紑濮嬶紝椹卞姩绋嬪簭鑳介氳繃鍚勭Connection.prepareStatement()鍙樹綋鎵弿SQL锛屼互鍒ゆ柇瀹冩槸鍚︽槸鑳藉鍦ㄦ湇鍔″櫒绔敮鎸佺殑璇彞绫诲瀷锛屽鏋滀笉琚湇鍔″櫒绔敮鎸侊紝浼氬皢鍏朵綔涓哄鎴风鐨勬ā鎷熼澶勭悊璇彞杩涜澶勭悊銆涔熷彲浠ラ氳繃鍦↗DBC URL涓紶閫掆emulateUnsupportedPstmts=false鈥濈姝㈣鐗规с

濡傛灉搴旂敤绋嬪簭閬囧埌涓庢湇鍔″櫒绔澶勭悊璇彞鏈夊叧鐨勯棶棰橈紝鍙皢鍏跺洖澶嶄负鏃х殑瀹㈡埛绔ā鎷熼澶勭悊璇彞浠g爜锛屽湪鏃╀簬4.1.0鐗堢殑MySQL鏈嶅姟鍣ㄤ腑浠嶄娇鐢ㄨ浠g爜锛岃繛鎺ュ睘鎬у涓嬶細

useServerPrepStmts=false

         鍏锋湁鍏0缁勫垎鐨凞atetimes锛0000-00-00 ...锛夛細鍦↗ava涓紝鏃犳硶鍙潬鍦拌〃绀鸿繖浜涘笺備粠缁撴灉闆嗚鍙栧畠浠椂锛孋onnector/J 3.0.x鎬绘槸浼氬皢鍏惰浆鎹负NULL銆

榛樿鎯呭喌涓嬶紝閬囧埌杩欑被鍊兼椂锛孋onnector/J 3.1灏嗘姏鍑哄紓甯革紝杩欐槸鍥犱负锛屾牴鎹甁DBC鍜孲QL鏍囧噯锛岃繖鏄渶姝g‘鐨勮涓烘柟寮忋傚彲浠ヤ娇鐢ㄢzeroDateTimeBehavior鈥濋厤缃睘鎬ф敼鍙樿琛屼负銆傚厑璁哥殑鍊煎寘鎷細鈥渆xception鈥濓紝锛堥粯璁ゅ硷級锛岀敤浠g爜涓衡淪1009鈥濈殑SQLState鎶涘嚭SQLException锛涒渃onvertToNull鈥濓紝杩斿洖NULL鑰屼笉鏄暟鎹紱浠ュ強鈥渞ound鈥濓紝瀵规棩鏈熻繘琛岃垗鍏ュ鐞嗭紝浣夸箣鎴愪负鏈鎺ヨ繎鐨勫硷紝鍗斥0001-01-01鈥濄

浠嶤onnector/J 3.1.7寮濮嬶紝鑳藉浣跨敤鈥noDatetimeStringSync=true鈥濓紙榛樿鍊间负鈥滃亣鈥濓級锛屽皢ResultSet.getString()涓庤琛屼负鍒嗙寮锛屼粠鑰岃兘澶熶互瀛楃涓茬殑褰㈠紡鎻愬彇鏈鏀瑰彉鐨勫叏0鍊笺傝娉ㄦ剰锛岃繖涔熶細闃绘浣跨敤浠讳綍鏃跺尯杞崲鍔熻兘锛屽洜姝わ紝椹卞姩绋嬪簭灏嗙姝㈠悓鏃跺惎鐢noDatetimeStringSyncuseTimezone銆

         鏂癝QLState浠g爜锛欳onnector/J 3.1閲囩敤MySQL杩斿洖鐨凷QL:1999 SQLState浠g爜锛堝鏋滄敮鎸佺殑璇濓級锛屽畠涓嶅悓浜嶤onnector/J 3.0浣跨敤鐨勨滀紶缁熲漍/Open鐘舵佺爜銆傚鏋滆繛鎺ュ埌浜嗙増鏈綆浜嶮ySQL-4.1.0锛堣兘澶熷皢SQLStates浣滀负閿欒浠g爜缁勬垚閮ㄥ垎杩斿洖鐨勬渶鏃╃増鏈級鐨凪ySQL鏈嶅姟鍣紝椹卞姩绋嬪簭灏嗕娇鐢ㄥ唴缃殑鏄犲皠鍔熻兘銆備綘涔熷彲浠ヤ娇鐢ㄤ笅杩伴厤缃夐」锛岄噰鐢ㄦ棫鐨勬槧灏勩

useSqlStateCodes=false

         鍦˙LOB鍒椾笂璋冪敤ResultSet.getString()灏嗚繑鍥炰唬琛ㄥ畠鐨勫瓧鑺俒]鏁扮粍鐨勫湴鍧锛岃屼笉鏄疊LOB鐨勫瓧绗︿覆褰㈠紡銆侭LOB娌℃湁瀛楃闆嗭紝鍥犳锛屽湪涓嶉犳垚鏁版嵁涓㈠け鎴栨崯鍧忕殑鎯呭喌涓嬶紝涓嶈兘灏嗗畠浠浆鎹负java.lang.Strings銆

瑕佹兂浠LOB鏂瑰紡灏嗗瓧绗︿覆淇濆瓨鍦∕ySQL涓紝鍙娇鐢ㄤ竴绉峊EXT绫诲瀷锛岄┍鍔ㄧ▼搴忎細灏嗗叾褰撲綔java.sql.Clob瀵瑰緟銆

         浠嶤onnector/J 3.1.8寮濮嬶紝椹卞姩鐨勨滆皟璇曠増鈥濓紙鍦ㄥ悕涓衡mysql-connector-java-[version]-bin-g.jar鐨勬枃浠朵腑涓庢甯哥殑浜岃繘鍒jar鏂囦欢鍚嶄负mysql-connector-java-[version]-bin.jar涓璧锋彁渚

浠嶤onnector/J 3.1.9寮濮嬶紝鎴戜滑涓嶅啀鍗曠嫭鎻愪緵.class鏂囦欢锛屼粎鍦ㄤ笌椹卞姩绋嬪簭涓璧锋彁渚涚殑JAR鏂囦欢涓彁渚涘畠浠

涓嶅簲浣跨敤椹卞姩绋嬪簭鐨勨滆皟璇曠増鈥濓紝闄ら潪鏄湪鍚慚ySQL AB閫氭姤闂鎴栫己闄锋椂闇瑕佺敤鍒板畠锛岃繖鏄洜涓衡滆皟璇曠増鈥濅笉鏄负鐢熶骇鐜涓嬬殑杩愯鑰岃璁$殑锛屽鏋滀娇鐢ㄥ畠锛屼細瀵规ц兘閫犳垚璐熼潰褰卞搷銆備簩杩涘埗浠g爜鐨勮皟璇曞彇鍐充簬Aspect/J杩愯鏃跺簱锛岃搴撲綅浜庝笌Connector/J鍒嗗彂鐗堜竴璧锋彁渚涚殑src/lib/aspectjrt.jar鏂囦欢涓

26.3.2.2.2. 鍗囩骇鍒癕ySQL鏈嶅姟鍣4.1鐗堟垨鏇存柊鐗堟湰鏃剁殑JDBC浜嬪疁

         浣跨敤UTF-8瀛楃缂栫爜锛氬湪4.1鐗圡ySQL鏈嶅姟鍣ㄤ箣鍓嶏紝鏈嶅姟鍣ㄤ笉鏀寔UTF-8瀛楃缂栫爜锛屼絾JDBC椹卞姩鑳戒娇鐢ㄥ畠锛屼粠鑰屽厑璁稿湪鏈嶅姟鍣ㄤ笂鐨刲atin1涓繚瀛樺涓瓧绗﹂泦銆

浠嶮ySQL-4.1鐗堝紑濮嬶紝璇ュ姛鑳借鏀惧純銆傚鏋滀綘鏈変緷璧栬鍔熻兘鐨勫簲鐢ㄧ▼搴忥紝鑰屼笖鏃犳硶鍗囩骇瀹冧滑浠ヤ娇鐢∕ySQL鏈嶅姟鍣4.1鐗堟垨鏇撮珮鐗堟湰涓敮鎸佺殑姝f槸Unicode瀛楃闆嗭紝搴斿湪杩炴帴URL涓鍔犱笅杩板睘鎬э細

useOldUTF8Behavior=true

         鏈嶅姟鍣ㄧ棰勫鐞嗚鍙ワ細Connector/J 3.1灏嗚嚜鍔ㄦ娴嬫湇鍔″櫒绔澶勭悊璇彞锛屽苟鍦ㄥ彲鐢ㄦ椂鑷姩浣跨敤瀹冧滑锛圡ySQL鏈嶅姟鍣4.1.0鐗堟垨鏇存柊锛夈傚鏋滃簲鐢ㄧ▼搴忛亣鍒颁笌鏈嶅姟鍣ㄧ棰勫鐞嗚鍙ユ湁鍏崇殑闂锛屽彲灏嗗叾鍥炲涓烘棫鐨勫鎴风妯℃嫙棰勫鐞嗚鍙ヤ唬鐮侊紝鍦ㄦ棭浜4.1.0鐗堢殑MySQL鏈嶅姟鍣ㄤ腑浠嶄娇鐢ㄨ浠g爜锛岃繛鎺ュ睘鎬у涓嬶細

useServerPrepStmts=false

26.3.3. JDBC寮曠敤

26.3.3.1. Driver/Datasource绫诲悕锛孶RL璇硶锛屼互鍙奀onnector/J鐨勯厤缃睘鎬

鍦∕ySQL Connector/J涓疄鐜颁簡java.sql.Driver鐨勭被鍚嶆槸鈥渃om.mysql.jdbc.Driver鈥濄傗渙rg.gjt.mm.mysql.Driver鈥濈被鍚嶄换鏄彲鐢ㄧ殑锛屼互淇濇寔涓嶮M.MySQL鐨勫悜鍚庡吋瀹规с傛敞鍐岄┍鍔ㄧ▼搴忥紝鎴栭厤缃蒋浠朵互浣跨敤MySQL Connector/J鏃讹紝搴斾娇鐢ㄨ绫诲悕銆

鐢ㄤ簬MySQL Connector/J鐨凧DBC URL鏍煎紡濡備笅锛屾柟鎷彿鈥淸, ]鈥濈殑椤逛负鍙夐」锛

jdbc:mysql://[host][,failoverhost...][:port]/[database][?propertyName1][=propertyValue1][&propertyName2][=propertyValue2]...

濡傛灉鏈寚瀹氫富鏈哄悕锛岄粯璁や负鈥127.0.0.1鈥濄傚鏋滄湭鎸囧畾绔彛锛岄粯璁や负鈥3306鈥濓紝瀹冩槸MySQL鏈嶅姟鍣ㄧ殑榛樿绔彛鍙枫

jdbc:mysql://[host:port],[host:port].../[database][?propertyName1][=propertyValue1][&propertyName2][=propertyValue2]...

濡傛灉鏈寚瀹氭暟鎹簱锛屽皢浣跨敤鏃犫滃綋鍓嶁濇暟鎹簱杩涜杩炴帴銆傚湪杩欑鎯呭喌涓嬶紝闇瑕佸湪杩炴帴瀹炰緥涓婅皟鐢ㄢ渟etCatalog()鈥濇柟娉曪紝鎴栧湪SQL涓娇鐢ㄦ暟鎹簱鍚嶆寚瀹氬畬鏁寸殑琛ㄥ悕锛堝嵆鈥淪ELECT dbname.tablename.colname FROM dbname.tablename...鈥濓級銆備笉鎸囧畾杩炴帴鏃朵娇鐢ㄧ殑鏁版嵁搴擄紝璇ラ夐」閫氬父浠呭湪鍒涘缓鐢ㄤ簬澶勭悊澶氫釜鏁版嵁搴撶殑宸ュ叿鏃舵墠鏈夌敤锛屼緥濡侴UI鏁版嵁搴撶鐞嗗櫒銆

MySQL Connector/J鏀寔鏁呴殰鍒囨崲鍔熻兘銆傝繖鏍凤紝灏卞厑璁搁┍鍔ㄧ▼搴忓垏鎹㈣嚦鈥滀粠鈥濅富鏈轰笂锛屽苟浠嶈兘鎵ц鍙鏌ヨ銆備粎褰撹繛鎺ュ浜巃utoCommit(true)鐘舵佹椂锛屾墠浼氬嚭鐜版晠闅滃垏鎹紝杩欐槸鍥犱负褰撲簨鍔℃鍦ㄨ繘琛屾椂锛屾棤娉曞彲闈犲湴淇濊瘉鏁呴殰鍒囨崲銆傚湪浜嬪姟/杩炴帴缁撴潫鍚庯紝澶у鏁板簲鐢ㄦ湇鍔″櫒鍜岃繛鎺ユ睜鍧囦細灏哸utoCommit璁剧疆涓衡滅湡鈥濄

鏁呴殰鍒囨崲鍔熻兘鍏锋湁涓嬭堪琛屼负鏂瑰紡锛

濡傛灉URL灞炴р渁utoReconnect鈥濅负鈥滃亣鈥濓細鏁呴殰鍒囨崲浠呬細鍦ㄨ繛鎺ュ垵濮嬪寲杩囩▼涓嚭鐜帮紝褰撻┍鍔ㄧ▼搴忓垽鏂1鍙颁富鏈哄啀娆″彲鐢ㄦ椂锛屽皢杩斿洖銆

濡傛灉URL灞炴р渁utoReconnect鈥濅负鈥滅湡鈥濓細褰撻┍鍔ㄧ▼搴忓垽鏂繛鎺ュけ璐ユ椂锛堝湪浠绘剰鏌ヨ涔嬪墠锛夛紝灏嗗嚭鐜版晠闅滃垏鎹紝鑰屼笖褰撻┍鍔ㄧ▼搴忓垽鏂1鍙颁富鏈哄啀娆″彲鐢ㄦ椂锛堝彂鍑簈ueriesBeforeRetryMaster鏌ヨ涔嬪悗锛夛紝灏嗚繑鍥炵1鍙颁富鏈恒

鍦ㄤ换浣曚竴绉嶆儏鍐典笅锛屽綋浣犺繛鎺ュ埌缁忚繃鏁呴殰鍒囨崲鐨勬湇鍔″櫒鏃讹紝浼氬皢杩炴帴璁剧疆涓哄彧璇荤姸鎬侊紝鍥犳锛屽浜庝細鏇存敼鏁版嵁鐨勬煡璇㈡潵璇达紝灏嗘姏鍑哄紓甯革紙MySQL鏈嶅姟鍣ㄤ笉浼氬鐞嗚鏌ヨ锛夈

閰嶇疆灞炴у畾涔変簡Connector/J涓嶮ySQL鏈嶅姟鍣ㄨ繘琛岃繛鎺ョ殑鏂瑰紡銆傞櫎闈炰綔浜嗗叾浠栬鏄庯紝鍚﹀垯鍙互涓篋ataSource瀵硅薄鎴朇onnection瀵硅薄璁剧疆灞炴с

鍙噰鐢ㄤ笅杩版柟寮忕殑涓绉嶈缃瓹onfiguration锛堥厤缃級灞炴э細

         鍦╦ava.sql.DataSource鐨凪ySQL瀹炴柦瀹炰緥涓婁娇鐢╯et*()鏂规硶锛堝畠鏄娇鐢╦ava.sql.DataSource瀹炴柦瀹炰緥鏃剁殑棣栭夋柟娉曪級锛

o        com.mysql.jdbc.jdbc2.optional.MysqlDataSource

o        com.mysql.jdbc.jdbc2.optional.MysqlConnectionPoolDataSource

         浣滀负浼犻掔粰DriverManager.getConnection()鎴朌river.connect()鐨刯ava.util.Properties瀹炰緥涓殑 閿/鍊煎銆

         浣滀负URL涓殑JDBC URL鍙傛暟锛屼互浼犻掔粰java.sql.DriverManager.getConnection()銆乯ava.sql.Driver.connect()銆佹垨javax.sql.DataSource鐨剆etURL()鏂规硶鐨凪ySQL瀹炴柦瀹炰緥銆

娉ㄩ噴锛

濡傛灉浣犵敤鏉ラ厤缃甁DBC URL鐨勬柟娉曟槸鍩轰簬XML鐨勶紝闇瑕佷娇鐢╔ML瀛楃鈥&amp;鈥濇潵闅斿紑閰嶇疆鍙傛暟锛屸&鈥濇槸XML鐨勪繚鐣欏瓧绗︺

鍦ㄤ笅闈㈢殑琛ㄥ悇涓紝鍒楀嚭浜嗚繖浜涘睘鎬э細

琛26.1. 杩炴帴灞炴 

灞炴у悕

瀹氫箟

瑕佹眰锛

榛樿鍊

鐗堟湰

Connection/Authentication锛堣繛鎺ワ紡閴村畾锛

user

杩炴帴鐨勭敤鎴

No

 

鍏ㄩ儴

password

杩炴帴鏃朵娇鐢ㄧ殑瀵嗙爜銆

No

 

鍏ㄩ儴

socketFactory

椹卞姩绋嬪簭鐢ㄤ簬鍒涘缓涓庢湇鍔″櫒濂楁帴瀛楄繛鎺ョ殑绫荤殑鍚嶇О銆傝绫诲繀椤诲疄鐜颁簡鎺ュ彛鈥渃om.mysql.jdbc.SocketFactory鈥濓紝骞舵湁鍏叡鏃犲弬閲忔瀯閫犲嚱鏁般

No

com.mysql.jdbc.StandardSocketFactory

3.0.3

connectTimeout

濂楁帴瀛楄繛鎺ョ殑瓒呮椂锛堝崟浣嶄负姣锛夛紝0琛ㄧず鏃犺秴鏃躲備粎瀵笿DK-1.4鎴栨洿鏂扮増鏈湁鏁堛傞粯璁ゅ间负鈥0鈥濄

No

0

3.0.1

socketTimeout

缃戠粶濂楁帴瀛楄繛鎺ョ殑瓒呮椂锛堥粯璁ゅ0琛ㄧず鏃犺秴鏃讹級銆

No

0

3.0.1

useConfigs

鍦ㄨВ鏋怳RL灞炴ф垨搴旂敤鐢ㄦ埛鎸囧畾鐨勫睘鎬т箣鍓嶏紝鍔犺浇鐢遍楀彿鈥,鈥濆垎闅旂殑閰嶇疆灞炴у垪琛ㄣ傚湪鏂囨。鐨勨滈厤缃濋儴鍒嗕腑瑙i噴浜嗚繖浜涢厤缃

No

 

3.1.5

interactiveClient

璁剧疆CLIENT_INTERACTIVE鏍囧織锛屾牴鎹甀NTERACTIVE_TIMEOUT鑰屼笉鏄疻AIT_TIMEOUT鍚慚ySQL閫氭姤瓒呮椂杩炴帴銆

No

false

3.1.0

propertiesTransform

com.mysql.jdbc.ConnectionPropertiesTransform鐨1涓疄鏂藉疄渚嬶紝鍦ㄥ皾璇曡繛鎺ヤ箣鍓嶏紝椹卞姩绋嬪簭灏嗕娇鐢ㄥ畠鏉ユ洿鏀逛紶閫掔粰椹卞姩鐨刄RL灞炴с

No

 

3.1.4

useCompression

涓庢湇鍔″櫒杩涜閫氫俊鏃堕噰鐢▃lib鍘嬬缉锛堢湡锛忓亣锛夛紵 榛樿鍊间负鈥滃亣鈥濄

No

false

3.0.17

High Availability and Clustering锛堥珮鍙敤鎬у拰绨囬泦锛

autoReconnect

椹卞姩绋嬪簭鏄惁搴斿皾璇曞啀娆″缓绔嬪け鏁堢殑鍜岋紡鎴栨杩炴帴锛 濡傛灉鍏佽锛屽浜庡湪澶辨晥鎴栨杩炴帴涓婂彂鍑虹殑鏌ヨ锛堝睘浜庡綋鍓嶄簨鍔★級锛岄┍鍔ㄧ▼搴忓皢鎶涘嚭寮傚父锛屼絾鍦ㄦ柊浜嬪姟鐨勮繛鎺ヤ笂鍙戝嚭涓嬩竴涓煡璇㈡椂锛屽皢灏濊瘯鍐嶈繛鎺ャ備笉鎺ㄨ崘浣跨敤璇ョ壒鎬э紝杩欐槸鍥犱负锛屽綋搴旂敤绋嬪簭涓嶈兘鎭板綋澶勭悊SQLExceptions鏃讹紝瀹冧細閫犳垚涓庝細璇濈姸鎬佸拰鏁版嵁涓鑷存ф湁鍏崇殑鍓綔鐢紝璁捐瀹冪殑鐩殑浠呯敤浜庝笅杩版儏鍐碉紝鍗筹紝褰撲綘鏃犳硶閰嶇疆搴旂敤绋嬪簭鏉ユ伆褰撳鐞嗗洜姝昏繛鎺ュ拰锛忔垨鏃犳晥杩炴帴瀵艰嚧鐨凷QLExceptions鏃躲備綔涓哄彲閫夋柟寮忥紝鍙皢MySQL鏈嶅姟鍣ㄥ彉閲忊渨ait_timeout鈥濊缃负杈冮珮鐨勫硷紝鑰屼笉鏄粯璁ょ殑8灏忔椂銆

No

false

1.1

autoReconnectForPools

浣跨敤閫傚悎浜庤繛鎺ユ睜鐨勫啀杩炴帴绛栫暐锛堥粯璁ゅ间负鈥滃亣鈥濓級銆

No

false

3.1.3

failOverReadOnly

鍦╝utoReconnect妯″紡涓嬪嚭鐜版晠闅滃垏鎹㈡椂锛屾槸鍚﹀簲灏嗚繛鎺ヨ缃负鈥滃彧璇烩濓紵

No

true

3.0.12

reconnectAtTxEnd

濡傛灉灏哸utoReconnect璁剧疆涓衡滅湡鈥濓紝鍦ㄦ瘡娆′簨鍔$粨鏉熷悗椹卞姩绋嬪簭鏄惁搴斿皾璇曞啀杩炴帴锛

No

false

3.0.10

roundRobinLoadBalance

鍚敤浜哸utoReconnect鑰屼笖failoverReadonly涓衡滃亣鈥濇椂锛屾槸鍚﹀簲鎸夌収寰幆鏂瑰紡鎸戦夎杩炴帴鐨勪富鏈猴紵

No

false

3.1.2

queriesBeforeRetryMaster

鍑虹幇鏁呴殰鍒囨崲锛堜娇鐢ㄥ涓绘満鏁呴殰鍒囨崲锛夊苟杩斿洖涓绘満涔嬪墠鍙戝嚭鐨勬煡璇㈡暟銆傛棤璁洪鍏堟弧瓒充簡鍝釜鏉′欢锛屸渜ueriesBeforeRetryMaster鈥濇垨鈥渟econdsBeforeRetryMaster鈥濓紝鍧囦細鍐嶆涓庝富鏈鸿繘琛岃繛鎺ャ傞粯璁ゅ间负鈥50鈥濄

No

50

3.0.2

secondsBeforeRetryMaster

鍑虹幇鏁呴殰鍒囨崲鍚庯紝鍦ㄥ皾璇曞啀娆¤繛鎺ュ埌涓绘湇鍔″櫒涔嬪墠锛岄┍鍔ㄧ▼搴忓簲绛夊緟鐨勬椂闂达紵 鏃犺棣栧厛婊¤冻浜嗗摢涓潯浠讹紝鈥渜ueriesBeforeRetryMaster鈥濇垨鈥渟econdsBeforeRetryMaster鈥濓紝鍧囦細鍐嶆涓庝富鏈鸿繘琛岃繛鎺ャ傚崟浣嶄负绉掞紝榛樿鍊间负30銆

No

30

3.0.2

enableDeprecatedAutoreconnect

鑷3.2鐗堝紑濮嬶紝鑷姩鍐嶈繛鎺ュ姛鑳藉彈鍒板喎钀斤紝鍦3.3鐗堜腑灏嗗垹闄よ鍔熻兘銆傚皢璇ュ睘鎬ц缃负鈥滅湡鈥濆彲绂佹妫鏌ラ厤缃殑鐗规с

No

false

3.2.1

Security锛堝畨鍏級

allowMultiQueries

鍦ㄤ竴鏉¤鍙ヤ腑锛屽厑璁镐娇鐢ㄢ;鈥濇潵鍒嗛殧澶氭潯鏌ヨ锛堢湡锛忓亣锛岄粯璁ゅ间负鈥滃亣鈥濓級銆

No

false

3.1.1

useSSL

涓庢湇鍔″櫒杩涜閫氫俊鏃朵娇鐢⊿SL锛堢湡锛忓亣锛夛紝榛樿鍊间负鈥滃亣鈥濄

No

false

3.0.2

requireSSL

瑕佹眰SSL杩炴帴锛寀seSSL=true锛 榛樿鍊间负鈥滃亣鈥濄

No

false

3.1.0

allowUrlInLocalInfile

椹卞姩绋嬪簭鍦ㄦ槸鈥淟OAD DATA LOCAL INFILE鈥濊鍙ヤ腑鍚﹀厑璁窾RL锛

No

false

3.1.4

paranoid

閲囧彇鎺柦锛岄槻姝㈠湪閿欒淇℃伅涓硠婕忔晱鎰熶俊鎭紝骞跺彲鍙兘鏃舵竻闄や繚瀛樻晱鎰熸暟鎹殑鏁版嵁缁撴瀯锛 榛樿鍊间负鈥滃亣鈥濄

No

false

3.0.1

Performance Extensions锛堟ц兘鎵╁睍锛

metadataCacheSize

濡傛灉灏哻acheResultSetMetaData璁剧疆涓衡滅湡鈥濓紝瀵筩acheResultSetMetadata鐨勬煡璇㈡鏁帮紙榛樿鍊间负50锛夈

No

50

3.1.1

prepStmtCacheSize

濡傛灉鍏佽棰勫鐞嗚鍙ョ紦鍐插姛鑳斤紝搴旂紦鍐插鐞嗗灏戞潯棰勫鐞嗚鍙ワ紵

No

25

3.0.10

prepStmtCacheSqlLimit

濡傛灉鍏佽棰勫鐞嗚鍙ョ紦鍐插姛鑳斤紝椹卞姩绋嬪簭灏嗘墽琛岃В鏋愮紦鍐插鐞嗙殑鏈澶QL鏄粈涔堬紵

No

256

3.0.10

maintainTimeStats

椹卞姩绋嬪簭鏄惁搴旂淮鎸佸悇绉嶅唴閮ㄥ畾鏃跺櫒锛屼互鍏佽绌洪棽鏃堕棿璁$畻锛屼互鍙婁笌鏈嶅姟鍣ㄧ殑杩炴帴澶辫触鏃跺厑璁告彁渚涙洿璇︾粏鐨勯敊璇秷鎭紵 灏嗚灞炴ц缃负鈥滃亣鈥濓紝瀵逛簬姣忔鏌ヨ锛岃嚦灏戣兘鍑忓皯涓ゆ瀵筍ystem.getCurrentTimeMillis()鐨勮皟鐢ㄣ

No

true

3.1.9

blobSendChunkSize

缁勫潡锛屽綋閫氳繃ServerPreparedStatements鍙戦丅LOB/CLOB鏃朵娇鐢ㄣ

No

1048576

3.1.9

cacheCallableStmts

椹卞姩绋嬪簭鏄惁搴斿CallableStatements鐨勮В鏋愯繃绋嬫墽琛岀紦鍐插鐞嗐

No

false

3.1.2

cachePrepStmts

椹卞姩绋嬪簭鏄惁搴斿瀹㈡埛绔澶勭悊璇彞鐨凱reparedStatements鐨勮В鏋愯繃绋嬫墽琛岀紦鍐插鐞嗭紝鏄惁搴旀鏌ユ湇鍔″櫒绔澶勭悊璇彞鐨勯傜敤鎬т互鍙婃湇鍔″櫒绔澶勭悊璇彞鏈韩锛

No

false

3.0.10

cacheResultSetMetadata

椹卞姩绋嬪簭鏄惁搴斿鐢ㄤ簬Statements鍜孭reparedStatements鐨凴esultSetMetaData鎵ц缂撳啿澶勭悊锛 瑕佹眰 JDK-1.4+锛岀湡锛忓亣锛岄粯璁や负鈥滃亣鈥濄

No

false

3.1.1

cacheServerConfiguration

椹卞姩绋嬪簭鏄惁搴旀牴鎹瘡鏉RL瀵光淗OW VARIABLES鈥濆拰鈥淪HOW COLLATION鈥濈殑缁撴灉鎵ц缂撳啿澶勭悊锛

No

false

3.1.5

dontTrackOpenResources

JDBC瑙勮寖瑕佹眰椹卞姩绋嬪簭鑷姩璺熻釜鍜屽叧闂祫婧愶紝浣嗘槸锛屽鏋滀綘鐨勫簲鐢ㄧ▼搴忎笉鑳芥槑纭皟鐢ㄤ綔鐢ㄥ湪璇彞鎴栫粨鏋滈泦涓婄殑close()锛屽彲鑳戒細瀵艰嚧鍐呭瓨娉勬紡銆傚皢璇ュ睘鎬ц缃负鈥滅湡鈥濓紝鍙斁瀹借闄愬埗锛屽浜庢煇浜涘簲鐢ㄧ▼搴忥紝浼氭彁渚涙洿楂樼殑鍐呭瓨鏁堢巼銆

No

false

3.1.7

dynamicCalendars

闇瑕佹椂锛岄┍鍔ㄧ▼搴忔槸鍚﹀簲妫绱㈤粯璁ゆ棩鍘嗭紝鎴栨牴鎹繛鎺ワ紡浼氳瘽瀵瑰叾杩涜缂撳啿澶勭悊锛

No

false

3.1.5

elideSetAutoCommits

濡傛灉浣跨敤MySQL-4.1鎴栨洿楂樼増鏈紝褰撴湇鍔″櫒鐨勭姸鎬佷笌Connection.setAutoCommit(boolean)璇锋眰鐨勭姸鎬佷笉鍖归厤鏃讹紝椹卞姩绋嬪簭鏄惁浠呭簲鍙戝嚭鈥渟et autocommit=n鈥濇煡璇紵

No

false

3.1.3

holdResultsOpenOverStatementClose

椹卞姩绋嬪簭鏄惁搴旀寜鐓DBC瑙勮寖鐨勮姹傚叧闂璖tatement.close()涓婄殑缁撴灉闆嗭紵

No

false

3.1.7

locatorFetchBufferSize

濡傛灉灏嗏渆mulateLocators鈥濋厤缃负鈥滅湡鈥濓紝褰撹幏鍙栧叧浜巊etBinaryInputStream鐨凚LOB鏁版嵁鏃讹紝缂撳啿鍖虹殑澶у皬搴旀槸澶氬皯锛

No

1048576

3.2.1

useFastIntParsing

鏄惁浣跨敤鍐呴儴鈥淪tring->Integer鈥濊浆鎹㈠瓙绋嬪簭鏉ラ伩鍏嶅垱寤鸿繃澶氬璞★紵

No

true

3.1.4

useLocalSessionState

椹卞姩绋嬪簭鏄惁搴斿紩鐢╝utocommit鐨勫唴閮ㄥ硷紝浠ュ強鐢盋onnection.setAutoCommit()鍜孋onnection.setTransactionIsolation()璁剧疆鐨勪簨鍔¢殧绂伙紝鑰屼笉鏄煡璇㈡暟鎹簱锛

No

false

3.1.7

useNewIO

椹卞姩绋嬪簭鏄惁搴斿皢java.nio.* interfaces鐢ㄤ簬缃戠粶閫氫俊锛堢湡锛忓亣锛夛紝榛樿涓衡滃亣鈥濄

No

false

3.1.0

useReadAheadInput

浠庢湇鍔″櫒璇诲彇鏁版嵁鏃讹紝鏄惁浣跨敤杈冩柊鐨勩佷紭鍖栫殑闈炴垚缁勭紦鍐茶緭鍏ユ祦锛

No

true

3.1.5

Debuging/Profiling锛堣皟璇/浠垮舰锛

logger

瀹炵幇浜哻om.mysql.jdbc.log.Log鐨勭被鐨勫悕绉帮紝com.mysql.jdbc.log.Log鐢ㄤ簬璁板綍娑堟伅锛堥粯璁や负鈥渃om.mysql.jdbc.log.StandardLogger鈥濓紝瀹冧細灏嗘棩蹇楄褰曞埌STDERR锛夈

No

com.mysql.jdbc.log.StandardLogger

3.1.1

profileSQL

璺熻釜鏌ヨ浠ュ強瀹冧滑瀵瑰凡閰嶅埗璁板綍鍣ㄧ殑鎵ц/鑾峰彇娆℃暟锛堢湡锛忓亣锛夛紝榛樿涓衡滃亣鈥濄

No

false

3.1.0

reportMetricsIntervalMillis

濡傛灉鍏佽鈥済atherPerfMetrics鈥濓紝璁板綍瀹冧滑鐨勯鐜囨槸澶氬皯锛堝崟浣嶆绉掞級锛

No

30000

3.1.2

maxQuerySizeToLog

璋冭瘯鎴栦豢褰㈡椂锛屾帶鍒跺皢璁板綍鐨勬煡璇㈢殑鏈澶ч暱搴︼紡澶у皬銆

No

2048

3.1.3

packetDebugBufferSize

褰撯渆nablePacketDebug鈥濅负鈥滅湡鈥濇椂锛岄渶瑕佷繚鐣欑殑鏈澶т俊鎭寘鏁扮洰銆

No

20

3.1.3

slowQueryThresholdMillis

濡傛灉鍏佽鈥渓ogSlowQueries鈥濓紝鍦ㄥ皢鏌ヨ璁板綍涓衡滄參鈥濅箣鍓嶇殑鏌ヨ鏃堕棿鏄灏戯紙姣锛夛紵

No

2000

3.1.2

useUsageAdvisor

椹卞姩绋嬪簭鏄惁搴斿彂鍑衡滀娇鐢ㄦ儏鍐碘濊鍛婏紝灏盌BC鍜孧ySQL Connector/J鐨勬伆褰撳拰楂樻晥浣跨敤缁欏嚭寤鸿锛堢湡锛忓亣锛岄粯璁や负鈥滃亣鈥濓級锛

No

false

3.1.1

autoGenerateTestcaseScript

椹卞姩绋嬪簭鏄惁搴斿皢姝e湪鎵ц鐨凷QL锛堝寘鎷湇鍔″櫒绔澶勭悊璇彞锛夎浆鍌ㄥ埌STDERR锛

No

false

3.1.9

dumpQueriesOnException

椹卞姩绋嬪簭鏄惁搴斿皢鍙戦佽嚦鏈嶅姟鍣ㄧ殑鏌ヨ鍐呭杞偍鍒癝QLExceptions涓紵

No

false

3.1.3

enablePacketDebug

鍏佽鏃讹紝灏嗕繚鐣欌減acketDebugBufferSize鈥濅俊鎭寘鐨勭幆褰㈢紦鍐插尯锛屽苟褰撳湪椹卞姩绋嬪簭浠g爜鐨勫叧閿尯鍩熸姏鍑哄紓甯告椂杩涜杞偍銆

No

false

3.1.3

explainSlowQueries

濡傛灉鍏佽浜嗏渓ogSlowQueries鈥濓紝椹卞姩绋嬪簭鏄惁搴斿湪鏈嶅姟鍣ㄤ笂鑷姩鍙戝嚭鈥淓XPLAIN鈥濓紝骞朵互WARN绾у埆灏嗙粨鏋滃彂閫佺粰閰嶇疆濂界殑鏃ュ織锛

No

false

3.1.2

logSlowQueries

鏄惁瑕佽褰曟椂闂撮暱浜庘渟lowQueryThresholdMillis鈥濈殑鏌ヨ锛

No

false

3.1.2

traceProtocol

鏄惁搴旇褰曡窡韪骇缃戠粶鍗忚锛

No

false

3.1.2

Miscellaneous锛堝叾浠栵級

useUnicode

澶勭悊瀛楃涓叉椂锛岄┍鍔ㄧ▼搴忔槸鍚﹀簲浣跨敤Unicode瀛楃缂栫爜锛 浠呭簲鍦ㄩ┍鍔ㄧ▼搴忔棤娉曠‘瀹氬瓧绗﹂泦鏄犲皠锛屾垨浣犳鍦ㄥ己鍒堕┍鍔ㄧ▼搴忎娇鐢∕ySQL涓嶆槸鍥烘湁鏀寔鐨勫瓧绗﹂泦鏃讹紙濡俇TF-8锛夋墠搴斾娇鐢ㄣ傜湡锛忓亣锛岄粯璁や负鈥滅湡鈥濄

No

false

1.1g

characterEncoding

濡傛灉鈥渦seUnicode鈥濊璁剧疆涓衡滅湡鈥濓紝澶勭悊瀛楃涓叉椂锛岄┍鍔ㄧ▼搴忓簲浣跨敤浠涔堝瓧绗︾紪鐮侊紵 榛樿涓衡渁utodetect鈥濄

No

 

1.1g

characterSetResults

瀛楃闆嗭紝鐢ㄤ簬閫氱煡鏈嶅姟鍣ㄤ互浣曠瀛楃闆嗚繑鍥炵粨鏋溿

No

 

3.0.13

connectionCollation

濡傛灉璁剧疆浜嗗畠锛屽皢閫氱煡鏈嶅姟鍣ㄩ氳繃鈥渟et collation_connection鈥濅娇鐢ㄨ鏍″銆

No

 

3.0.13

sessionVariables

浠ラ楀彿闅斿紑鐨勨滃悕绉帮紡鍊尖濆鍒楄〃锛屽綋椹卞姩绋嬪簭寤虹珛浜嗚繛鎺ュ悗锛屼互鈥淪ET SESSION ...鈥濈殑鏂瑰紡灏嗗叾鍙戦佺粰鏈嶅姟鍣ㄣ

No

 

3.1.8

allowNanAndInf

椹卞姩绋嬪簭鏄惁搴斿湪PreparedStatement.setDouble()涓厑璁窷aN鎴+/- INF鍊硷紵

No

false

3.1.5

autoDeserialize

椹卞姩绋嬪簭鏄惁搴旇嚜鍔ㄦ娴嬪苟涓插苟杞崲淇濆瓨鍦˙LOB瀛楁涓殑瀵硅薄锛

No

false

3.1.5

capitalizeTypeNames

鏄惁灏咲atabaseMetaData涓殑绫诲瀷鍚嶈浆鎹负澶у啓锛 閫氬父浠呭湪浣跨敤WebObjects鏃舵湁鐢紝鐪燂紡鍋囥傞粯璁や负鈥滃亣鈥濄

No

false

2.0.7

clobberStreamingResults

杩欎細浣库滄祦寮忊濈粨鏋滈泦琚嚜鍔ㄥ叧闂紝濡傛灉鍦ㄦ墍鏈夋暟鎹皻鏈粠鏈嶅姟鍣ㄤ腑璇诲彇瀹屼箣鍓嶏紝鎵ц浜嗗彟涓鏌ヨ锛屾鍦ㄤ粠鏈嶅姟鍣ㄦ祦鍑虹殑浠讳綍鏈畬鎴愭暟鎹潎灏嗕涪澶便

No

false

3.0.9

continueBatchOnError

濡傛灉涓鏉¤鍙ュけ璐ワ紝椹卞姩绋嬪簭鏄惁搴旂户缁鐞嗘壒鍛戒护锛 JDBC瑙勮寖鍏佽浠讳綍涓绉嶆柟寮忥紙榛樿涓衡滅湡鈥濓級銆

No

true

3.0.3

createDatabaseIfNotExist

濡傛灉涓嶅瓨鍦紝鍒涘缓URL涓粰瀹氱殑鏁版嵁搴撱傚亣瀹氱敤鎴峰叿鏈夊垱寤烘暟鎹簱鐨勬潈闄愩

No

false

3.1.9

emptyStringsConvertToZero

椹卞姩绋嬪簭鏄惁搴斿厑璁镐粠绌哄瓧绗︿覆瀛楁鍒版暟鍊尖0鈥濈殑杞崲锛

No

true

3.1.8

emulateLocators

N/A

No

false

3.1.0

emulateUnsupportedPstmts

椹卞姩绋嬪簭鏄惁搴旀娴嬩笉琚湇鍔″櫒鏀寔鐨勯澶勭悊璇彞锛屽苟鐢ㄥ鎴风妯℃嫙鐗堟浛鎹㈠畠浠紵

No

true

3.1.7

ignoreNonTxTables

鏄惁蹇界暐鍏充簬鍥為鐨勯潪浜嬪姟琛紵 榛樿鍊间负鈥滃亣鈥濄

No

false

3.0.9

jdbcCompliantTruncation

杩炴帴鍒版敮鎸佸憡璀︾殑鏈嶅姟鍣ㄦ椂锛圡ySQL 4.1.0鍜屾洿楂樼増鏈級锛屽綋鎸夌収JDBC鐨勮姹傛埅鐭暟鎹椂锛岄┍鍔ㄧ▼搴忔槸鍚﹀簲鎶涘嚭java.sql.DataTruncation寮傚父锛

No

true

3.1.2

maxRows

杩斿洖鐨勬渶澶ц鏁帮紙0锛岄粯璁ゅ艰〃绀鸿繑鍥炴墍鏈夎锛夈

No

-1

all versions

noDatetimeStringSync

涓嶄繚璇丷esultSet.getDatetimeType().toString().equals(ResultSet.getString()銆

No

false

3.1.7

nullCatalogMeansCurrent

褰揇atabaseMetadataMethods璇锋眰鈥滅洰褰曗濆弬鏁版椂锛屽尖淣ull鈥濇槸鍚︽剰鍛崇潃浣跨敤褰撳墠鐩綍锛 瀹冧笉鍏煎JDBC锛屼絾绗﹀悎椹卞姩绋嬪簭鏃╂湡鐗堟湰鐨勪紶缁熻涓恒

No

true

3.1.8

nullNamePatternMatchesAll

鎺ュ彈*pattern鍙傛暟鐨凞atabaseMetaData鏂规硶鏄惁搴斿皢null鎸夊寰呪滐紖鈥濈殑鐩稿悓鏂瑰紡澶勭悊锛堜笉鍏煎JDBC锛屼絾椹卞姩绋嬪簭鐨勬棭鏈熺増鏈兘鎺ュ彈涓庤鑼冪殑杩欑被鍋忕锛夈

No

true

3.1.8

pedantic

涓ユ牸閬靛畧JDBC瑙勮寖銆

No

false

3.0.0

relaxAutoCommit

濡傛灉椹卞姩绋嬪簭鎵杩炴帴鐨凪ySQL鏈嶅姟鍣ㄧ殑鐗堟湰涓嶆敮鎸佷簨鍔★紝浠嶅厑璁歌皟鐢╟ommit()銆乺ollback()鍜宻etAutoCommit()锛熺湡锛忓亣锛岄粯璁や负鈥滃亣鈥濄

No

false

2.0.13

retainStatementAfterResultSetClose

璋冪敤ResultSet.close()鍚庯紝椹卞姩绋嬪簭鏄惁搴斿皢璇彞寮曠敤淇濆瓨鍦ㄧ粨鏋滈泦涓紵 鍦↗DBC-4.0鍚庯紝涓嶫DBC涓嶅吋瀹广

No

false

3.1.11

rollbackOnPooledClose

褰撹繛鎺ユ睜涓殑閫昏緫杩炴帴鍏抽棴鏃讹紝椹卞姩绋嬪簭鏄惁搴斿彂鍑簉ollback()锛

No

true

3.0.15

runningCTS13

鍏佽鍦⊿un涓嶫DBC鍏煎鐨則estsuite 1.3鐗堜腑澶勭悊缂洪櫡銆

No

false

3.1.7

serverTimezone

瑕嗙洊鏃跺尯鐨勬娴/鏄犲皠銆傚綋鏈嶅姟鍣ㄧ殑鏃跺尯涓烘槧灏勫埌Java鏃跺尯鏃朵娇鐢ㄣ

No

 

3.0.2

strictFloatingPoint

浠呭湪鍏煎鎬ф祴璇曠殑鏃╂湡鐗堟湰涓娇鐢ㄣ

No

false

3.0.0

strictUpdates

椹卞姩绋嬪簭鏄惁搴斿鍙洿鏂扮粨鏋滈泦杩涜涓ユ牸妫鏌ワ紙閫夋嫨鎵鏈夌殑涓婚敭锛夛紵鐪燂紡鍋囷紝榛樿涓衡滅湡鈥濄

No

true

3.0.4

tinyInt1isBit

椹卞姩绋嬪簭鏄惁搴斿皢鏁版嵁绫诲瀷TINYINT(1)褰撲綔BIT绫诲瀷瀵瑰緟锛熷垱寤鸿〃鏃讹紝鏈嶅姟鍣ㄤ細鎵цBIT -> TINYINT(1)鎿嶄綔銆

No

true

3.0.16

transformedBitIsBoolean

濡傛灉椹卞姩绋嬪簭灏員INYINT(1)杞崲涓轰笉鍚岀殑绫诲瀷锛屼负浜嗕笌MySQL-5.0鍏煎锛岄┍鍔ㄧ▼搴忔槸鍚﹀簲浣跨敤BOOLEAN鍙栦唬BIT锛熻繖鏄洜涓篗ySQL-5.0鍏锋湁BIT绫诲瀷銆

No

false

3.1.9

ultraDevHack

鐢变簬UltraDev宸叉崯鍧忥紝骞朵负鎵鏈夎鍙ュ彂鍑轰簡prepareCall()锛岄渶瑕佹椂锛屾槸鍚﹁涓簆repareCall()鍒涘缓PreparedStatements?

鐪燂紡鍋囷紝榛樿鍊间负鈥滃亣鈥濄

No

false

2.0.3

useHostsInPrivileges

鍦―atabaseMetaData.getColumn/TablePrivileges()涓负鐢ㄦ埛娣诲姞鈥淍hostname鈥濄傜湡锛忓亣锛岄粯璁や负鈥滅湡鈥濄

No

true

3.0.2

useOldUTF8Behavior

涓4.0鍜屾洿鏃╃増鏈殑鏈嶅姟鍣ㄨ繘琛岄氫俊鏃讹紝浣跨敤UTF-8銆

No

false

3.1.6

useOnlyServerErrorMessages

瀵规湇鍔″櫒杩斿洖鐨勯敊璇秷鎭紝涓嶄簨鍏堣瀹氣滄爣鍑嗙殑鈥漇QLState閿欒娑堟伅銆

No

true

3.0.15

useServerPrepStmts

濡傛灉鏈嶅姟鍣ㄦ敮鎸侊紝鏄惁浣跨敤鏈嶅姟鍣ㄧ棰勫鐞嗚鍙ワ紵 榛樿鍊间负鈥滅湡鈥濄

No

true

3.1.0

useSqlStateCodes

浣跨敤SQL鏍囧噯鐘舵佺爜鍙栦唬鈥滀紶缁熺殑鈥漍/Open/SQL鐘舵佺爜锛岀湡锛忓亣锛岄粯璁や负鈥滅湡鈥濄

No

true

3.1.3

useStreamLengthsInPrepStmts

鏄惁閲囩敤PreparedStatement/ResultSet.setXXXStream()鏂规硶璋冪敤涓殑娴侀暱搴﹀弬鏁帮紵鐪燂紡鍋囷紝榛樿涓衡滅湡鈥濄

No

true

3.0.2

useTimezone

鏄惁鍦ㄥ鎴风鍜屾湇鍔″櫒鏃跺尯闂磋浆鎹㈡椂闂达紡鏃ユ湡绫诲瀷锛堢湡锛忓亣锛岄粯璁や负鈥滃亣鈥濓級锛

No

false

3.0.2

useUnbufferedInput

涓嶄娇鐢˙ufferedInputStream鏉ヤ粠鏈嶅姟鍣ㄨ鍙栨暟鎹

No

true

3.0.11

yearIsDateType

JDBC椹卞姩绋嬪簭鏄惁搴斿皢MySQL绫诲瀷鈥淵EAR鈥濆綋浣渏ava.sql.Date鎴朣HORT瀵瑰緟锛

No

true

3.1.9

zeroDateTimeBehavior

褰撻┍鍔ㄧ▼搴忛亣鍒板叏鐢0缁勬垚鐨凞ATETIME鍊兼椂锛屽簲鍑虹幇浠涔堬紵MySQL浣跨敤瀹冩潵琛ㄧず鏃犳晥鏃ユ湡銆傛湁鏁堝兼槸鈥渆xception鈥濄佲渞ound鈥濆拰鈥渃onvertToNull鈥濄

No

exception

3.1.4

閫氳繃鈥渟ocketFactory鈥濆睘鎬э紝浣跨敤NamedPipeSocketFactory锛屽湪Windows NT/2000/XP骞冲彴涓婏紝閫氳繃鍛藉悕绠¢亾锛孋onnector/J涔熸敮鎸佸MySQL鐨勮闂傚鏋滀笉浣跨敤namedPipePath灞炴э紝灏嗕娇鐢\\.\pipe\MySQL鐨勯粯璁ゅ笺傚鏋滀娇鐢∟amedPipeSocketFactory锛屽皢蹇界暐JDBC url涓殑涓绘満鍚嶅拰绔彛鍙枫

鍦║RL涓坊鍔犱笅杩板睘鎬у彲鍚敤NamedPipeSocketFactory

 

socketFactory=com.mysql.jdbc.NamedPipeSocketFactory

鍛藉悕绠¢亾浠呰兘褰撹繛鎺ュ埌浣嶄簬鐩稿悓鐗╃悊鏈哄櫒涓婄殑MySQL鏃舵墠鑳芥甯稿伐浣滐紝璇ユ満鍣ㄤ笂搴斾娇鐢ㄤ簡JDBC椹卞姩绋嬪簭銆傚湪绠鍗曠殑鎬ц兘娴嬭瘯涓紝鍛藉悕绠¢亾鐨勮闂熷害姣旀爣鍑嗙殑TCP/IP璁块棶鍧30锝50锛呫

浣跨敤com.mysql.jdbc.NamedPipeSocketFactorycom.mysql.jdbc.StandardSocketFactory涓殑绀轰緥浠g爜锛屽彲鍒涘缓浣犺嚜宸辩殑濂楁帴瀛椾唬鐞嗐

26.3.3.2. JDBC API瀹炴柦璇存槑

MySQL Connector/J閫氳繃浜哠un JDBC鍏煎娴嬭瘯濂椾欢鍏叡鐗堜腑鐨勬墍鏈夋祴璇曘備絾鏄紝鍦ㄥ緢澶氬満鍚堜笅锛屽浜庡簲濡備綍瀹炴柦鐗瑰畾鐨勫姛鑳斤紝JDBC瑙勮寖骞舵湭缁欏嚭鏄庣‘鐨勮瀹氾紝鎴栬呰锛岃瑙勮寖鍏佽鏈変竴瀹氱殑瀹炴柦鑼冨洿銆

鍦ㄦ湰鑺備腑锛屽氨鐗瑰畾瀹炴柦鏂规灏嗗浣曞奖鍝峂ySQL Connector/J鐨勪娇鐢ㄦ柟寮忥紝缁欏嚭浜嗘帴鍙e眰闈笂鐨勮缁嗕粙缁嶃

         Blob

Blob瀹炴柦涓嶅厑璁糕滃師鍦扳濊皟鏁达紙瀹冧滑鏄滃壇鏈濓紝姝eDatabaseMetaData.locatorsUpdateCopies()鏂规硶鎵鎸囨槑鐨勯偅鏍凤級銆傚洜姝わ紝搴斾娇鐢ㄥ搴旂殑PreparedStatement.setBlob()鎴朢esultSet.updateBlob()锛堝浜庡彲鏇存柊缁撴灉闆嗭級鏂规硶锛屽皢鍙樺寲淇濆瓨鍒版暟鎹簱涓

鑷狢onnector/J version 3.1.0寮濮嬶紝閫氳繃鍦↗DBC URL涓坊鍔犲睘鎬р渆mulateLocators=true鈥濓紝鑳藉浣跨敤瀹氫綅鍣ㄦā鎷烞lob銆傞殢鍚庯紝蹇呴』浣跨敤甯︽湁鍒楀肩殑鍒楀埆鍚嶏紝鍦ㄤ綘缂栧啓鐨勭敤浜庢绱lob鐨凷ELECT涓紝灏嗗垪鍊艰涓築lob鍒楃殑涓栫邯鍚嶇О銆係ELECT杩樺繀椤讳粎寮曠敤1涓〃锛岃琛ㄥ繀椤绘湁1涓富閿紝鑰屼笖SELECT蹇呴』娑电洊鏋勬垚涓婚敭鐨勬墍鏈夊垪銆傞殢鍚庯紝椹卞姩绋嬪簭灏嗗欢鏈熷姞杞藉疄闄呯殑Blob鏁版嵁锛岀洿鑷虫绱簡Blob骞跺湪鍏朵笂璋冪敤浜嗘绱㈡柟娉曚负姝紙getInputStream(), getBytes(),绛夛級銆

         CallableStatement

鑷狢onnector/J 3.1.1寮濮嬶紝褰撻氳繃CallableStatement鎺ュ彛杩炴帴鍒癕ySQL 5.0鎴栨洿楂樼増鏈椂锛屽彲鏀寔瀛樺偍绋嬪簭銆鐩墠锛屼笉鏀寔CallableStatement鐨刧etParameterMetaData()鏂规硶銆

         Clob

Clob瀹炴柦涓嶅厑璁糕滃師鍦扳濊皟鏁达紙瀹冧滑鏄滃壇鏈濓紝姝eDatabaseMetaData.locatorsUpdateCopies()鏂规硶鎵鎸囨槑鐨勯偅鏍凤級銆傚洜姝わ紝搴斾娇鐢≒reparedStatement.setClob()鏂规硶灏嗗彉鏇翠繚瀛樺埌鏁版嵁搴撲腑銆侸DBC API娌℃湁ResultSet.updateClob()鏂规硶銆

         Connection

涓嶮M.MySQL鐨勬棭鏈熺増鏈笉鍚岋紝鈥渋sClosed()鈥濅笉浼氬鏈嶅姟鍣ㄥ嵆琛孭ing鎿嶄綔浠ョ‘瀹氭湇鍔″櫒鏄惁鏈夋晥銆傛寜鐓DBC瑙勮寖锛屽鏋滃湪杩炴帴涓婅皟鐢ㄤ簡鈥渃losed()鈥濓紝瀹冧粎杩斿洖鈥滅湡鈥濄傚鏋滈渶瑕佺‘瀹氳繛鎺ユ槸鍚︿緷鐒舵湁鏁堬紝搴斿彂鍑虹畝鍗曟煡璇紝濡傗淪ELECT 1鈥濄傚鏋滆繛鎺ヤ笉鍐嶆湁鏁堬紝椹卞姩绋嬪簭灏嗘姏鍑哄紓甯搞

         DatabaseMetaData

瀵逛簬澶栭敭淇℃伅锛坓etImported/ExportedKeys()鍜実etCrossReference()锛夛紝浠呭湪鈥淚nnoDB鈥濈被鎬х殑琛ㄤ腑鍙敤銆備絾鏄紝椹卞姩绋嬪簭浼氫娇鐢ㄢ淪HOW CREATE TABLE鈥濇潵妫绱㈣淇℃伅锛屽洜姝わ紝褰撳叾浠栬〃绫诲瀷鏀寔澶栭敭鏃讹紝椹卞姩绋嬪簭涔熻兘鏀寔瀹冧滑銆

         Driver

         PreparedStatement

PreparedStatements鏄敱椹卞姩绋嬪簭瀹炵幇鐨勶紝杩欐槸搴斾负MySQL鏈彁渚涢澶勭悊璇彞鍔熻兘銆傚嚭浜庤鍘熷洜锛岄┍鍔ㄧ▼搴忎笉瀹炴柦getParameterMetaData()鎴杇etMetaData()锛岃繖鏄洜涓猴紝瀹冭姹傞┍鍔ㄧ▼搴忓湪瀹㈡埛绔笂鍏锋湁瀹屾暣鐨凷QL璇硶鍒嗘瀽绋嬪簭銆

浠3.1.0鐗圡ySQL Connector/J寮濮嬶紝褰撴湇鍔″櫒鏀寔鏃讹紝灏嗕娇鐢ㄦ湇鍔″櫒绔澶勭悊璇彞鍜屸滀簩杩涘埗缂栫爜鈥濈殑缁撴灉闆嗐

浣跨敤甯︽湁鈥渓arge鈥濆弬鏁帮紙杩欑被鍙傛暟鏄氳繃setBinaryStream()銆乻etAsciiStream()銆乻etUnicodeStream()銆乻etBlob()鎴杝etClob()璁剧疆鐨勶級鐨勬湇鍔″櫒绔澶勭悊璇彞鏃跺簲璋ㄦ厧銆傚鏋滄墦绠楀啀娆℃墽琛屽凡灏嗕换浣曗渓arge鈥濆弬鏁版洿鏀逛负闈炩渓arge鈥濆弬鏁扮殑璇彞锛岄渶瑕佽皟鐢╟learParameters()锛屽苟鍐嶆璁剧疆鎵鏈夊弬鏁般傚叾鍘熷洜濡備笅锛

o        璁剧疆浜嗗弬鏁版椂锛岄┍鍔ㄧ▼搴忎細灏嗏渓arge鈥濇暟鎹渙ut-of-band鈥濆彂閫佺粰鏈嶅姟鍣ㄧ鐨勯澶勭悊璇彞锛堟墽琛岄澶勭悊璇彞涔嬪墠锛夈

o        涓鏃﹀畬鎴愶紝灏嗗叧闂敤浜庤鍙栧鎴风涓婃暟鎹殑娴侊紙鏍规嵁JDBC瑙勮寖锛夛紝鑰屼笖涓嶈兘鍐嶆璇诲彇娴併

o        濡傛灉鍙傛暟浠庘渓arge鈥濆彉涓洪潪鈥渓arge鈥濓紝椹卞姩绋嬪簭蹇呴』澶嶄綅棰勫鐞嗚鍙ョ殑鏈嶅姟鍣ㄧ鐘舵侊紝浠ヤ究鍏佽宸叉洿鏀圭殑鍙傛暟鍖哄甫浠ュ墠鐨勨渓arge鈥濆笺傝繖灏嗗垹闄ゅ凡鍙戦佺粰鏈嶅姟鍣ㄧ殑鎵鏈夆渓arge鈥濇暟鎹紝鍥犺岄渶瑕侀氳繃setBinaryStream()銆乻etAsciiStream()銆乻etUnicodeStream()銆乻etBlob()鎴杝etClob()鏂规硶鍐嶆鍙戦佹暟鎹

鍥犺岋紝濡傛灉浣犳墦绠楀皢鍙傛暟绫诲瀷鏇存敼涓洪潪鈥渓arge鈥濈被鍨嬶紝蹇呴』璋冪敤clearParameters()锛屽苟鍦ㄩ噸鏂版墽琛岄澶勭悊璇彞涔嬪墠鍐嶆璁剧疆棰勫鐞嗚鍙ョ殑鎵鏈夊弬鏁般

         ResultSet

鍦ㄩ粯璁ゆ儏鍐典笅锛孯esultSets锛堢粨鏋滈泦锛夋槸鍙畬鍏ㄦ绱㈢殑锛屽苟琚繚瀛樺湪鍐呭瓨涓傚浜庡ぇ澶氭暟鎯呭喌锛岃繖鏄渶鏈夋晥鐨勬搷浣滄柟寮忥紝鑰屼笖杩樺簲褰掑洜浜庢洿瀹规槗瀹炴柦鐨凪ySQL缃戠粶鍗忚璁捐銆傚鏋滀綘姝e湪澶勭悊鍏锋湁澶ч噺琛屾垨澶ф暟鎹殑ResultSets锛岃屼笖鏃犳硶鍦↗VM鍐呬负鎵闇鍐呭瓨鍒嗛厤澶ч噺绌洪棿锛屽彲浠ラ氱煡椹卞姩绋嬪簭浠モ滄祦鈥濇柟寮忚繑鍥炵粨鏋滐紝涓娆′竴琛屻

瑕佹兂鍏佽璇ュ姛鑳斤紝闇瑕佷互涓嬭堪鏂瑰紡鍒涘缓1涓鍙ュ疄渚嬶細

stmt = conn.createStatement(java.sql.ResultSet.TYPE_FORWARD_ONLY,
              java.sql.ResultSet.CONCUR_READ_ONLY);
stmt.setFetchSize(Integer.MIN_VALUE);

姝e悜銆佸彧璇荤粨鏋滈泦锛屼互鍙奍nteger.MIN_VALUE鐨勭粍鍚堢敤浜庢寚绀洪┍鍔ㄧ▼搴忎互鈥滄祦鈥濇柟寮忔寜琛屽鐞嗙粨鏋滈泦銆傛鍚庯紝瀵逛簬璇ヨ鍙ュ垱寤虹殑缁撴灉闆嗭紝灏嗘寜琛屾绱€

瀵逛簬璇ユ柟寮忥紝鏈変竴浜涢渶娉ㄦ剰鐨勪簨椤广傝兘澶熷湪杩炴帴涓婂彂鍑轰换浣曞叾浠栨煡璇箣鍓嶏紝搴旇鍙栫粨鏋滈泦涓殑鎵鏈夎锛堟垨鍏抽棴缁撴灉闆嗭級锛屽惁鍒欏皢鎶涘嚭寮傚父銆

鑳藉閲婃斁杩欎簺閿佸畾璇彞锛堟棤璁哄畠浠槸MyISAM琛ㄧ骇閿佸畾锛岃繕鏄煇浜涘叾浠栧瓨鍌ㄥ紩鎿庡InnoDB涓殑琛岀骇閿佸畾锛夌殑鏈鏃╂椂鍒绘槸瀹屾垚璇彞鏃躲

濡傛灉璇彞鍦ㄤ簨鍔$殑鑼冨洿鍐咃紝褰撲簨鍔″畬鎴愬悗灏嗛噴鏀鹃攣瀹氾紙瀹冩剰鍛崇潃璇彞闇棣栧厛瀹屾垚锛夈備笌澶у鏁板叾浠栨暟鎹簱涓鏍凤紝鍦ㄨ鍙栦簡璇彞涓婃墍鏈夌殑鏈喅缁撴灉闆嗘垨鍏抽棴浜嗚鍙ョ殑娲诲姩缁撴灉闆嗕箣鍓嶏紝璇彞涓嶄細缁撴潫銆

鍥犳锛屽鏋滄鍦ㄤ娇鐢ㄢ滄祦寮忊濈粨鏋滐紝濡傛灉甯屾湜淇濇寔瀵圭壒瀹氳〃鐨勫悓鏃惰闂紝鑰岃繖浜涜〃琚敓鎴愮粨鏋滈泦鐨勮鍙ユ墍寮曠敤锛屽氨搴斿敖蹇湴澶勭悊鈥滄祦寮忊濈粨鏋溿

         ResultSetMetaData

浠呭綋浣跨敤MySQL鏈嶅姟鍣4.0鎴栨洿楂樼増鏈椂锛屸渋sAutoIncrement()鈥濇柟娉曟墠鑳芥纭伐浣溿

         Statement

浣跨敤鐗堟湰浣庝簬3.2.1鐨凧DBC椹卞姩绋嬪簭锛岃屼笖鎵杩炴帴鐨勬湇鍔″櫒鐗堟湰浣庝簬5.0.3鏃讹紝闄や簡鍍忓墠闈粙缁嶇殑閭f牱鍒囨崲缁撴灉闆嗗锛屸渟etFetchSize()鈥濇柟娉曚笉璧蜂綔鐢ㄣ

MySQL涓嶆敮鎸丼QL鍏夋爣锛岃屼笖JDBC椹卞姩绋嬪簭涔熶笉鑳芥ā鎷熷畠浠紝鍥犳鈥渟etCursorName()鈥濇病鏈夋晥鏋溿

26.3.3.3. Java锛孞DBC鍜孧ySQL绫诲瀷

MySQL Connector/J鍦ㄥ鐞哅ySQL鏁版嵁绫诲瀷鍜孞ava鏁版嵁绫诲瀷鐨勮浆鎹㈠鐞嗘柟闈㈠崄鍒嗙伒娲汇

灏界鍙兘浼氬嚭鐜拌垗鍏ャ佹孩鍑烘垨绮惧害鎹熷け锛屽綋鍦ㄩ氬父鎯呭喌涓嬶紝鑳藉灏嗕换浣昅ySQL鏁版嵁绫诲瀷杞崲涓簀ava.lang.String锛屽苟鑳藉皢浠讳綍鏁板肩被鍨嬭浆鎹负Java鏁板肩被鍨嬨

浠嶤onnector/J 3.1.0寮濮嬶紝鎸夌収JDBC瑙勮寖鐨勮姹傦紝JDBC椹卞姩绋嬪簭灏嗗彂鍑鸿鍛婃垨鎶涘嚭DataTruncation寮傚父锛岄櫎闈為氳繃浣跨敤鈥渏dbcCompliantTruncation鈥濆睘鎬у苟灏嗗叾璁句负鈥滃亣鈥濓紝瀵硅繛鎺ヨ繘琛岀浉搴旈厤缃彇娑堜簡鍓嶈堪瑕佹眰銆

鍦ㄤ笅闈㈢殑琛ㄦ牸涓紝鍒楀嚭鑳藉彲闈犲伐浣滅殑杞崲锛

琛26.2. 杞崲琛

涓嬭堪MySQL鏁版嵁绫诲瀷

鎬昏兘杞崲涓轰笅杩癑ava绫诲瀷

CHAR, VARCHAR, BLOB, TEXT, ENUM, and SET

java.lang.String, java.io.InputStream, java.io.Reader, java.sql.Blob, java.sql.Clob

FLOAT, REAL, DOUBLE PRECISION, NUMERIC, DECIMAL, TINYINT, SMALLINT, MEDIUMINT, INTEGER, BIGINT

java.lang.String, java.lang.Short, java.lang.Integer, java.lang.Long, java.lang.Double, java.math.BigDecimal

娉ㄩ噴锛

涓庡笇鏈涜浆鎹㈢殑MySQL鏁版嵁绫诲瀷鐩告瘮锛屽鏋滈夋嫨浜嗙簿搴﹁緝浣庣殑Java鏁板肩被鍨嬶紝鍙兘浼氬嚭鐜拌垗鍏ャ佹孩鍑烘垨绮惧害鎹熷け銆

DATE, TIME, DATETIME, TIMESTAMP

java.lang.String, java.sql.Date, java.sql.Timestamp

鍦∕ySQL绫诲瀷鍜孞ava绫诲瀷涔嬮棿锛孯esultSet.getObject()鏂规硶閲囩敤浜嗕笅杩扮被鍨嬭浆鎹㈡柟寮忥紝鍦ㄥ彲鑳界殑鎯呭喌涓嬮伒浠嶫DBC瑙勮寖锛

琛26.3. 鐢ㄤ簬ResultSet.getObject()鐨凪ySQL绫诲瀷鍜孞ava绫诲瀷

MySQL绫诲瀷鍚嶇О

Java绫昏繑鍥

BIT(1) (new in MySQL-5.0)

java.lang.Boolean

BIT( > 1) (new in MySQL-5.0)

byte[]

TINYINT

java.lang.Boolean锛屽鏋滃皢閰嶇疆灞炴tinyInt1isBit鈥濊涓衡滅湡鈥濓紙榛樿鍊硷級锛屽苟灏嗗瓨鍌ㄥぇ灏忚涓衡1鈥濓紱鎴java.lang.Integer锛屽鏋滀笉鏄殑璇濄

BOOL , BOOLEAN

璇峰弬瑙佷笂闈㈢殑TINYINT锛屽畠浠洰鍓嶆槸TINYINT(1)鐨勫埆鍚嶃

SMALLINT[(M)] [UNSIGNED]

java.lang.Integer锛堟棤璁烘槸鍚︿负UNSIGNED

MEDIUMINT[(M)] [UNSIGNED]

java.lang.Integer锛堟棤璁烘槸鍚︿负UNSIGNED

INT,INTEGER[(M)] [UNSIGNED]

java.lang.Integer锛屽鏋滄槸UNSIGNEDjava.lang.Long

BIGINT[(M)] [UNSIGNED]

java.lang.Long锛屽鏋滄槸UNSIGNEDjava.math.BigInteger

FLOAT[(M,D)]

java.lang.Float

DOUBLE[(M,B)]

java.lang.Double

DECIMAL[(M[,D])]

java.math.BigDecimal

DATE

java.sql.Date

DATETIME

java.sql.Timestamp

TIMESTAMP[(M)]

java.sql.Timestamp

TIME

java.sql.Time

YEAR[(2|4)]

java.sql.Date锛堟棩鏈熻涓21鏃ユ櫄涓2鐐癸級

CHAR(M)

java.lang.String锛堥櫎闈炲垪鐨勫瓧绗﹂泦鏄BINARY锛夛紝鐒跺悗杩斿洖瀛楄妭[]

VARCHAR(M) [BINARY]

java.lang.String锛堥櫎闈炲垪鐨勫瓧绗﹂泦鏄BINARY锛夛紝鐒跺悗杩斿洖瀛楄妭[]

BINARY(M)

byte[]

VARBINARY(M)

byte[]

TINYBLOB

byte[]

TINYTEXT

java.lang.String

BLOB

byte[]

TEXT

java.lang.String

MEDIUMBLOB

byte[]

MEDIUMTEXT

java.lang.String

LONGBLOB

byte[]

LONGTEXT

java.lang.String

ENUM('value1','value2',...)

java.lang.String

SET('value1','value2',...)

java.lang.String

26.3.3.4. 浣跨敤瀛楃闆嗗拰Unicode

瀵逛簬浠嶫DBC椹卞姩绋嬪簭鍙戝線鏈嶅姟鍣ㄧ殑鎵鏈夊瓧绗︿覆锛屽潎灏嗚嚜鍔ㄥ湴浠庡浐鏈夋斁鐑璊ava Unicode褰㈠紡杞崲涓哄鎴风瀛楃缂栫爜锛屽寘鎷氳繃Statement.execute()Statement.executeUpdate()鍜孲tatement.executeQuery()鍙戝嚭鐨勬墍鏈夋煡璇紝浠ュ強闄や簡鐢setBytes()銆乻etBinaryStream()setAsiiStream()setUnicodeStream()setBlob()鎺掗櫎鐨勫弬璇曚箣澶栫殑鎵鏈塒reparedStatementCallableStatement鍙傛暟

鍦∕ySQL鏈嶅姟鍣4.1涔嬪墠锛孋onnector/J鏀寔姣忚繛鎺ュ崟涓瀛楃缂栫爜锛岃兘澶熶粠鏈嶅姟鍣ㄩ厤缃嚜鍔ㄦ娴嬪埌瀹冿紝涔熻兘鐢辩敤鎴烽氳繃浣跨敤useUnicodecharacterEncoding灞炴ч厤缃畠銆

浠嶮ySQL鏈嶅姟鍣4.1鐗堣捣锛孋onnector/J鏀寔瀹㈡埛绔拰鏈嶅姟鍣ㄤ箣闂寸殑浣嗕互瀛楃缂栫爜锛屼互鍙婇拡瀵圭粨鏋滈泦涓粠鏈嶅姟鍣ㄨ繑鍥炶嚦瀹㈡埛绔殑鏁版嵁鐨勪换鎰忔暟鐩瓧绗︾紪鐮併

杩炴帴鏃跺皢鑷姩妫娴嬪鎴风鍜屾湇鍔″櫒涔嬮棿鐨勫瓧绗︾紪鐮併傚浜庣敱椹卞姩绋嬪簭浣跨敤鐨勭紪鐮佹潵璇达紝瀹冩槸鍦ㄦ湇鍔″櫒涓婇氳繃浣跨敤閰嶇疆鍙橀噺鈥character_set鈥濓紙浣庝簬4.1.0鐨勬湇鍔″櫒鐗堟湰锛夊拰鈥character_set_server鈥濓紙4.1.0鍜屾洿楂樼殑鏈嶅姟鍣ㄧ増鏈級鎸囧畾鐨勩傛洿澶氫俊鎭紝璇峰弬瑙丮ySQL鏈嶅姟鍣ㄦ墜鍐屼腑鐨鏈嶅姟鍣ㄥ瓧绗﹂泦鍜屾牎瀵涓鑺傘

瑕佹兂瑕嗙洊瀹㈡埛绔笂鐨勮嚜鍔ㄦ娴嬬紪鐮佸姛鑳斤紝鍙湪鐢ㄤ簬杩炴帴鍒版湇鍔″櫒鐨刄RL涓娇鐢ㄢcharacterEncoding鈥濆睘鎬с

鍦ㄥ鎴风涓婃寚瀹氬瓧绗︾紪鐮佹椂锛屽簲浣跨敤Java椋庢牸鍚嶇О銆傚湪涓嬮潰鐨勮〃鏍间腑锛屽垪鍑轰簡鐢ㄤ簬MySQL瀛楃闆嗙殑Java椋庢牸鍚嶇О锛

琛26.4. MySQL瀵笿ava缂栫爜鍚嶇О鐨勭炕璇

MySQL瀛楃闆嗗悕绉 Java椋庢牸瀛楃缂栫爜鍚嶇О
usa7US-ASCII
big5Big5
gbkGBK
sjisSJIS
gb2312EUC_CN
ujisEUC_JP
euc_krEUC_KR
latin1ISO8859_1
latin1_deISO8859_1
german1ISO8859_1
danishISO8859_1
latin2ISO8859_2
czechISO8859_2
hungarianISO8859_2
croatISO8859_2
greekISO8859_7
hebrewISO8859_8
latin5ISO8859_9
latvianISO8859_13
latvian1ISO8859_13
estoniaISO8859_13
dosCp437
pclatin2Cp852
cp866Cp866
koi8_ruKOI8_R
tis620TIS620
win1250Cp1250
win1250chCp1250
win1251Cp1251
cp1251Cp1251
win1251ukrCp1251
cp1257Cp1257
macromanMacRoman
macceMacCentralEurope
utf8UTF-8
ucs2UnicodeBig

璀﹀憡

涓嶈鐢–onnector/J鍙戝嚭鏌ヨ鈥渟et names鈥濓紝杩欐槸鍥犱负椹卞姩绋嬪簭涓嶄細妫娴嬪凡鍙樺寲鐨勫瓧绗﹂泦锛岃屾槸浼氱户缁娇鐢ㄥ湪鍒濆杩炴帴璁剧疆涓娴嬪埌鐨勫瓧绗﹂泦銆

涓轰簡鍏佽浠庡鎴风鍙戝嚭鐨勫涓瓧绗﹂泦锛屽簲浣跨敤鈥淯TF-8鈥濈紪鐮侊紝鏂瑰紡鏄紝灏唘tf8閰嶇疆涓洪粯璁ょ殑鏈嶅姟鍣ㄥ瓧绗﹂泦锛屾垨閫氳繃鈥characterEncoding鈥濆睘鎬ч厤缃甁DBC椹卞姩绋嬪簭浠ヤ娇鐢ㄢ淯TF-8鈥濄

26.3.3.5. 浣跨敤SSL杩涜瀹夊叏杩炴帴

MySQL Connector/J涓殑SSL鑳藉瀵笿DBC椹卞姩绋嬪簭鍜屾湇鍔″櫒涔嬮棿浼犺緭鐨勬墍鏈夋暟鎹繘琛屽姞瀵嗭紙闄や簡鍒濆鎻℃墜鏁版嵁锛夈傚惎鐢⊿SL浼氬鑷存ц兘鎹熷け锛屼綋鐜板湪鏌ヨ鏃堕棿灏嗗鍔35锝50锛咃紝鍏蜂綋鎯呭喌鍙栧喅浜庢煡璇㈢殑澶у皬浠ュ強杩斿洖鐨勬暟鎹噺銆

瑕佹兂浣縎SL鏀寔鑳藉宸ヤ綔锛屽繀椤绘弧瓒充笅杩拌姹傦細

         鍖呭惈JSSE锛圝ava瀹夊叏濂楁帴瀛楁墿灞曪級鐨凧DK锛屽JDK-1.4.1鎴栨洿楂樼増鏈係SL鐩墠涓嶈兘涓庤兘澶熶负鍏舵坊鍔燡SSE鐨凧DK涓璧峰伐浣滐紝濡侸DK-1.2.x鎴朖DK-1.3.x锛屽師鍥犲湪浜庝笅杩癑SSE缂洪櫡锛http://developer.java.sun.com/developer/bugParade/bugs/4273544.html

         鏀寔SSL骞跺凡缂栬瘧鍜岄厤缃簡璇ュ姛鑳界殑MySQL鏈嶅姟鍣紝濡侻ySQL-4.0.4鍜屾洿楂樼増鏈紝璇峰弬瑙侊細http://www.mysql.com/doc/en/Secure_connections.html

         瀹㈡埛绔瘉涔︼紙鍦ㄦ湰鑺傜◢鍚庝粙缁嶏級銆

棣栧厛锛岄渶瑕佸皢MySQL鏈嶅姟鍣–A璇佷功瀵煎叆鍒癑ava truststore銆傚湪MySQL婧愮爜鍒嗗彂鐗堢殑鈥淪SL鈥濆瓙鐩綍涓嬬粰鍑轰簡1涓ず渚婱ySQL鏈嶅姟鍣–A璇佷功銆係SL灏嗕娇鐢ㄥ畠鏉ョ‘瀹氭槸鍚︿笌瀹夊叏MySQL鏈嶅姟鍣ㄨ繘琛岄氫俊銆

瑕佹兂浣跨敤Java鐨勨渒eytool鈥濆湪褰撳墠鐩綍涓嬪垱寤簍ruststore锛屽苟瀵煎叆鏈嶅姟鍣ㄧ殑CA璇佷功锛堚渃acert.pem鈥濓級锛屽彲閲囧彇涓嬭堪鏂瑰紡锛堝亣瀹氣渒eytool鈥濅綅浜庤矾寰勪腑銆傚畠浣嶄簬JDK鎴朖RE鐨勨渂in鈥濆瓙鐩綍涓嬶級锛

shell> keytool -import -alias mysqlServerCACert -file cacert.pem -keystore truststore
        

Keytool灏嗙粰鍑轰笅杩板搷搴斾俊鎭細

Enter keystore password:  *********
Owner: EMAILADDRESS=walrus@example.com, CN=Walrus, O=MySQL AB, L=Orenburg, ST=Some
-State, C=RU
Issuer: EMAILADDRESS=walrus@example.com, CN=Walrus, O=MySQL AB, L=Orenburg, ST=Som
e-State, C=RU
Serial number: 0
Valid from: Fri Aug 02 16:55:53 CDT 2002 until: Sat Aug 02 16:55:53 CDT 2003
Certificate fingerprints:
         MD5:  61:91:A0:F2:03:07:61:7A:81:38:66:DA:19:C4:8D:AB
         SHA1: 25:77:41:05:D5:AD:99:8C:14:8C:CA:68:9C:2F:B8:89:C3:34:4D:6C
Trust this certificate? [no]:  yes
Certificate was added to keystore

闅忓悗锛岄渶瑕佺敓鎴愬鎴风璇佷功锛屼互渚縈ySQL鏈嶅姟鍣ㄧ煡閬撳畠姝d笌瀹夊叏瀹㈡埛绔繘琛岄氫俊锛

 shell> keytool -genkey -keyalg rsa -alias mysqlClientCertificate -keystore keystore 

Keytool灏嗙粰鍑轰笅杩版彁绀轰俊鎭紝骞跺湪褰撶洰褰曚笅鍒涘缓鍚嶄负鈥渒eystore鈥濈殑瀵嗛挜瀛樺偍鍣ㄣ

浣犲簲浣跨敤涓庡叿浣撴儏鍐电浉閫傚簲鐨勬柊浣滃嚭鍝嶅簲锛

Enter keystore password:  *********
What is your first and last name?
  [Unknown]:  Matthews
What is the name of your organizational unit?
  [Unknown]:  Software Development
What is the name of your organization?
  [Unknown]:  MySQL AB
What is the name of your City or Locality?
  [Unknown]:  Flossmoor
What is the name of your State or Province?
  [Unknown]:  IL
What is the two-letter country code for this unit?
  [Unknown]:  US
Is <CN=Matthews, OU=Software Development, O=MySQL AB,
 L=Flossmoor, ST=IL, C=US> correct?
  [no]:  y
 
杈撳叆<mysqlClientCertificate>鐨勫瘑鐮
        濡傛灉涓巏eystore鐨勫瘑鐮佺浉鍚岋紝鎸夊洖杞︼級锛

鏈鍚庯紝瑕佹兂浣縅SSE鑳藉浣跨敤浣犵敓鎴愮殑keystore鍜宼ruststore锛屽惎鍔↗VM鏃讹紝闇瑕佽缃笅杩扮郴缁熷睘鎬э紝鐢ㄤ綘鎵鍒涘缓鐨刱eystore鏂囦欢瀹屾暣璺緞鏇挎崲鈥減ath_to_keystore_file鈥濓紝鐢ㄤ綘鎵鍒涘缓鐨則ruststore鏂囦欢瀹屾暣璺緞鏇挎崲鈥減ath_to_truststore_file鈥濓紝骞朵负姣忎釜灞炴т娇鐢ㄦ伆褰撶殑瀵嗙爜鍊笺

-Djavax.net.ssl.keyStore=path_to_keystore_file
-Djavax.net.ssl.keyStorePassword=*********
-Djavax.net.ssl.trustStore=path_to_truststore_file
-Djavax.net.ssl.trustStorePassword=********* 

姝ゅ锛岃繕闇瑕佸湪鐢ㄤ簬MySQL Connector/J鐨勮繛鎺ュ弬鏁颁腑灏嗏渦seSSL鈥濊缃负鈥滅湡鈥濓紝鏂规硶鏄紝鍦║RL涓坊鍔犫渦seSSL=true鈥濓紝鎴栧湪鍑嗗浼犻掔粰DriverManager.getConnection()鐨刯ava.util.Properties瀹炰緥涓皢鈥渦seSSL鈥濊缃负鈥滅湡鈥濄

浣犲彲浠ユ墦寮JSSE璋冭瘯鍔熻兘鑳藉锛屾祴璇昐SL鏄惁宸ヤ綔锛堣鎯呭涓嬶級锛屽苟鏌ユ壘涓嬭堪鍏抽敭浜嬩欢锛

...
 *** ClientHello, v3.1
 RandomCookie:  GMT: 1018531834 bytes = { 199, 148, 180, 215, 74, 12, 54, 244, 0, 168, 55, 103, 215, 64, 16, 138, 225, 190, 132, 153, 2, 217, 219, 239, 202, 19, 121, 78 }
 Session ID:  {}
 Cipher Suites:  { 0, 5, 0, 4, 0, 9, 0, 10, 0, 18, 0, 19, 0, 3, 0, 17 }
 Compression Methods:  { 0 }
 ***
 [write] MD5 and SHA1 hashes:  len = 59
 0000: 01 00 00 37 03 01 3D B6   90 FA C7 94 B4 D7 4A 0C  ...7..=.......J.
 0010: 36 F4 00 A8 37 67 D7 40   10 8A E1 BE 84 99 02 D9  6...7g.@........
 0020: DB EF CA 13 79 4E 00 00   10 00 05 00 04 00 09 00  ....yN..........
 0030: 0A 00 12 00 13 00 03 00   11 01 00                 ...........
 main, WRITE:  SSL v3.1 Handshake, length = 59
 main, READ:  SSL v3.1 Handshake, length = 74
 *** ServerHello, v3.1
 RandomCookie:  GMT: 1018577560 bytes = { 116, 50, 4, 103, 25, 100, 58, 202, 79, 185, 178, 100, 215, 66, 254, 21, 83, 187, 190, 42, 170, 3, 132, 110, 82, 148, 160, 92 }
 Session ID:  {163, 227, 84, 53, 81, 127, 252, 254, 178, 179, 68, 63, 182, 158, 30, 11, 150, 79, 170, 76, 255, 92, 15, 226, 24, 17, 177, 219, 158, 177, 187, 143}
 Cipher Suite:  { 0, 5 }
 Compression Method: 0
 ***
 %% Created:  [Session-1, SSL_RSA_WITH_RC4_128_SHA]
 ** SSL_RSA_WITH_RC4_128_SHA
 [read] MD5 and SHA1 hashes:  len = 74
 0000: 02 00 00 46 03 01 3D B6   43 98 74 32 04 67 19 64  ...F..=.C.t2.g.d
 0010: 3A CA 4F B9 B2 64 D7 42   FE 15 53 BB BE 2A AA 03  :.O..d.B..S..*..
 0020: 84 6E 52 94 A0 5C 20 A3   E3 54 35 51 7F FC FE B2  .nR..\ ..T5Q....
 0030: B3 44 3F B6 9E 1E 0B 96   4F AA 4C FF 5C 0F E2 18  .D?.....O.L.\...
 0040: 11 B1 DB 9E B1 BB 8F 00   05 00                    ..........
 main, READ:  SSL v3.1 Handshake, length = 1712
 ...

璁剧疆浜嗕笅杩扮郴缁熷睘鎬ф椂锛孞SSE鍙彁渚涜皟璇曞姛鑳斤紙涓篠TDOUT锛夛細-Djavax.net.debug=all銆傚畠鐢ㄤ簬璁惧畾瑕佷娇鐢ㄧ殑keystores鍜宼ruststores锛屼互鍙婂湪SSL鎻℃墜鍜岃瘉涔︿氦鎹㈣繃绋嬩腑灏嗗嚭鐜颁粈涔堛傚綋浣犲皾璇曡繘琛孲SL杩炴帴鏃讹紝濡傛灉鎵撶畻纭畾涓嶈兘宸ヤ綔鐨勯儴鍒嗭紝璇ヨ缃崄鍒嗘湁鐢ㄣ

26.3.3.6. 浣跨敤涓伙紡浠庡鍒跺拰ReplicationConnection

浠嶤onnector/J 3.1.7寮濮嬶紝鎴戜滑鎻愪緵浜1涓┍鍔ㄧ▼搴忓彉浣擄紝瀹冭兘鑷姩鍙戝嚭璇伙紡鍐欎富鏈嶅姟鍣ㄧ殑鏌ヨ锛屾垨鏍规嵁Connection.getReadOnly()鐨勭姸鎬佸浠庝富鏈鸿繘琛屾晠闅滃垏鎹㈡垨寰幆璐熻浇骞宠 璁剧疆銆

搴旂敤绋嬪簭鍙戝嚭淇″彿锛岄氳繃璋冪敤Connection.setReadOnly(true)鎸囨槑浜嬪姟涓哄彧璇荤殑锛岃鍏锋湁澶嶅埗鎰忚瘑鐨勮繛鎺ュ皢浣跨敤浠庤繛鎺ヤ箣涓锛屼粠杩炴帴鏄噰鐢ㄤ簡寰幆鏂规鐨勮礋杞藉钩琛er-vm锛堢粰瀹氳繛鎺ヤ笌浠庤繛鎺ュ瘑鍒囩浉鍏筹紝闄ら潪鍦ㄦ湇鍔′腑鍒犻櫎浜嗕粠杩炴帴锛夈傚鏋滀綘鏈1椤瑰啓浜嬪姟锛屾垨1椤瑰鏃堕棿鏁忔劅鐨勮浜嬪姟锛堣浣忥紝鍦∕ySQL涓紝澶嶅埗鏄互寮傛鏂瑰紡杩涜鐨勶級锛岃璋冪敤Connection.setReadOnly(false)锛灏嗚繛鎺ヨ缃负闈炲彧璇荤殑锛岄┍鍔ㄧ▼搴忎細纭繚杩涗竴姝ョ殑璋冪敤鍧囧皢琚彂閫佸埌涓籑ySQL鏈嶅姟鍣ㄣ傞┍鍔ㄧ▼搴忚礋璐d紶鎾璦utocommit鐨勫綋鍓嶇姸鎬侊紝闅旂绾у埆锛屼互鍙婄敤浜庡畬鎴愯璐熻浇骞宠 鍔熻兘鐨勬墍鏈夎繛鎺ヤ箣闂寸殑鐩綍銆

瑕佹兂鍚敤璇ヨ鍔熻兘锛屽湪閰嶇疆搴旂敤鏈嶅姟鍣ㄧ殑杩炴帴姹犳椂锛屾垨涓虹嫭绔嬪簲鐢ㄧ▼搴忓垱寤篔DBC椹卞姩瀹炰緥鏃讹紝璇蜂娇鐢ㄢcom.mysql.jdbc.ReplicationDriver鈥濈被銆傜敱浜庡畠鑳芥帴鍙椾笌鏍囧噯MySQL JDBC椹卞姩鐩稿悓鐨刄RL鏍煎紡锛ReplicationDriver鐩墠涓嶈兘涓庡熀浜巎ava.sql.DriverManager鐨勮繛鎺ヤ竴璧蜂娇鐢紝闄ら潪瀹冩槸鐢―riverManager娉ㄥ唽鐨勫敮涓MySQL JDBC椹卞姩绋嬪簭銆

涓嬮潰缁欏嚭浜嗕竴涓畝鐭殑绠鍗曠ず渚嬶紝浠嬬粛浜嗗浣曞湪鐙珛搴旂敤绋嬪簭涓娇鐢≧eplicationDriver鐨勬柟娉曘

import java.sql.Connection;
import java.sql.ResultSet;
import java.util.Properties;
 
import com.mysql.jdbc.ReplicationDriver;
 
public class ReplicationDriverDemo {
 
    public static void main(String[] args) throws Exception {
        ReplicationDriver driver = new ReplicationDriver();
 
        Properties props = new Properties();
 
        // We want this for failover on the slaves
        props.put("autoReconnect", "true");
 
        // We want to load balance between the slaves
        props.put("roundRobinLoadBalance", "true");
 
        props.put("user", "foo");
        props.put("password", "bar");
 
        //
        // Looks like a normal MySQL JDBC url, with a comma-separated list
        // of hosts, the first being the 'master', the rest being any number
        // of slaves that the driver will load balance against
        //
 
        Connection conn =
            driver.connect("jdbc:mysql://master,slave1,slave2,slave3/test",
                props);
 
        //
        // Perform read/write work on the master
        // by setting the read-only flag to "false"
        //
 
        conn.setReadOnly(false);
        conn.setAutoCommit(false);
        conn.createStatement().executeUpdate("UPDATE some_table ....");
        conn.commit();
 
        //
        // Now, do a query from a slave, the driver automatically picks one
        // from the list
        //
 
        conn.setReadOnly(true);
 
        ResultSet rs = conn.createStatement().executeQuery("SELECT a,b,c FROM some_other_table");
 
         .......
    }
}

26.3.4. 涓嶫2EE鍜屽叾浠朖ava妗嗘灦涓璧蜂娇鐢 Connector/J

鏈妭浠嬬粛浜嗗湪鏁扮涓嶅悓鎯呭喌涓嬩娇鐢–onnector/J鐨勬柟娉曘

26.3.4.1. 涓鑸琂2EE姒傚康

鍦ㄦ湰鑺備腑锛屼粙缁嶄簡涓嶤onnector/J浣跨敤鏈夊叧鐨凧2EE姒傚康鐨勫熀鏈煡璇嗐
26.3.4.1.1. 鐞嗚В杩炴帴姹
杩炴帴姹犳槸鍒涘缓鍜岀鐞嗗涓繛鎺ョ殑涓绉嶆妧鏈紝杩欎簺杩炴帴鍙闇瑕佷娇鐢ㄥ畠浠殑浠讳綍绾跨▼浣跨敤銆傝繛鎺ユ睜鎶鏈熀浜庝笅杩颁簨瀹烇細瀵逛簬澶у鏁板簲鐢ㄧ▼搴忥紝褰撳畠浠鍦ㄥ鐞嗛氬父闇瑕佹暟姣瀹屾垚鐨勪簨鍔℃椂锛屼粎闇瑕佽兘澶熻闂甁DBC杩炴帴鐨1涓嚎绋嬨傛湭澶勭悊浜嬪姟鏃讹紝杩炴帴澶勪簬闂茬疆鐘舵併備娇鐢ㄨ繛鎺ユ睜锛屽厑璁稿叾浠栫嚎绋嬩娇鐢ㄩ棽缃繛鎺ユ潵鎵ц鏈夌敤鐨勪换鍔°

浜嬪疄涓婏紝褰撴煇涓绾跨▼闇瑕佺敤JDBC鍦∕ySQL鎴栧叾浠栨暟鎹簱涓婃墽琛屾搷浣滄椂锛岄渶瑕佺敤鍒扮敱杩炴帴姹犳彁渚涚殑杩炴帴銆備娇鐢ㄨ繛鎺ュ畬鎴愮嚎绋嬪悗锛岀嚎绋嬩細灏嗚繛鎺ヨ繑鍥炵粰杩炴帴姹狅紝浠ヤ究璇ヨ繛鎺ヨ兘澶熻鍏朵粬闇瑕佷娇鐢ㄨ繛鎺ョ殑绾跨▼浣跨敤銆

浠庤繛鎺ユ睜鈥滃熷嚭鈥濊繛鎺ユ椂锛岃杩炴帴浠呬緵璇锋眰瀹冪殑绾跨▼浣跨敤銆備粠缂栫▼瑙傜偣鐪嬶紝鍏舵晥鏋滅瓑鍚屼簬姣忔闇瑕丣DBC杩炴帴鏃惰皟鐢―riverManager.getConnection()锛屼絾鏄紝閲囩敤杩炴帴姹犳妧鏈紝鍙氳繃浣跨敤鏂扮殑鎴栧凡鏈夌殑杩炴帴缁撴潫绾跨▼銆

杩炴帴姹犳妧鏈兘鏄捐憲澧炲姞Java搴旂敤绋嬪簭鐨勬ц兘锛屽悓鏃惰繕鑳介檷浣庤祫婧愪娇鐢ㄧ巼銆傝繛鎺ユ睜鎶鏈殑涓昏浼樼偣鍖呮嫭锛

         缂╃煭浜嗚繛鎺ュ垱寤烘椂闂

涓庡叾浠栨暟鎹簱鐩告瘮锛孧ySQL鎻愪緵浜嗗揩閫熺殑杩炴帴璁剧疆鍔熻兘锛岃繛鎺ユ椂闂撮氬父涓嶆槸闂锛屼絾鍒涘缓鏂扮殑JDBC杩炴帴浠嶄細瀵艰嚧鑱旂綉鎿嶄綔鍜屼竴瀹氱殑IDBC椹卞姩寮閿锛屽鏋滆繖绫昏繛鎺ユ槸鈥滃惊鐜濅娇鐢ㄧ殑锛屼娇鐢ㄨ鏂瑰紡锛屽彲閬垮厤杩欑被涓嶅埄鍥犵礌銆

         绠鍖栫殑缂栫▼妯″瀷

浣跨敤杩炴帴姹犳妧鏈椂锛屾瘡涓崟鐙嚎绋嬭兘澶熷儚鍒涘缓浜嗚嚜宸辩殑JDBC杩炴帴閭f牱杩涜鎿嶄綔锛屼粠鑰屽厑璁镐娇鐢ㄧ洿鎺ョ殑JDBC缂栫▼鎶鏈

         鍙楁帶鐨勮祫婧愪娇鐢

濡傛灉涓嶄娇鐢ㄨ繛鎺ユ睜鎶鏈紝鑰屾槸鍦ㄦ瘡娆¢渶瑕佹椂涓虹嚎绋嬪垱寤烘柊鐨勮繛鎺ワ紝閭d箞搴旂敤绋嬪簭鐨勮祫婧愪娇鐢ㄥ皢鍗佸垎娴垂锛岃屼笖鍦ㄨ礋杞借緝閲嶇殑鎯呭喌涓嬩細瀵艰嚧鏃犳硶棰勬湡鐨勭粨鏋溿

娉ㄦ剰锛屼笌MySQL鐨勬瘡涓繛鎺ュ潎浼氬湪瀹㈡埛绔拰鏈嶅姟鍣ㄧ閫犳垚涓瀹氱殑寮閿锛堟瘡瀵搞丆PU銆佸叧鑱旇浆鎹㈢瓑锛夈傛瘡涓繛鎺ュ潎浼氬搴旂敤绋嬪簭鍜孧ySQL鏈嶅姟鍣ㄧ殑鍙敤璧勬簮甯︽潵涓瀹氱殑闄愬埗銆傛棤璁鸿繛鎺ユ槸鍚︽墽琛屼换浣曟湁鐢ㄧ殑浠诲姟锛屼粛灏嗕娇鐢ㄨ繖浜涜祫婧愪腑鐨勭浉褰撲竴閮ㄥ垎銆

杩炴帴姹犺兘澶熶娇鎬ц兘鏈澶у寲锛屽悓鏃惰繕鑳藉皢璧勬簮鍒╃敤鎺у埗鍦ㄤ竴瀹氱殑姘村钩涔嬩笅锛屽鏋滆秴杩囪姘村钩锛屽簲鐢ㄧ▼搴忓皢宕╂簝鑰屼笉浠呬粎鏄彉鎱€

骞歌繍鐨勬槸锛孲un鍏徃閫氳繃JDBC-2.0鈥滃彲閫夆濇帴鍙o紝瀹屾垚浜咼DBC涓繛鎺ユ睜姒傚康鐨勬爣鍑嗗寲瀹炴柦锛屾墍鏈変富瑕佸簲鐢ㄦ湇鍔″櫒鍧囧疄鏂戒簡鑳藉涓嶮ySQL Connector/J涓璧疯壇濂藉伐浣滅殑杩欑被API銆

閫氬父锛屼綘鍙互鍦ㄥ簲鐢ㄦ湇鍔″櫒鐨勯厤缃枃浠朵腑閰嶇疆杩炴帴姹狅紝骞堕氳繃Java鍛藉悕鍜岀洰褰曟帴鍙o紙JNDI锛夎闂畠銆傚湪涓嬮潰鐨勪唬鐮佷腑锛屼粙缁嶄簡鍦↗2E搴旂敤鏈嶅姟鍣ㄤ笂杩愯鐨勫簲鐢ㄧ▼搴忎腑浣跨敤杩炴帴姹犵殑鏂规硶锛

绀轰緥26.12. 涓嶫2EE搴旂敤鏈嶅姟鍣ㄤ竴璧蜂娇鐢ㄨ繛鎺ユ睜

import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

import javax.naming.InitialContext;
import javax.sql.DataSource;


public class MyServletJspOrEjb {

    public void doSomething() throws Exception {
        /*
         * Create a JNDI Initial context to be able to
         *  lookup  the DataSource
         *
         * In production-level code, this should be cached as
         * an instance or static variable, as it can
         * be quite expensive to create a JNDI context.
         *
         * Note: This code only works when you are using servlets
         * or EJBs in a J2EE application server. If you are
         * using connection pooling in standalone Java code, you
         * will have to create/configure datasources using whatever
         * mechanisms your particular connection pooling library
         * provides.
         */

        InitialContext ctx = new InitialContext();

         /*
          * Lookup the DataSource, which will be backed by a pool
          * that the application server provides. DataSource instances
          * are also a good candidate for caching as an instance
          * variable, as JNDI lookups can be expensive as well.
          */

        DataSource ds = (DataSource)ctx.lookup("java:comp/env/jdbc/MySQLDB");

        /*
         * The following code is what would actually be in your
         * Servlet, JSP or EJB 'service' method...where you need
         * to work with a JDBC connection.
         */

        Connection conn = null;
        Statement stmt = null;

        try {
            conn = ds.getConnection();

            /*
             * Now, use normal JDBC programming to work with
             * MySQL, making sure to close each resource when you're
             * finished with it, which allows the connection pool
             * resources to be recovered as quickly as possible
             */

            stmt = conn.createStatement();
            stmt.execute("SOME SQL QUERY");

            stmt.close();
            stmt = null;

            conn.close();
            conn = null;
        } finally {
            /*
             * close any jdbc instances here that weren't
             * explicitly closed during normal code path, so
             * that we don't 'leak' resources...
             */

            if (stmt != null) {
                try {
                    stmt.close();
                } catch (sqlexception sqlex) {
                    // ignore -- as we can't do anything about it here
                }

                stmt = null;
            }

            if (conn != null) {
                try {
                    conn.close();
                } catch (sqlexception sqlex) {
                    // ignore -- as we can't do anything about it here
                }

                conn = null;
            }
        }
    }
}

濡備笂渚嬫墍绀猴紝鑾峰緱JNDI InitialContext骞舵煡鎵惧埌鏁版嵁搴撳悗锛屽叾浣欎唬鐮佷笌杩囧幓鍦↗DBC缂栫▼涓娇鐢ㄧ殑绫讳技銆

浣跨敤杩炴帴姹犳椂闇瑕佺墷璁扮殑鏈閲嶈浜嬮」鏄紝鏃犺鍦ㄤ唬鐮佷腑鍑虹幇浜嗕粈涔堬紙寮傚父銆佹帶鍒舵祦绛夛級锛岃繛鎺ヤ互鍙婄敱杩炴帴鍒涘缓鐨勪换浣曢儴鍒嗭紙璇彞銆佺粨鏋滈泦绛夛級鍧囧簲琚叧闂紝浠ヤ究鑳藉啀娆′娇鐢ㄥ畠浠傚涓嶇劧锛屽畠浠皢绾犵紶鍦ㄤ竴璧凤紝鍦ㄦ渶濂界殑鎯呭喌涓嬶紝鎰忓懗鐫瀹冧滑鎵浠h〃鐨凪ySQL鏈嶅姟鍣ㄨ祫婧愶紙缂撳啿鍖恒侀攣瀹氥佸鎺ュ瓧绛夛級鍙兘浼氭崋缁戜竴娈垫椂闂达紝鍦ㄦ渶鍧忕殑鎯呭喌涓嬶紝鍙兘浼氬鑷存案涔呮崋缁戙

杩炴帴姹犵殑鏈浣冲ぇ灏忔槸浠涔堬紵

涓庢墍鏈夊叾浠栭厤缃粡楠岃鍒欎竴鏍凤紝鍥炵瓟鏄滃畠鍙栧喅浜庡叿浣撴儏鍐碘濄傚敖绠℃渶浣冲ぇ灏忓彇鍐充笌棰勬湡鐨勮礋杞藉拰骞冲潎鐨勬暟鎹簱浜嬪姟鏃堕棿锛屾渶浣崇殑杩炴帴姹犲ぇ灏忓皬浜庝綘鐨勯鏈熴備緥濡傦紝濡傛灉浣跨敤鐨勬槸Sun鍏徃鐨凧ava Petstore Blueprint搴旂敤绋嬪簭锛屽浜庡寘鍚15锝20涓繛鎺ョ殑杩炴帴姹狅紝浣跨敤MySQL鍜孴omcat锛屽湪鍙帴鍙楃殑鐩稿簲鏃堕棿涓嬶紝鍙湇鍔′簬涓瓑绋嬪害鐨勮礋杞斤紙600涓苟鍙戠敤鎴凤級銆

瑕佹兂纭畾鐢ㄤ簬搴旂敤绋嬪簭鐨勮繛鎺ユ睜澶у皬锛屽簲浣跨敤璇稿Apache Jmeter鎴朤he Grinder绛夊伐鍏峰垱寤鸿礋杞芥祴璇曡剼鏈紝骞跺搴旂敤绋嬪簭杩涜璐熻浇娴嬭瘯銆

纭畾鍑哄彂鐐圭殑涓绉嶇畝鍗曟柟娉曟槸锛屽皢杩炴帴姹犵殑鏈澶ц繛鎺ユ暟閰嶇疆涓衡滄棤闄愨濓紝杩愯璐熻浇娴嬭瘯锛屽苟娴嬮噺鏈澶х殑骞跺彂杩炴帴鏁般傞殢鍚庯紝搴旇繘琛屽弽鍚戞搷浣滐紝纭畾鍑轰娇搴旂敤绋嬪簭鍏锋湁鏈浣虫ц兘鐨勮繛鎺ユ睜鐨勬渶灏忓拰鏈澶у笺

26.3.4.2. 涓嶵omcat涓璧蜂娇鐢–onnector/J

涓嬭堪鍐呭鍩轰簬鍏充簬Tomcat-5.x鐨勬寚绀鸿鏄庯紝http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-datasource-examples-howto.html锛屽湪缂栧啓鏈枃妗f椂瀹冩槸鏈鏂扮殑銆

棣栧厛瀹夎涓嶤onnector/J in $CATALINA_HOME/common/lib涓璧锋彁渚涚殑.jar鏂囦欢锛屼互渚垮畠鑳界敤浜庡凡瀹夎鐨勬墍鏈夊簲鐢ㄧ▼搴忋

鍏舵锛屽湪瀹氫箟Web搴旂敤绋嬪簭鐨凜ontext锛堝満鏅級鍐咃紝閫氳繃涓$CATALINA_HOME/conf/server.xml澧炲姞澹版槑璧勬簮锛岄厤缃JNDI DataSource锛

<Context ....>

  ...

  <Resource name="jdbc/MySQLDB"
               auth="Container"
               type="javax.sql.DataSource"/>

  <!-- The name you used above, must match _exactly_ here!

       The connection pool will be bound into JNDI with the name
       "java:/comp/env/jdbc/MySQLDB"
  -->

  <ResourceParams name="jdbc/MySQLDB">
    <parameter>
      <name>factory</name>
      <value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
    </parameter>

    <!-- Don't set this any higher than max_connections on your
         MySQL server, usually this should be a 10 or a few 10's
         of connections, not hundreds or thousands -->

    <parameter>
      <name>maxActive</name>
      <value>10</value>
    </parameter>

    <!-- You don't want to many idle connections hanging around
         if you can avoid it, only enough to soak up a spike in
         the load -->

    <parameter>
      <name>maxIdle</name>
      <value>5</value>
    </parameter>

    <!-- Don't use autoReconnect=true, it's going away eventually
         and it's a crutch for older connection pools that couldn't
         test connections. You need to decide if your application is
         supposed to deal with SQLExceptions (hint, it should), and
         how much of a performance penalty you're willing to pay
         to ensure 'freshness' of the connection -->

    <parameter>
      <name>validationQuery</name>
      <value>SELECT 1</value>
    </parameter>

   <!-- The most conservative approach is to test connections
        before they're given to your application. For most applications
        this is okay, the query used above is very small and takes
        no real server resources to process, other than the time used
        to traverse the network.

        If you have a high-load application you'll need to rely on
        something else. -->

    <parameter>
      <name>testOnBorrow</name>
      <value>true</value>
    </parameter>

   <!-- Otherwise, or in addition to testOnBorrow, you can test
        while connections are sitting idle -->

    <parameter>
      <name>testWhileIdle</name>
      <value>true</value>
    </parameter>

    <!-- You have to set this value, otherwise even though
         you've asked connections to be tested while idle,
         the idle evicter thread will never run -->

    <parameter>
      <name>timeBetweenEvictionRunsMillis</name>
      <value>10000</value>
    </parameter>

    <!-- Don't allow connections to hang out idle too long,
         never longer than what wait_timeout is set to on the
         server...A few minutes or even fraction of a minute
         is sometimes okay here, it depends on your application
         and how much spikey load it will see -->

    <parameter>
      <name>minEvictableIdleTimeMillis</name>
      <value>60000</value>
    </parameter>

    <!-- Username and password used when connecting to MySQL -->

    <parameter>
     <name>username</name>
     <value>someuser</value>
    </parameter>

    <parameter>
     <name>password</name>
     <value>somepass</value>
    </parameter>

    <!-- Class name for the Connector/J driver -->

    <parameter>
       <name>driverClassName</name>
       <value>com.mysql.jdbc.Driver</value>
    </parameter>

    <!-- The JDBC connection url for connecting to MySQL, notice
         that if you want to pass any other MySQL-specific parameters
         you should pass them here in the URL, setting them using the
         parameter tags above will have no effect, you will also
         need to use &amp; to separate parameter values as the
         ampersand is a reserved character in XML -->

    <parameter>
      <name>url</name>
      <value>jdbc:mysql://localhost:3306/test</value>
    </parameter>

  </ResourceParams>
</Context>

涓鑸岃█锛屽簲閬靛惊鍏充簬鐩稿簲Tomcat鐗堟湰鐨勫畨瑁呰鏄庯紝杩欐槸鍥犱负锛屽湪Tomcat涓厤缃暟鎹簮鐨勬柟寮忎細闅忔椂鍙樺寲锛屽緢涓嶅垢锛屽鏋滃湪XML鏂囦欢涓娇鐢ㄤ簡閿欒鐨勮娉曪紝寰堝彲鑳戒細浠ュ紓甯哥粨鏉燂紝濡備笅鎵绀猴細

Error: java.sql.SQLException: Cannot load JDBC driver class 'null ' SQL
state: null 

26.3.4.3. 涓嶫Boss涓璧蜂娇鐢–onnector/J

涓嬭堪璇存槑閫傜敤浜嶫Boss-4.x銆傝鎯充娇搴旂敤鏈嶅姟鍣ㄨ兘澶熶娇鐢↗DBC椹卞姩绫伙紝璇峰皢涓嶤onnector/J涓璧锋彁渚涚殑.jar鏂囦欢鎷疯礉鍒扮敤浜庢湇鍔″櫒閰嶇疆鐨刲ib鐩綍涓嬶紙閫氬父绉颁负鈥滈粯璁も濓級銆傞殢鍚庯紝鍦ㄧ浉鍚岀殑閰嶇疆鐩綍涓嬶紝鍦ㄥ悕涓衡渄eploy鈥濈殑瀛愮洰褰曚笅锛屽垱寤轰互鈥-ds.xml鈥濈粨灏剧殑鏁版嵁婧愰厤缃枃浠讹紝鐢ㄤ簬閫氱煡Jboss灏嗚鏂囦欢褰撲綔JDBC鏁版嵁婧愩傝鏂囦欢搴斿寘鍚笅杩板唴瀹癸細

<datasources>
    <local-tx-datasource>
        <!-- This connection pool will be bound into JNDI with the name
             "java:/MySQLDB" -->

        <jndi-name>MySQLDB</jndi-name>
        <connection-url>jdbc:mysql://localhost:3306/dbname</connection-url>
        <driver-class>com.mysql.jdbc.Driver</driver-class>
        <user-name>user</user-name>
        <password>pass</password>

        <min-pool-size>5</min-pool-size>

        <!-- Don't set this any higher than max_connections on your
         MySQL server, usually this should be a 10 or a few 10's
         of connections, not hundreds or thousands -->

        <max-pool-size>20</max-pool-size>

        <!-- Don't allow connections to hang out idle too long,
         never longer than what wait_timeout is set to on the
         server...A few minutes is usually okay here,
         it depends on your application
         and how much spikey load it will see -->

        <idle-timeout-minutes>5</idle-timeout-minutes>

        <!-- If you're using Connector/J 3.1.8 or newer, you can use
             our implementation of these to increase the robustness
             of the connection pool. -->

        <exception-sorter-class-name>com.mysql.jdbc.integration.jboss.ExtendedMysqlExceptionSorter</exception-sorter-class-name>
        <valid-connection-checker-class-name>com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker</valid-connection-checker-class-name>

    </local-tx-datasource>
</datasources> 

26.3.5. 璇婃柇 Connector/J鏂归潰鐨勯棶棰

鍦ㄦ湰鑺備腑锛屼粙缁嶄簡濡備綍瑙e喅浣跨敤Connector/J鏃堕亣鍒扮殑闂銆

26.3.5.1. 甯歌闂鍜岃В鍐虫柟妗

瀵逛簬MySQL Connector/J鐢ㄦ埛锛屼細閬囧埌涓浜涘父瑙佺殑鍏卞悓闂銆傚湪鏈妭涓紝浠嬬粛浜嗗畠浠殑鐥囩姸鍜岀浉搴旂殑瑙e喅鏂规硶銆 鍏充簬鏇磋繘涓姝ョ殑淇℃伅锛岃鍙傝鈥滄敮鎸佲濅竴鑺傘

27.3.5.1.1:

闂锛

褰撴垜灏濊瘯鐢∕ySQL Connector/J杩炴帴鍒版暟鎹簱鏃讹紝閬囧埌涓嬭堪寮傚父锛

SQLException: Server configuration denies access to data source
SQLState: 08001
VendorError: 0

鍑虹幇浜嗕粈涔堥棶棰橈紵 浣跨敤MySQL鍛戒护琛屽鎴风鏃讹紝杩炴帴鑹ソ銆

鍥炵瓟锛

MySQL Connector/J蹇呴』浣跨敤TCP/IP濂楁帴瀛楁潵杩炴帴MySQL锛屽師鍥犲湪浜嶫ava涓嶆敮鎸乁nix Domain濂楁帴瀛椼傚洜姝わ紝褰揗ySQL Connector/J杩炴帴鍒癕ySQL鏃讹紝MySQL鏈嶅姟鍣ㄧ殑瀹夊叏绠$悊鍣ㄥ皢浣跨敤鍏舵巿鏉冭〃鍒ゆ柇鏄惁鍏佽杩炴帴銆傚繀椤绘坊鍔犳巿鏉冩墠鑳藉厑璁歌鎿嶄綔銆備笅闈㈢粰鍑轰簡涓涓墽琛岃鎿嶄綔鐨勭ず渚嬶紙浣嗗苟闈炴渶瀹夊叏鐨勶級銆

浠巑ysql鍛戒护琛屽鎴风浠ヨ兘澶熸巿鏉冪殑鐢ㄦ埛韬唤鐧诲綍锛屽苟鍙戝嚭涓嬭堪鍛戒护锛

GRANT ALL PRIVILEGES ON [dbname].* to
                '[user]'@'[hostname]' identified by
                '[password]'

鐢ㄤ綘鐨勬暟鎹簱鍚嶇О鏇挎崲[dbname]锛岀敤鐢ㄦ埛鍚嶆浛鎹user]锛岀敤MySQL Connector/J灏嗚繛鎺ョ殑涓绘満鏇挎崲[hostname]锛屽苟鐢ㄦ墦绠椾娇鐢ㄧ殑瀵嗙爜鏇挎崲[password]銆傛敞鎰忥紝瀵逛簬浠庢湰鍦颁富鏈鸿繘琛岃繛鎺ョ殑涓绘満鍚嶉儴鍒嗭紝RedHat Linux灏嗗け璐ャ傚湪杩欑鎯呭喌涓嬶紝瀵逛簬[hostname]鍊硷紝闇瑕佷娇鐢ㄢ渓ocalhost.localdomain鈥濄傞殢鍚庯紝鍙戝嚭FLUSH PRIVILEGES鍛戒护銆

娉ㄩ噴锛

闄ら潪娣诲姞浜嗏--host鈥濇爣蹇楋紝骞朵负涓绘満浣跨敤浜嗕笉鍚屼簬鈥渓ocalhost鈥濈殑鍏朵粬璁剧疆锛屽惁鍒欏皢鏃犳硶浣跨敤mysql鍛戒护琛屽鎴绔祴璇曡繛閫氭с傚鏋滀娇鐢ㄤ簡鐗规畩鐨勪富鏈哄悕鈥渓ocalhost鈥濓紝mysql鍛戒护琛屽鎴风灏嗕娇鐢║nix鍩熷鎺ュ瓧銆傚鏋滄鍦ㄦ祴璇曚笌鈥渓ocalhost鈥濈殑杩為氭э紝璇蜂娇鐢ㄢ127.0.0.1鈥濅綔涓轰富鏈哄悕銆

璀﹀憡

濡傛灉浣犱笉浜嗚В鈥淕RANT鈥濆懡浠ゆ槸骞蹭粈涔堢殑锛屾垨涓嶄簡瑙h鍛戒护鐨勫伐浣滄柟寮忥紝鍦ㄥ皾璇曟洿鏀规潈闄愪箣鍓嶏紝璇烽槄璇籑ySQL鎵嬪唽涓殑 涓鑸畨鍏ㄤ簨瀹滀互鍙MySQL璁块棶鏉冮檺浣撶郴涓鑺傘

濡傛灉鍦∕ySQL涓笉鎭板綋鍦版洿鏀逛簡鏉冮檺鍜岃鍙紝鍙兘浼氫娇鏈嶅姟鍣ㄤ笉浼氬叿鏈夋渶浣崇殑瀹夊叏鎬ц兘銆

27.3.5.1.2:

闂锛

鎴戠殑搴旂敤绋嬪簭鎶涘嚭SQLException鈥滄棤鎭板綋鐨勯┍鍔ㄧ▼搴忊濄備负浠涔堜細鍑虹幇璇ユ儏鍐碉紵

鍥炵瓟锛

鍑虹幇浜嗕袱绉嶆儏鍐典箣涓銆傛垨鏄1椹卞姩绋嬪簭鏈綅浜庝綘鐨凜LASSPATH涓紙璇峰弬瑙佸墠闈㈢殑鈥滃畨瑁呴儴鍒嗏濓級锛屾垨鏄疷RL鏍煎紡涓嶆纭紙璇峰弬瑙佺敤MySQL Connector/J寮鍙戝簲鐢ㄧ▼搴忥級銆

27.3.5.1.3:

闂锛

褰撴垜璇曞浘鍦↗ava绋嬪簭鎴栧簲鐢ㄧ▼搴忎腑浣跨敤MySQL Connector/J鏃讹紝閬囧埌绫讳技涓嬮潰鐨勫紓甯革細

SQLException: 鏃犳硶杩炴帴鍒癶ost:3306涓婄殑MySQL鏈嶅姟鍣ㄣ
鍦ㄤ綘灏濊瘯杩炴帴鐨勬満鍣紡绔彛涓婃槸鍚︽湁姝e湪杩愯鐨凪ySQL鏈嶅姟鍣紵
 
(java.security.AccessControlException)
SQLState: 08S01
VendorError: 0 

鍥炵瓟锛

鎴栬鏄洜涓轰綘姝e湪杩愯Applet锛屼綘鐨凪ySQL鏈嶅姟鍣ㄦ槸閲囩敤鈥--skip-networking鈥濋夐」闆嗗畨瑁呯殑锛涙垨璁告槸鍥犱负MySQL鏈嶅姟鍣ㄤ綅浜庨槻鐏涔嬪悗銆

Applet浠呰兘浣跨綉缁滆繛鎺ヨ繑鍥炶繍琛學eb鏈嶅姟鍣ㄧ殑鏈哄櫒锛岃Web鏈嶅姟鍣ㄦ彁渚涗簡鐢ㄤ簬Applet鐨.class鏂囦欢銆傝繖鎰忓懗鐫锛岃鎯充娇鍏跺伐浣滐紝MySQL蹇呴』杩愯鍦ㄧ浉鍚岀殑鏈哄櫒涓婏紙鎴栧繀椤讳娇鏌愮被绔彛閲嶅畾鍚戯級銆傝繖杩樻剰鍛崇潃锛屼綘鏃犳硶閫氳繃浣犵殑鏈湴鏂囦欢绯荤粺鏉ユ祴璇旿ava绋嬪簭锛屼綘蹇呴』灏嗗畠浠斁鍦╓eb鏈嶅姟鍣ㄤ笂銆

MySQL Connector/J浠呰兘浣跨敤TCP/IP涓嶮ySQL杩涜閫氫俊锛岃繖鏄洜涓篔ava涓嶆敮鎸乁nix鍩熷鎺ュ瓧銆傚鏋淢ySQL鏄敤鈥--skip-networking鈥濇爣蹇楀惎鍔ㄧ殑锛屾垨閲囩敤浜嗛槻鐏锛孴CP/IP涓嶮ySQL鐨勯氫俊鍙兘浼氬彈鍒板奖鍝嶃

濡傛灉MySQL鏄敤鈥--skip-networking鈥濋夐」闆嗗惎鍔ㄧ殑锛堜緥濡侻ySQL鏈嶅姟鍣ㄧ殑Debian Linux鍖呭嵆鐢ㄤ簬璇ョ洰鐨勶級锛岄渶瑕佸湪鏂囦欢/etc/mysql/my.cnf鎴/etc/my.cnf涓皢鍏舵敞閲婃帀銆傚綋鐒讹紝my.cnf鏂囦欢涔熷彲鑳戒綅浜嶮ySQl鏈嶅姟鍣ㄧ殑鈥渄ata鈥濈洰褰曚笅鎴栧叾浠栧湴鏂癸紙鍙栧喅浜庣郴缁熶腑MySQL鐨勭紪璇戞柟寮忥級銆侻ySQL AB鍒涘缓鐨勪簩杩涘埗鏂囦欢鎬讳細鍦ㄦ煡鎵/etc/my.cnf鍜孾datadir]/my.cnf銆傚鏋滀负MySQL鏈嶅姟鍣ㄩ儴缃蹭簡闃茬伀澧欙紝闇瑕佸闃茬伀澧欒繘琛岄厤缃紝鍏佽浠庤繍琛孞ava浠g爜鐨勪富鏈哄湪MySQL鐩戝惉鐨勭鍙d笂锛堥粯璁や负3306锛夊缓绔嬩笌 MySQL鏈嶅姟鍣ㄧ殑TCP/IP杩炴帴銆

27.3.5.1.4:

闂锛

I鎴戠殑灏忔湇鍔$▼搴忥紡搴旂敤绋嬪簭鐧藉ぉ宸ヤ綔鑹ソ锛屼絾鍦ㄦ櫄涓婂嵈鍋滄宸ヤ綔銆

鍥炵瓟锛

涓嶅伐浣滄椂闂磋秴杩8灏忔椂鍚庯紝MySQL鍏抽棴浜嗚繛鎺ャ備綘鎴栬闇瑕佷娇鐢ㄨ兘澶勭悊澶辨晥杩炴帴鐨勮繛鎺ユ睜锛屾垨浣跨敤鈥渁utoReconnect鈥濆弬鏁帮紙璇峰弬瑙佺敤MySQL Connector/J寮鍙戝簲鐢ㄧ▼搴忥級銆

姝ゅ锛屼綘搴斿湪搴旂敤绋嬪簭涓繕鑾 SQLException骞跺鐞嗗畠浠紝鑰屼笉鏄湪搴旂敤绋嬪簭閫鍑哄墠涓鐩翠紶鎾畠浠紝杩欐槸1涓ソ鐨勭紪绋嬩範鎯傚湪鏌ヨ澶勭悊杩囩▼涓亣鍒扮綉缁滆繛閫氭ф柟闈㈢殑闂鏃讹紝MySQL Connector/J浼氬皢SQLState锛堝弬瑙丄PIDOCS涓殑java.sql.SQLException.getSQLState()锛夎缃负鈥08S01鈥濄傞殢鍚庯紝搴旂敤绋嬪簭浠g爜灏嗗皾璇曞啀娆¤繛鎺ュ埌MySQL銆

鍦ㄤ笅闈㈢殑绀轰緥锛坰implistic锛変腑锛岀粰鍑轰簡鑳藉澶勭悊杩欑被寮傚父鐨勪唬鐮侊細

绀轰緥26.13. 閲嶈瘯閫昏緫鐨勪簨鍔$ず渚

public void doBusinessOp() throws SQLException {
        Connection conn = null;
        Statement stmt = null;
        ResultSet rs = null;

        //
        // How many times do you want to retry the transaction
        // (or at least _getting_ a connection)?
        //
        int retryCount = 5;

        boolean transactionCompleted = false;

        do {
            try {
                conn = getConnection(); // assume getting this from a
                                        // javax.sql.DataSource, or the
                                        // java.sql.DriverManager

                conn.setAutoCommit(false);

                //
                // Okay, at this point, the 'retry-ability' of the
                // transaction really depends on your application logic,
                // whether or not you're using autocommit (in this case
                // not), and whether you're using transacational storage
                // engines
                //
                // For this example, we'll assume that it's _not_ safe
                // to retry the entire transaction, so we set retry count
                // to 0 at this point
                //
                // If you were using exclusively transaction-safe tables,
                // or your application could recover from a connection going
                // bad in the middle of an operation, then you would not
                // touch 'retryCount' here, and just let the loop repeat
                // until retryCount == 0.
                //
                retryCount = 0;

                stmt = conn.createStatement();

                String query = "SELECT foo FROM bar ORDER BY baz";

                rs = stmt.executeQuery(query);

                while (rs.next()) {
                }

                rs.close();
                rs = null;

                stmt.close();
                stmt = null;

                conn.commit();
                conn.close();
                conn = null;

                transactionCompleted = true;
            } catch (SQLException sqlEx) {

                //
                // The two SQL states that are 'retry-able' are 08S01
                // for a communications error, and 41000 for deadlock.
                //
                // Only retry if the error was due to a stale connection,
                // communications problem or deadlock
                //

                String sqlState = sqlEx.getSQLState();

                if ("08S01".equals(sqlState) || "41000".equals(sqlState)) {
                    retryCount--;
                } else {
                    retryCount = 0;
                }
            } finally {
                if (rs != null) {
                    try {
                        rs.close();
                    } catch (SQLException sqlEx) {
                        // You'd probably want to log this . . .
                    }
                }

                if (stmt != null) {
                    try {
                        stmt.close();
                    } catch (SQLException sqlEx) {
                        // You'd probably want to log this as well . . .
                    }
                }

                if (conn != null) {
                    try {
                        //
                        // If we got here, and conn is not null, the
                        // transaction should be rolled back, as not
                        // all work has been done

                        try {
                            conn.rollback();
                        } finally {
                            conn.close();
                        }
                    } catch (SQLException sqlEx) {
                        //
                        // If we got an exception here, something
                        // pretty serious is going on, so we better
                        // pass it up the stack, rather than just
                        // logging it. . .

                        throw sqlEx;
                    }
                }
            }
        } while (!transactionCompleted && (retryCount > 0));
    }

27.3.5.1.5:

闂锛

鎴戞灏濊瘯浣跨敤JDBC-2.0鍙洿鏂扮粨鏋滈泦锛屼絾閬囧埌寮傚父锛岃鎴戠殑缁撴灉闆嗕笉鍙洿鏂般

鍥炵瓟锛

鐢变簬MySQL娌℃湁琛孖D锛孧ySQL Connector/J浠呰兘鏇存柊鏉ヨ嚜鏌ヨ涓斾綅浜庢湁鑷冲皯涓涓富閿殑琛ㄤ笂鐨勭粨鏋滈泦锛屾煡璇㈠繀椤婚夋嫨鎵鏈夌殑涓婚敭锛岃屼笖鏌ヨ鍗宠兘浣滅敤鍦1涓〃涓婏紙鍗充笉瀛樺湪鑱斿悎锛夈傚湪JDBC瑙勮寖涓粰鍑轰簡杩欐柟闈㈢殑浠嬬粛銆

26.3.5.2. 濡備綍閫氭姤缂洪櫡鍜岄棶棰

閫氭姤缂洪櫡鐨勬甯稿湴鍧鏄http://bugs.mysql.com/锛屽畠涔熸槸鎴戞柟缂洪櫡鏁版嵁搴撶殑鍦板潃銆傝繖鏄1涓叕鍏辨暟鎹簱锛屼换浣曚汉閮借兘娴忚瀹冨苟杩涜鐩稿簲鐨勬悳绱€傚鏋滀綘宸茬櫥褰曞埌绯荤粺锛屼篃搴旇兘杈撳叆鏂扮殑鎶ュ憡銆

濡傛灉鍙戠幇MySQL涓瓨鍦ㄦ晱鎰熺殑瀹夊叏缂洪櫡锛岃鍙戦佺數瀛愰偖浠惰嚦security@mysql.com

缂栧啓鑹ソ鐨勭己闄锋姤鍛婇渶瑕佽愬績锛屼絾鍦ㄧ1鏃堕棿姝g‘鍦板畬鎴愬畠涓嶄粎鑳借妭鐪佹垜浠殑鏃堕棿锛屼篃鑳借妭鐪佷綘鑷繁鐨勬椂闂淬傝壇濂界殑缂洪櫡鎶ュ憡搴斿寘鍚缂洪櫡鐨勫畬鏁存祴璇曟儏鍐碉紝浠ヤ究鎴戜滑浣犺兘澶熷湪涓嬩釜鐗堟湰涓洿姝h缂洪櫡銆

鏈妭浠嬬粛鐨勫唴瀹圭敤浜庡府鍔╀綘姝g‘鍦扮紪鍐欐姤鍛婏紝浠庨伩鍏嶅皢浣犵殑鏃堕棿娴垂鍦ㄥ鎴戜滑甯姪涓嶅ぇ鎴栨病鏈夊府鍔╃殑浜嬩笂锛

濡傛灉鏈1浠藉彲閲嶅鐨勭己闄锋姤鍛婏紝璇峰皢鍏舵彁浜ゅ埌缂洪櫡鏁版嵁搴擄紝http://bugs.mysql.com/

瀵逛簬浠讳綍鎴戜滑鑳藉啀鐜扮殑缂洪櫡锛屽湪涓嬩竴涓狹ySQL鐗堟湰涓慨姝e畠鐨勬満浼氬緢澶с

瑕佹兂閫氭姤鍏朵粬闂锛岃浣跨敤MySQL閭欢鍒楄〃銆

璇锋敞鎰忥紝鎴戜滑鍙兘浼氬鍖呭惈杩囧淇℃伅鐨勬秷鎭綔鍑哄搷搴旓紝浣嗕笉澶細瀵瑰寘鍚繃灏戜俊鎭殑娑堟伅浣滃嚭鍥炲簲銆備汉浠父浼氱渷鐣ユ帀涓浜涗簨瀹烇紝鍥犱负浠栦滑璁や负鑷繁鐭ラ亾浜嗘晠闅滅殑鍘熷洜锛屽苟鎯冲綋鐒跺湴璁や负杩欑被缁嗚妭鏃犲叧绱ц銆

鑹ソ鐨勫師鍒欐槸锛氬鏋滀綘瀵归檲杩版煇浜嬬姽璞笉瀹氾紝璇烽檲杩颁箣銆傚鏋滄垜浠姹備綘鎻愪緵鍒濆鎶ュ憡涓己灏戠殑淇℃伅锛屽湪鎶ュ憡涓紪鍐欏琛屼俊鎭簮姣旂瓑鍊欏洖澶嶈蹇紝楹荤儲涔熸洿灏忋

鍦ㄧ己闄锋姤鍛婏紝鏈甯哥姱鐨勯敊璇寘鎷細锛坅锛夋湭鍖呭惈鎵浣跨敤Connector/J鎴朚ySQL鐨勭増鏈彿锛屼互鍙婏紙b锛夋湭瀹屽叏鎻忚堪瀹夎浜咰onnector/J鐨勫钩鍙帮紙鍖呮嫭JVM鐗堟湰锛屽钩鍙扮被鍨嬶紝浠ュ強鎵瀹夎MySQL鏈韩鐨勭増鏈彿锛夈

杩欐槸楂樺害鐩稿叧鐨勪俊鎭紝濡傛灉娌℃湁瀹冿紝99锛呯殑缂洪櫡鎶ュ憡鏃犵敤銆傛垜浠亣鍒拌繖绫婚棶棰橈紝鈥滀负浣曞畠瀵规垜娌$敤鈥濓紵 闅忓悗锛屾垜浠彂鐜板湪璇ySQL鐗堟湰涓紝鎵璇锋眰鐨勭壒鎬у皻鏈疄鏂斤紝鎴栧湪杈冩柊鐨凪ySQL鐗堟湰涓凡鏇存浜嗘姤鍛婁腑鎻忚堪鐨勭己闄枫

鏈変簺鏃跺欙紝閿欒涓庡钩鍙扮浉鍏筹紝鍦ㄨ繖绫绘儏鍐典笅锛屽鏋滀笉鐭ラ亾鎿嶄綔绯荤粺鍜屽钩鍙扮殑鐗堟湰鍙凤紝鎴戜滑鍑犱箮涓嶅彲鑳芥洿姝d换浣曢棶棰樸

濡傛灉鍙兘锛屼綘搴斿垱寤1浠藉彲閲嶅鐨勩佷笉鍚换浣曠涓夋柟绫荤殑鐙珛娴嬭瘯妗堜緥銆

涓轰簡鏄杩涚▼娴佺嚎鍖栵紝鎴戜滑涓嶤onnector/J涓璧锋彁渚涗簡鐢ㄤ簬娴嬭瘯鐨勫熀鏈被锛屽悕涓com.mysql.jdbc.util.BaseBugReport銆瑕佹兂浣跨敤璇ョ被涓篊onnector/J鍒涘缓1涓祴璇曟渚嬶紝浣犲簲搴斿垱寤鸿嚜宸辩殑浠com.mysql.jdbc.util.BaseBugReport缁ф壙鐨勭被锛屽苟瑕嗙洊鏂规硶setUp()tearDown()runTest()銆

setUp()鏂规硶涓紝鍒涘缓鐢ㄤ簬鍒涘缓琛ㄧ殑浠g爜锛屽苟鐢ㄦ紨绀虹己闄锋墍闇鐨勬暟鎹~鍏呰〃銆

runTest ()鏂规硶涓紝浣跨敤鍦ㄢ渟etUp鈥濇柟娉曚腑鍒涘缓鐨勮〃鍜屾暟鎹紝鍒涘缓鐢ㄤ簬婕旂ず缂洪櫡鐨勪唬鐮併

tearDown()鏂规硶涓紝鎾ら攢鍦setUp()鏂规硶涓垱寤虹殑浠讳綍琛ㄣ

瀵逛簬涓婅堪涓夌鏂规硶涓殑浠讳綍涓绉嶏紝搴斾娇鐢getConnection ()鍚勭鍙樹綋涓殑涓绉嶅垱寤轰笌MySQL鐨凧DBC杩炴帴銆

         getConnection()锛氭彁渚涗簡涓庡湪getUrl()涓寚瀹氱殑JDBC URL鐨勮繛鎺ャ傚鏋滆繛鎺ュ凡瀛樺湪锛岃繑鍥炶杩炴帴锛屽惁鍒欏皢鍒涘缓鏂扮殑杩炴帴銆

         getNewConnection()锛氬鏋滈渶瑕佷负缂洪櫡鎶ュ憡鑾峰緱鏂扮殑杩炴帴锛堝嵆鍖呭惈1涓互涓婄殑杩炴帴锛夛紝搴斾娇鐢ㄥ畠銆

         getConnection(String url)锛氫娇鐢ㄧ粰瀹氱殑URL杩斿洖杩炴帴銆

         getConnection(String url, Properties props)锛氫娇鐢ㄧ粰瀹氱殑URL鍜屽睘鎬ц繑鍥炶繛鎺ャ

濡傛灉闇瑕佷娇鐢ㄤ笉鍚屼簬鈥渏dbc:mysql:///test鈥濈殑JDBC URL锛岃繕搴旇鐩栨柟娉getUrl()

鍦ㄦ紨绀轰綘鎵棰勮琛屼负鐨勬祴璇曟渚嬩腑锛堢浉瀵逛簬浣犺瀵熷埌鐨勪笘绾涓猴紝杩欐槸浣犲~鍏呴敊璇姤鍛婄殑鏈鍙兘鍘熷洜锛夛紝浣跨敤assertTrue(boolean expression)assertTrue(String failureMessage, boolean expression)鏂规硶鍒涘缓蹇呴』婊¤冻鐨勬潯浠躲

鏈鍚庯紝鍒涘缓鐢ㄤ簬鍒涘缓娴嬭瘯妗堜緥瀹炰緥鐨main ()鏂规硶锛屽苟璋冪敤run鏂规硶锛

public static void main(String[] args) throws Exception {
      new MyBugReport().run();
 }

瀹屾垚浜嗘祴璇曟渚嬪苟璇佸疄瀹冭兘婕旂ず浣犳墍閫氭姤鐨勭己闄峰悗锛岃灏嗚妗堜緥涓庣己闄锋姤鍛婁竴璧蜂笂浼犲埌http://bugs.mysql.com/

26.3.6.聽Changelog

# Changelog
# $Id: CHANGES,v 1.38.4.206 2005/05/12 15:25:54 mmatthews Exp $
 
05-17-05锛氱増鏈3.2.1-alpha
 
    - 鐜板凡涓嶅啀閲嶈Autoreconnect鍔熻兘锛堝嵆autoReconnect=true锛夈
      濡傛灉灏濊瘯骞朵娇鐢ㄥ畠灏嗘姏鍑哄紓甯革紝浣跨敤鈥渆nableDeprecatedAutoreconnect=true鈥濆彲缁х画浣跨敤autoReconnect銆備絾鏄紝鍦–onnector/J 3.3涓皢鍒犻櫎璇ラ」鐗规э紝璇峰弬瑙佹墜鍐屼腑鍏充簬涓嶉渶瑕佷娇鐢╝utoReconnect鐨勭浉搴旇В鍐虫柟妗堛
 
    - 鐜板湪锛岄┍鍔ㄧ▼搴忓皢妫鏌ユ槸鍚﹁缃簡鏈嶅姟鍣ㄥ彉閲忊渋nit_connect鈥濓紝濡傛灉璁剧疆浜嗚鍙橀噺锛屽皢妫鏌utocommit锛堣嚜鍔ㄦ彁浜わ級璁剧疆锛屽苟搴旂敤瀹冦
  
    - 濡傛灉杩炴帴鐨勬湇鍔″櫒鐗堟湰鍦5.0.x浠ヤ笂锛岃屼笖Statement.setFetchSize( > 0)锛岄┍鍔ㄧ▼搴忓皢灏濊瘯浣跨敤鏈嶅姟鍣ㄩ澶勭悊璇彞锛屽苟浣跨敤缁撴灉闆嗏渃ursors鈥濊幏鍙栬鍙ャ
  
    - ServerPreparedStatements鐜板湪鑳芥纭湴灏咮LOB/CLOB鏁版嵁浠モ滄祦鏂瑰紡鈥濆彂閫佽嚦鏈嶅姟鍣ㄣ備綘鍙互浣跨敤灞炴р渂lobSendChunkSize鈥濋厤缃▼搴忓潡澶у皬鐨勯槇鍊硷紙榛樿鍊间负1MB锛夈
  
    - 鏀寔sql妯″紡NO_BACKSLASH_ESCAPES浠ュ強闈炴湇鍔″櫒绔澶勭悊璇彞銆
 
12-23-04锛氱増鏈3.2.0-alpha
 
    -鏇存浜咲atabaseMetaData.supportsCatalogIn*()閿欒鐨勮繑鍥炲笺
    
    -浣跨敤ServerPreparedStatements浠ュ強MySQL 5.0鎴栨洿楂樼増鏈椂锛屾敮鎸佸熀浜庘渃ursor鈥濈殑缁撴灉闆嗐傜粨鏋滈泦闇涓衡滀粎姝e悜鈥濈粨鏋滈泦锛屽苟闇鍚敤閽堝璇ラ」鐗规х殑闈為浂鑾峰彇澶у皬銆
      
    - 閲嶆柊鍒嗚В浜嗛澶勭悊璇彞鐨剋here閫昏緫锛屾湇鍔″櫒绔澶勭悊璇彞淇濇寔鏈夋晥銆
 
10-07-05锛氱増鏈3.1.11-stable
 
    - 鏇存浜BUG#11629锛氬綋瀛楃缂栫爜鏄渦tf8鈥濇椂鎺у埗鍙颁笂鐨勪吉鈥!鈥濄
      
    -鏇存浜嗕负涓㈠け鈥;鈥濓紙鐢ㄤ簬鈥減lain鈥濊鍙ワ級鐨勬祴璇曟渚嬬敓鎴愮殑璇彞銆
      
    - 鏇存浜BUG#11663锛氫负鏈嶅姟鍣ㄧ棰勫鐞嗚鍙ョ敓鎴愮殑涓嶆纭殑testcase鑴氭湰銆
      
    -鏇存浜嗗洜淇ˉBUG#11552鑰屽鑷寸殑鍥炲綊锛屽浜BUG#11552锛屽綋鏁存暟澶勪簬姝e彿绫诲瀷鐨勮寖鍥村唴鏃讹紝瀵逛簬鏃犵鍙锋暣鏁帮紝璇ョ己闄峰皢瀵艰嚧椹卞姩绋嬪簭杩斿洖閿欒鍊笺
    
    -灏嗘簮浠g爜绉诲埌浜唖vn repo銆
    
    -鏇存浜BUG#11797锛氳浆涔夋爣蹇椾笉鑰冭檻鐢ㄤ簬杞箟鐢ㄩ旂殑灞傚寮忓崟寮曞彿銆
  
    -浣跨敤鏈嶅姟鍣ㄧ棰勫鐞嗚鍙ユ椂锛屼笉璇嗗埆GEOMETRY绫诲瀷銆
    
    -鏇存浜BUG#11879锛歊eplicationConnection涓嶄細鍒囨崲鑷充粠杩炴帴锛屾姏鍑衡滅洰褰曚笉鑳戒负绌衡濆紓甯搞
      
    -鏇存浜BUG#12218锛屼富杩炴帴鍜屽叿鏈夊鍒惰繛鎺ョ殑浠庤繛鎺ヤ箣闂村叡浜殑灞炴с
      
    - 鏇存浜BUG#10630銆傚鏋滆鍙ュ凡鍏抽棴锛孲tatement.getWarnings()鏃犳硶涓嶯PE涓璧峰伐浣溿
      
    -闇瑕佹椂锛屽湪PreparedStatement.ParseInfo()涓紝鍗宠兘浠嶴QL鑾峰彇char[]銆
    
    -鏇存浜BUG#12104锛屾湇鍔″櫒绔澶勭悊璇彞涓嶈兘澶勭悊Geometry绫诲瀷銆
      
    -鏇存浜BUG#11614锛屼娇鐢ㄥ瀛楄妭瀛楃缂栫爜鏃讹紝StringUtils.getBytes()涓嶅伐浣滐紝鍦ㄢ淿characters_鈥濅腑鎸囧畾浜嗛暱搴︺
      
    -鏇存浜BUG#11798锛孭stmt.setObject(...., Types.BOOLEAN)鎶涘嚭寮傚父銆
    
    -鏇存浜BUG#11976锛宮axPerformance.properties鎷奸敊鈥渆lideSetAutoCommits鈥濄
  
    -鏇存浜BUG#11575锛屽浜庡湪Window骞冲彴涓婄殑鏈嶅姟鍣紝DBMD.storesLower/Mixed/UpperIdentifiers()閫氭姤涓嶆纭殑鍊笺
  
    -鏇存浜BUG#11190锛屽湪ResultSet.moveToCurrentRow()涔嬪墠璋冪敤浜哛esultSet.moveToInsertRow()鏃讹紝ResultSet.moveToCurrentRow()涓嶈捣浣滅敤銆
  
    -鏇存浜BUG#11115锛屼娇鐢ㄦ湇鍔″櫒绔澶勭悊璇彞鍜.setBytes()鏃讹紝VARBINARY鏁版嵁鍙戠敓宕╂簝銆
 
    -鏇存浜BUG#12229锛屾湇鍔″櫒绔澶勭悊璇彞鎸傝捣explainSlowQueries銆
  
    -鏇存浜BUG#11498锛岃浆涔夊鐞嗗櫒涓嶈冭檻鐢ㄥ弻寮曞彿鍒嗛殧鐨勫瓧绗︿覆銆
  
    -瀵逛簬鏈嶅姟鍣ㄧ棰勫鐞嗚鍙ワ紝澧炲姞浜嗗鏇存敼娴佸弬鏁扮殑闄愬埗銆傚彧瑕佸湪鎵ц鍓嶈缃簡鈥淿all_鈥濇祦鍙傛暟锛屽彲涓嶅繀璋冪敤.clearParameters()銆傦紙鐢变簬瀹㈡埛绔紡鏈嶅姟鍣ㄥ崗璁殑闄愬埗锛岄澶勭悊璇彞涓嶈兘澶嶄綅鏈嶅姟鍣ㄧ鐨勨淿individual_ stream鈥濇暟鎹級銆
   
    -淇敼浜咶ield绫伙紝*Buffer鍜孧ysqlIO锛岃兘澶熻瘑鍒ぇ浜嶪nteger.MAX_VALUE鐨勫瓧娈甸暱搴︺
  
    -鏇存柊浜咲BMD.supportsCorrelatedQueries()锛屽綋鐗堟湰楂樹簬4.1鏃惰繑鍥炩滅湡鈥濓紝鏇存柊浜唖upportsGroupByUnrelated()浣夸箣杩斿洖鈥滅湡鈥濓紝骞舵洿鏂颁簡getResultSetHoldability()浣夸箣杩斿洖HOLD_CURSORS_OVER_COMMIT銆
  
    -鏇存浜BUG#12541锛孌atabaseMetaData.getIndexInfo()涓殑catalog锛堢洰褰曪級鍙傞噺澶勭悊锛屽畠涔熸剰鍛崇潃瀵笵atabaseMetaData涓笅杩版柟娉曠殑鏇存敼锛
  
    - getBestRowIdentifier()
    - getColumns()
    - getCrossReference()
    - getExportedKeys()
    - getImportedKeys()
    - getIndexInfo()
    - getPrimaryKeys()
    - getProcedures() (and thus indirectly getProcedureColumns())
    - getTables()
  
涓婅堪鎵鏈夋柟娉曚腑鐨勨渃atalog鈥濆弬閲忕幇鍏锋湁涓嬭堪琛屼负鐗瑰緛锛
  
  -濡傛灉鎸囧畾涓篘ull锛岃〃绀轰笉浼氫娇鐢╟atalog鏉ヨ繃婊ょ粨鏋滐紙鍥犳灏嗘悳绱㈡墍鏈夋暟鎹簱锛夛紝闄ら潪鍦↗DBC URL灞炴т腑璁剧疆浜嗏渘ullCatalogMeansCurrent=true鈥濄
 
  -鎸囧畾涓衡溾濊〃绀哄綋鍓峜atalog锛屽敖绠″畠涓嶆槸鍗佸垎鍏煎JDBC瑙勮寖锛屼絾瀹冩槸涓轰紶缁熺敤鎴蜂繚鐣欑殑銆
 
  -鎸囧畾catalog锛屼娇涔嬫寜API鏂囨。涓槓鏄庣殑鏂瑰紡宸ヤ綔銆
    
  -浣垮緱jdbc2.optional杞欢鍖呬腑鐨勨滃皝瑁呪濊繛鎺ヨ兘澶熶娇鐢–onnection.clientPrepare()锛堜娇鐢–onnectionPoolDataSource瀹炰緥鍒涘缓杩炴帴锛夈
 
    -涓哄鎴风澧炲姞浜咰onnection.isMasterConnection()锛屼互纭畾澶氫富鏈轰富锛忎粠杩炴帴鏄惁杩炴帴鑷冲垪琛ㄤ腑鐨勭1涓富鏈恒
 
    -鏇存浜BUG#12753锛孶RL灞炴х敤浜庘=鈥濈殑鏍囧織浼氬鑷粹渟essionVariables=....鈥濇棤娉曟纭湴鍙傛暟鍖栥
 
    -鏇存浜BUG#11781锛屽綋DatabaseMetaData鏂规硶浣跨敤璇ヤ俊鎭椂锛屾墍寮曠敤鐨勫閿俊鎭笉鑳借姝g‘瑙f瀽銆
 
    -鑰冭檻鍒版祦缂撳啿鍖哄ぇ灏忓拰淇℃伅鍖呮姤澶达紝鈥渟endBlobChunkSize鈥濆睘鎬х幇鍦ㄤ笌鈥渕ax_allowed_packet鈥濆瘑鍒囩粨鍚堝湪涓璧凤紝褰搈ax_allowed_packet鐨勫ぇ灏忕被浼间簬榛樿鐨勨渟endBlobChunkSize鈥濇椂锛堜负1MB锛夛紝鑳介伩鍏峆acketTooBigExceptions銆
 
    -CallableStatement.clearParameters()鐜拌兘娓呴櫎涓嶪NOUT/OUTPUT鍙傛暟鍜孖NPUT鍙傛暟鐩稿叧鐨勫睘鎬с
 
    -鏇存浜BUG#12417锛孋onnection.prepareCall()鏄尯鍒嗗ぇ灏忓啓鐨勬暟鎹簱鍚嶇О锛堝湪Windows绯荤粺涓婏級銆
 
    -鏇存浜BUG#12752锛屽浜庣増鏈珮浜4.0.x鐨勬湇鍔″櫒锛孋p1251涓嶆纭湴鏄犲皠鑷硍in1251銆
 
    -鏇存浜BUG#12970锛屼娇鐢―atabaseMetaData.getColumns()鏃讹紝java.sql.Types.OTHER杩斿洖BINARY鍜孷ARBINARY鍒椼
  
    -寮曠敤鍙傛暟绾︽潫鍒楄〃鍓嶏紝ServerPreparedStatement.getBinding()鐜板湪灏嗘鏌ヨ鍙ユ槸鍚﹀凡鍏抽棴锛屼互閬垮厤鎶涘嚭NullPointerException銆
 
    -鏇存浜BUG#13277锛屾棤璁轰綍鏃讹紝褰撹皟鐢ㄩ渶瑕佽繛鎺ュ紩鐢ㄧ殑鏂规硶鏃讹紝鏉ヨ嚜Statement.getGeneratedKeys()鐨凴esultSetMetaData灏嗗鑷碞ullPointerExceptions鐨勬姏鍑恒
 
    -鑷5.0璧凤紝Field绫籖esultSetMetaData.getColumnClassName()鍜孯esultSet.getObject(int)鐨勫弽鍚戠Щ妞嶅嚭鐜颁簡鍙樺寲锛屾洿姝d簡VARCHAR BINARY/VARBINARY鍜岀浉鍏崇被鍨嬫湁鍏崇殑琛屼负銆
 
    -鏇存浜哊ullPointerException锛屽綋鍙傛暟涓篘ULL鏃讹紝鍦ㄥ緢澶欴atabaseMetaDataMethods涓皢鈥渃atalog鈥濆弬鏁拌浆鎹负byte[]鏃跺嚭鐜扮殑寮傚父锛堝浜庣粨鏋滈泦锛夈傦紙鏍规嵁JDBC瑙勮寖锛屼粠鎶鏈搴︿笂涓嶅厑璁糕渘ull鈥濓紝浣嗕粠鍘嗗彶瑙傜偣涓婏紝鎴戜滑鍏佽浣跨敤瀹冿級銆
 
    -浠5.0璧凤紝VAR[BINARY|CHAR] [BINARY]绫诲瀷妫娴嬬殑鍙嶅悜绉绘銆
    
    -鍗充娇鏃犳硶鎵撳紑鏈湴鏂囦欢锛屼篃鑳借鍙朚ysqlIO.sendFileToServer()涓搷搴旓紝鍚﹀垯锛屼笅涓涓彂鍑虹殑鏌ヨ灏嗗け璐ワ紝杩欐槸鍥犱负锛屽畠姝e湪璇诲彇瀵瑰彂閫佽嚦鏈嶅姟鍣ㄧ殑绌篖OAD DATA INFILE淇℃伅鍖呯殑鍝嶅簲銆
 
    -閬垮紑浜BUG#13374锛屽凡鍏抽棴缁撴灉闆嗕笂鐨凴esultSet.getStatement()杩斿洖NULL锛堟寜鐓DBC 4.0瑙勮寖锛屼絾涓嶅叿鏈夊悜鍚庡吋瀹规э級銆傚皢杩炴帴灞炴р渞etainStatementAfterResultSetClose鈥濊涓衡滅湡鈥濓紝浠ヤ究鑳藉鍦ㄩ氳繃.getStatement()鍏抽棴浜嗙粨鏋滈泦鍚庢绱㈢粨鏋滈泦鐨勮鍙ワ紙榛樿涓衡滃亣鈥濅互渚夸笌JDBC鍏煎锛屽苟闄嶄綆浣跨敤JDBC鐨勪唬鐮佸悕娉勬紡璇彞瀹炰緥鐨勬満浼氾級銆
 
    -鏇存浜BUG#13453锛孶RL閰嶇疆鍙傛暟涓嶅厑璁稿湪瀹冧滑鐨勫间腑浣跨敤鈥&鈥濇垨鈥=鈥濄傜幇鍦↗DBC椹卞姩绋嬪簭鑳藉瀵归厤缃弬鏁拌繘琛岀浉搴斿湴瑙f瀽锛屽氨鍍忓畠浠槸浣跨敤application/x-www-form-urlencoded鏍煎紡锛堝湪java.net.URLDecoder涓寚瀹氾紝http://java.sun.com/j2se/1.5.0/docs/api/java/net/URLDecoder.html锛夎繘琛岀紪鐮侀偅鏍枫
 
濡傛灉鍦ㄩ厤缃睘鎬т腑鍑虹幇瀛楃鈥%鈥濓紝鐜板湪蹇呴』鐢ㄢ%25鈥濊〃绀猴紝瀹冩槸浣跨敤鈥渁pplication/x-www-form-urlencoded鈥濈紪鐮佷娇鈥%鈥濈殑宸茬紪鐮佸舰寮忋
 
    -閰嶇疆灞炴р渟essionVariables鈥濈幇鍦ㄥ厑璁镐綘鎸囧畾浠モ淍鈥濈鍙峰紑濮嬬殑鍙橀噺銆
 
    -鏇存浜BUG#13043锛屼负浣庝簬4.1.0鐗堢殑鏈嶅姟鍣ㄥ厑璁镐簡鈥済atherPerfMetrics鈥濇椂锛屽鏋滄煡璇㈡湭浣跨敤浠讳綍琛紝缁撴灉闆嗙殑鏋勯犲嚱鏁板皢鎶涘嚭NullPointerException銆
 
06-23-05锛氱増鏈3.1.10-stable
 
    -鏇存浜嗗洜鏃犳寚瀹氭暟鎹簱鑰屽鑷寸殑MysqlIO.changeDatabaseTo()涓殑寮傚父銆
  
    -棣栨瀹炵幇浜嗙敤浜嶱reparedStatement.getParameterMetadata()鐨凱arameterMetadata銆備粎鑳戒笌CallableStatements涓璧峰畬鍏ㄥ彂鎸ヤ綔鐢紝杩欐槸鍥犱负褰撳墠鐨勬湇鍔″櫒绔澶勭悊璇彞浼氬皢鎵鏈夊弬鏁拌繑鍥炰负VARCHAR绫诲瀷銆
    
06-22-05锛氱増鏈3.1.9-stable
 
    -褰诲簳妫鏌ヤ簡瀛楃闆嗛厤缃紝鐜板湪鎵鏈夌浉鍏抽」鍧囪兘浣嶄簬灞炴ф枃浠朵腑銆
  
    -濡傛灉鍦ㄧ敤浜嶹indows-31J鐨勬湇鍔″櫒涓婂彲鐢紝椹卞姩绋嬪簭鑳芥纭娇鐢–P932锛屼互鍙奀P932鍜孧S932 java缂栫爜鍚嶇О锛屽惁鍒欏皢姹傚姪浜庝粎涓鸿繎浼肩殑SJIS銆傜洰鍓嶏紝浠呭湪MySQL-5.0.3鍜屾洿楂樼増鏈笂锛堜互鍙奙ySQL-4.1.12/13锛屽彇鍐充簬浣曟椂鍙嶅悜绉绘瀛楃闆嗭級锛屾墠鑳藉彲闈犲湴鏀寔浠讳綍CP932鍙樹綋銆
 
    -鏇存浜BUG#9064锛宑om.mysql.jdbc.PreparedStatement.ParseInfo瀵箃oCharArray()鐨勪笉蹇呰璋冪敤銆
 
    -鏇存浜Bug#10144锛屽鏋渟erverPrepare()澶辫触锛孲erverPreparedStatement涓殑鍐呭瓨娉勬紡銆
 
    -灏嗘竻鍗曟枃浠跺疄闄呭啓鍏ユ纭綅缃紝浠ヤ究鍏剁粓姝簬浜岃繘鍒秊ar鏂囦欢銆
 
    -澧炲姞浜嗏渃reateDatabaseIfNotExist鈥濆睘鎬э紙榛樿涓衡滃亣鈥濓級锛岃灞炴т細浣块┍鍔ㄧ▼搴忚姹傛湇鍔″櫒鍒涘缓鍦║RL涓寚瀹氱殑鏁版嵁搴擄紙濡傛灉璇ユ暟鎹簱涓嶅瓨鍦ㄧ殑璇濓級銆傚繀椤绘嫢鏈夋伆褰撶殑鏁版嵁搴撳垱寤烘潈闄愭墠鑳芥墽琛岃浠诲姟銆
 
    -鏇存浜BUG#10156锛屽浜嶳esultSet.getInt()锛屾棤绗﹀彿SMALLINT琚綋浣滃甫绗﹀彿绫诲瀷锛屾洿姝d簡鎵鏈夌殑UNSIGNED鏁存暟鍜屾湇鍔″櫒绔澶勭悊璇彞锛屼互鍙婄敤浜嶶NSIGNED TINYINT鐨凴esultSet.getObject()銆
 
    -鏇存浜BUG#10155锛岃В鏋愬鎴风棰勫鐞嗚鍙ユ椂涓嶈兘璇嗗埆鍙屽紩鍙枫
  
    -浣垮緱enableStreamingResults()鍦╟om.mysql.jdbc.jdbc2.optional.StatementWrapper涓婂彲瑙併
  
    -浣垮緱ServerPreparedStatement.asSql()鑳芥纭伐浣滐紝鑷姩瑙i噴鍔熻兘鍙互涓庢湇鍔″櫒绔澶勭悊璇彞涓璧峰伐浣溿
  
    -浣垮緱鍏煎JDBC2鐨勮蒋浠跺寘鎴愪负鍏叡鍖咃紝浠ヤ究鍏佽璁块棶鍘傚鎵╁睍銆
  
    -鏁寸悊浜嗗墫鏋愬伐鍏蜂簨浠剁殑璁板綍鍔熻兘锛岀Щ鍔ㄤ簡浠g爜浠ュ皢鍓栨瀽宸ュ叿浜嬩欢杞偍涓篶om.mysql.jdbc.log.LogUtils鐨勫瓧绗︿覆锛屼互渚跨涓夋柟鑳藉浣跨敤瀹冦
  
    - DatabaseMetaData.supportsMultipleOpenResults()鐜板湪杩斿洖鈥滅湡鈥濄侱BMD鍒氬垰涓㈠け鏌愪竴鍐呭鏃讹紝椹卞姩绋嬪簭鍦ㄤ竴娈垫椂闂村唴鏀寔瀹冦
  
    -鏇存浜BUG#10310锛岄┍鍔ㄧ▼搴忎笉鏀寔鐢ㄦ潵璋冪敤瀛樺偍绋嬪簭鐨{?=CALL(...)}銆傚叾涓寘鎷紝涓篋atabaseMetaData.getProcedures()鍜実etProcedureColumns()澧炲姞浜嗗嚱鏁版绱㈡敮鎸併
 
    -鏇存浜BUG#10485锛岀敤ResultSet.getString()妫绱EAR(2)鏃舵姏鍑篠QLException銆傜幇鍦紝椹卞姩绋嬪簭鎬绘槸灏哬EAR绫诲瀷褰撲綔java.sql.Dates瀵瑰緟锛屽苟涓篻etString()杩斿洖姝g‘鍊笺
鍙﹀锛屽彲浠ュ皢鈥測earIsDateType鈥濊繛鎺ュ睘鎬ц缃负鈥滃亣鈥濓紝骞跺皢鍊间綔涓篠HORT杩涜澶勭悊銆
  
    -褰撯渢inyInt1isBit=true鈥濇椂锛堥粯璁わ級锛屼娇鐢ㄦ柊鐨勯厤缃睘鎬р渢ransformedBitIsBoolean鈥濓紙榛樿涓衡滃亣鈥濓級锛屽浜嶵INYINT(1)鍒楋紝杩斿洖鐨勬暟鎹被鍨嬪彲鍦═ypes.BOOLEAN鍜孴ypes.BIT涔嬮棿鍒囨崲銆傚鏋滆涓衡滃亣鈥濓紙榛樿锛夛紝瀵逛簬TINYINT(1)鍒楋紝DatabaseMetaData.getColumns()鍜孯esultSetMetaData.getColumnType()灏嗚繑鍥濼ypes.BOOLEAN銆傚鏋滀负鈥滅湡鈥濓紝灏嗚繑鍥濼ypes.BOOLEAN銆傛棤璁鸿閰嶇疆灞炴ф槸濡備綍璁剧疆鐨勶紝濡傛灉鍏佽浜嗏渢inyInt1isBit鈥濓紝鍏锋湁TINYINT(1)绫诲瀷鐨勫垪灏嗕綔涓篟esultSet.getObject(..)鐨刯ava.lang.Boolean瀹炰緥杩斿洖锛岃屼笖ResultSetMetaData.getColumnClassName()灏嗚繑鍥炩渏ava.lang.Boolean鈥濄
 
    -鏇存浜BUG#10496锛屼笌cp932鎴杄ucjpms涓璧蜂娇鐢ㄢ渃haracterSetResults鈥濆睘鎬ф椂灏嗘姏鍑篠QLException銆
 
    -閲嶇粍浜嗙洰褰曟牸灞锛屾簮鐮佺幇浣嶄簬鈥渟rc鈥濇枃浠跺す涓嬶紝鍒涘缓鏃朵笉濉厖鐖剁洰褰曪紝杈撳嚭浣嶄簬鈥./build鈥濅笅锛屽垎鍙戠増浣嶄簬鈥./dist鈥濅笅銆
 
    -杩欑被鏀寔/缂洪櫡璺熻釜鐗规э紝灏嗏渁utoGenerateTestcaseScript鈥濊缃负鈥滅湡鈥濇椂锛岃鐗规ц兘澶熶负STDERR鐢熸垚.sql娴嬭瘯鑴氭湰銆
 
    -鏇存浜BUG#10850锛屼娇鐢ㄦ湇鍔″櫒绔澶勭悊璇彞鏃讹紝涓嶄細灏嗏0闀垮害鈥濇祦鍙戦佺粰鏈嶅姟鍣ㄣ
    
    -鐜板湪锛屽鏋滆缃簡鈥渃achePrepStmts=true鈥濓紝涔熶細浣胯繛鎺ヨ繘琛岄珮閫熺紦鍐叉搷浣滐紝妫鏌ラ┍鍔ㄧ▼搴忕殑鎵ц鎯呭喌锛屼互鍒ゆ柇棰勫鐞嗚鍙ユ槸鍚﹁兘澶熷湪鏈嶅姟鍣ㄧ宸ヤ綔锛屽苟鑳藉湪杩炴帴鐨勭敓鍛芥湡鍐呭鏈嶅姟鍣ㄧ棰勫鐞嗚鍙ヨ繘琛岄珮閫熺紦鍐插鐞嗐備笌浠ュ線涓鏍凤紝鍙傛暟鈥減repStmtCacheSize鈥濊礋璐f帶鍒惰繖浜涢珮閫熺紦鍐插尯鐨勫ぇ灏忋
 
    -杩涜浜嗗皾璇曪紝浠ユ洿涓轰紭缇庣殑鏂瑰紡澶勭悊OutOfMemoryErrors銆傚敖绠℃墍鑳戒綔鐨勪簨鎯呬笉鏄緢澶氾紝浣嗗湪澶у鏁版儏鍐典笅瀹冧滑鑳藉叧闂墍閬囧埌鐨勮繛鎺ワ紝杩欐牱锛岃繘涓姝ョ殑鎿嶄綔涓嶄細杩涘叆鐘舵佷笉鏄庣殑杩炴帴銆傚嚭鐜癘OM鏃讹紝杩炴帴涓婄殑浠讳綍杩涗竴姝ユ搷浣滃潎灏嗗け璐ワ紝鍚屾椂鎶涘嚭鈥滆繛鎺ュ凡鍏抽棴鈥濆紓甯革紝杩樺皢鍒楀嚭浣滀负闅愬紡杩炴帴鍏抽棴浜嬩欢鍘熷洜鐨凮OM寮傚父銆
 
    -濡傛灉鏈姹傦紝鎵ц鏈嶅姟鍣ㄧ棰勫鐞嗚鍙ユ椂涓嶅彂閫丆OM_RESET_STMT銆
 
    -椹卞姩绋嬪簭灏嗘娴嬫槸鍚︽鍦ㄨ繍琛孧ySQL-5.0.7鎴栨洿楂樼増鏈紝鑰屼笖涓嶆壂鎻忔鍦ㄥ鐞嗙殑璇彞涓殑鈥淟IMIT ?[,?]鈥濓紝杩欐槸鍥犱负鐩墠鏈嶅姟鍣ㄦ敮鎸佽繖绫绘煡璇€
 
    -鏇存浜BUG#11115锛屼娇鐢ㄦ湇鍔″櫒绔澶勭悊璇彞鍜孯esultSet.getBytes()鏃讹紝VARBINARY鏁版嵁鍙戠敓宕╂簝
 
    -Connection.setCatalog()鎯冲湪鑳藉璇嗗埆鈥渦seLocalSessionState鈥濋厤缃睘鎬э紝灏嗚灞炴ц涓衡滅湡鈥濇椂锛屽鏋滄墍璇锋眰鐨刢atalog涓庡綋鍓峜atalog鐩稿悓锛屼細闃绘椹卞姩绋嬪簭灏嗏淯SE ...鈥濆彂閫佺粰鏈嶅姟鍣ㄣ
 
    -澧炲姞浜嗕笅杩伴厤缃崋鍖咃紝閫氳繃鈥渦seConfigs鈥濋厤缃睘鎬т娇鐢1涓垨澶氫釜锛
    
  * maxPerformance锛氳冭檻鍚庢灉鏃剁殑鏈澶фц兘
  * solarisMaxPerformance锛歋olaris鐨勯渶鎬ц兘锛屽湪鍙兘鐨勬儏鍐典笅閬垮厤绯荤粺璋冪敤銆
  * 3-0-Compat锛氫笌Connector/J 3.0.x鍔熻兘鍏煎銆
  
    -澧炲姞浜嗏"maintainTimeStats鈥濋厤缃睘鎬э紙榛樿涓衡滅湡鈥濓級锛岀敤浜庨氱煡椹卞姩绋嬪簭鏄惁搴旇窡韪笂娆℃煡璇㈡椂闂达紝浠ュ強涓婃鎴愬姛灏嗕俊鎭寘鍙戦佸埌鏈嶅姟鍣ㄧ殑鏃堕棿銆傚鏋滃皢鍏惰缃负鈥滃亣鈥濓紝灏嗗垹闄ゆ瘡鏌ヨ鐨勪袱娆$郴缁熻皟鐢ㄣ
    
    -鏇存浜BUG#11259锛宎utoReconnect鐨刾ing鎿嶄綔浼氬鑷磋繛鎺ュ惎鍔ㄦ椂鐨勫紓甯搞
 
    -鏇存浜BUG#11360锛孋onnector/J灏嗘煡璇袱娆¤浆鍌ㄥ埌SQLException銆
    
    -鏇存浜哖reparedStatement.setClob()锛屼笉鎺ュ彈Null浣滀负鍙傛暟銆
    
    -鏇存浜BUG#11411锛岀敓浜у寘涓嶅寘鎷JBoss闆嗘垚绫汇
 
 
    -鍒犻櫎浜嗕娇鐢ㄢ渦sage advisor鈥濇椂鏃犳剰涔夌殑鈥滃紑閿鏄傝吹鐨勭被鍨嬭浆鎹⑩濆憡璀︺
 
 
04-14-05锛氱増鏈3.1.8-stable
 
    -鏇存浜咲atabaseMetaData.getTables()锛屾湭瑕佹眰鏃讹紝浠ヨ姹傝〃鐨勭被鍨嬩箣涓杩斿洖瑙嗗浘銆
 
    -鍦5.0.3鍜屾洿楂樼増鏈殑MySQL涓紝澧炲姞浜嗗鏂扮簿搴︽暟瀛ECIMAL绫诲瀷鐨勬敮鎸併
 
    -鏇存浜哛esultSet.getTime()锛屼綔鐢ㄤ簬鏈嶅姟鍣ㄧ棰勫鐞嗚鍙ョ殑Null鍊间笂鏃舵姏鍑篘PE銆   -浣緾onnection.ping()鎴愪负public鏂规硶銆   -鏇存浜Bug#8868锛孌ATE_FORMAT()鏌ヨ浠巊etObject()杩斿洖BLOB銆   - ServerPreparedStatements鐜板湪鑳芥纭湴灏咮LOB/CLOB鏁版嵁浠モ滄祦鏂瑰紡鈥濆彂閫佽嚦鏈嶅姟鍣ㄣ備綘鍙互浣跨敤灞炴р渂lobSendChunkSize鈥濋厤缃▼搴忓潡澶у皬鐨勯槇鍊硷紙榛樿鍊间负1MB锛夈
 
    -鐢熸垚棰勫鐞嗚鍙ユ椂锛孊lobFromLocator鐜板湪鑳戒娇鐢ㄦ纭殑ID寮曠敤銆
 
    -浣跨敤杩炴帴灞炴р渟essionVariables鈥濈殑閫楀彿鍒嗛殧鍒楄〃鏂瑰紡浼犻掑畠浠紝鑳藉鍦ㄨ繛鎺ユ椂棰勫厛璁剧疆鏈嶅姟鍣ㄧ浼氳瘽鍙橀噺銆
 
    -涓轰娇鐢ㄢ渁utoReconnect=true鈥濈殑鐢ㄦ埛鏇存浜唒ing()涓殑鍥炲綊闂銆
 
    -鏇存浜BUG#9040锛孭reparedStatement.addBatch()涓嶈兘涓庢湇鍔″櫒绔澶勭悊璇彞鍜屾祦寮廈INARY鏁版嵁涓璧峰伐浣溿
 
    -鏇存浜BUG#8800锛屽浜庤繍琛屼簬鍖哄垎澶у皬鍐欑殑鏂囦欢绯荤粺涓婄殑鏈嶅姟鍣紝DBMD.supportsMixedCase*Identifiers()杩斿洖閿欒鍊笺
 
    -鏇存浜BUG#9206锛屽浜巆haracterSetResults閰嶇疆灞炴э紝涓嶈兘浣跨敤鈥淯TF-8鈥濄
 
    -鏇存浜BUG#9236锛岃繛缁BUG#8868锛屽湪鏌ヨ涓娇鐢ㄤ簡澶氫釜鍑芥暟锛屾煡璇㈡湰搴旇繑鍥為潪瀛楃涓茬被鍨嬶紝浣嗗綋涓存椂琛ㄨВ鏋愬畠浠椂锛岃繑鍥炵被鍨嬬獊鐒跺彉涓洪毦浠ョ悊瑙g殑浜岃繘鍒跺瓧绗︿覆锛堥拡瀵规湇鍔″櫒闄愬埗閲囧彇浜嗙浉搴旂殑閬胯鎺柦锛夈傛澶栵紝杩樻洿姝d簡绫诲瀷涓篊HAR(n) CHARACTER SET BINARY鐨勫瓧娈碉紝浣垮叾鑳藉涓篟SMD.getColumnClassName()鍜孯esultSet.getObject()杩斿洖姝g‘锛忓尮閰嶇殑绫汇
 
    -鏇存浜BUG#8792锛屽浜庘滀粎姝e悜/鍙鈥濈粨鏋滈泦锛堟垜浠敮鎸佽鏂瑰紡锛夛紝DBMD.supportsResultSetConcurrency()鏈繑鍥炩滅湡鈥濄
 
    -鏇存浜BUG#8803锛岃闂椂锛孌BMD.getBestRowIdentifier()鐨勨淒ATA_TYPE鈥濆垪瀵艰嚧ArrayIndexOutOfBoundsException锛堜簨瀹炰笂锛屾湭杩斿洖浠讳綍鍊硷級銆
 
    -妫鏌ヤ簡灏哻har/varchar鍒楁暟鎹浆鎹负鏁板兼椂鐨勭┖瀛楃涓('')锛屽鏋滈厤缃睘鎬р渆mptyStringsConvertToZero鈥濊璁句负鈥滃亣鈥濓紝鎶涘嚭寮傚父锛堜负浜嗕笌3.0鐗堢殑鍚戝悗鍏煎锛岄粯璁ゆ儏鍐典笅锛屽皢鍏惰涓衡滅湡鈥濓紝浣嗗湪3.2鐗堜腑锛屾渶鍙兘鐨勯粯璁よ缃负鈥滃亣鈥濓級銆
 
    -鏇存浜BUG#9320锛屽湪鐗瑰畾鏉′欢涓嬶紝褰撴湭浣跨敤鏈嶅姟鍣ㄧ棰勫鐞嗚鍙ユ椂锛孭reparedStatement.getMetaData()鍦ㄦ暟鎹簱涓彃鍏ヤ簡绌虹櫧琛屻
 
    -Connection.canHandleAsPreparedStatement()鐜板湪灏嗗敖鈥滄渶澶у姫鍔涒濇潵璇嗗埆甯︽湁鍗犱綅绗︾殑LIMIT瀛愬彞锛岀洰鐨勫湪浜庯紝瀵逛簬鏈嶅姟鍣ㄧ洰鍓嶄笉鑳藉皢鍏跺綋浣滄湇鍔″櫒绔澶勭悊璇彞浜堜互澶勭悊鐨勮鍙ワ紝涓哄叾鐢熸垚澶勭悊鎺柦鏃讹紝鑾峰緱杈冨皯鐨勯敊璇偗瀹氱粨鏋溿
 
    -鏇存浜哹uild.xml锛屽鏋渓og4j涓嶅彲鐢紝涓嶇紪璇憀og4j鏃ュ織鍔熻兘銆
 
    -澧炲姞浜嗗c3p0杩炴帴姹犵殑锛http://c3p0.sf.net/锛夐獙璇/杩炴帴妫楠屽櫒鎺ュ彛鐨勬敮鎸侊紝濡傛灉鏈嶅姟鍣ㄥ彲鐢紝璇ユ楠屽櫒鎺ュ彛灏嗕娇鐢ㄨ交鍨嬧淐OM_PING鈥濊皟鐢ㄣ傝鎯充娇鐢ㄥ畠锛岃閰嶇疆c3p0杩炴帴鎸佺殑鈥渃onnectionTesterClassName鈥濆睘鎬э紝浠ヤ娇鐢ㄢ渃om.mysql.jdbc.integration.c3p0.MysqlConnectionTester鈥濄
 
    -鏇村ソ鐨勬娴嬪紩鐢ㄥ瓧绗︿覆鐨勫唴澶朙IMIT锛屼互渚块┍鍔ㄧ▼搴忚兘鏇村姞姝g‘鍦板垽鏂槸鍚﹀彲浠ュ湪鏈嶅姟鍣ㄤ笂澶勭悊棰勫鐞嗚鍙ャ
 
    -鏇存浜BUG#9319锛屽綋椹卞姩绋嬪簭璇曞浘纭畾鍙傛暟璁℃暟/绫诲瀷鏃讹紝鍒嗕笉娓呬笉鍚屾暟鎹簱涓叿鏈夌浉鍚屽悕绉扮殑瀛樺偍绋嬪簭銆
 
    -涓篟esultSet鍜孲tatement瀹炴柦澧炲姞浜嗘渶缁堢‘瀹氬櫒锛屼互渚夸笌JDBC瑙勮寖鍏煎锛岃瑙勮寖瑕佹眰锛屽鏋滃畠浠湭鏄庣‘鍏抽棴锛屽湪鏃犵敤鍗曞厓鏀堕泦闃舵搴斿叧闂繖浜涜祫婧愩
 
    -鏇存浜BUG#9682锛屽浜庡叿鏈塂ECIMAL鍙傛暟鍜屽瓨鍌ㄨ姹傜殑瀛樺偍绋嬪簭锛屽鏋滃寘鍚,鈥濓紝灏嗗け璐ャ
 
    - PreparedStatement.setObject(int, Object, int type, int scale)鐜板湪鑳戒娇鐢ㄩ拡瀵笲igDecimal瀹炰緥鐨勬爣搴﹀笺
 
    -鏇存浜BUG#9704锛屽綋宸叉湁缁撴灉闆嗘槸.close()d鏃讹紝Statement.getMoreResults()鍙兘鎶涘嚭NPE銆
 
    -鎬ц兘搴﹂噺鐗规х幇鑳芥敹闆嗗叧浜嶴ELECT涓紩鐢ㄧ殑琛ㄦ暟閲忕殑淇℃伅銆
 
    -鐜板湪鑳藉鑷姩閰嶇疆鏃ュ織绯荤粺銆傚鏋滅敤鎴烽氳繃URL灞炴р渓ogger鈥濇垨绯荤粺灞炴р渃om.mysql.jdbc.logger鈥濊缃簡鍊硷紝閭d箞灏嗕娇鐢ㄧ敤鎴风殑璁剧疆锛屽惁鍒欏皢閲囩敤涓嬭堪姝ラ鑷姩妫娴嬭缃細
 
   濡傛灉Log4j鍙敤锛屽皢浣跨敤瀹冿紝鎺ヤ笅鏉ユ槸JDK1.4鏃ュ織鍔熻兘锛屽啀鎺ヤ笅鏉ユ槸STDERR鏃ュ織鍔熻兘銆
 
    -鏇存浜BUG#9778锛屽嵆浣挎暟鎹簱鐗堟湰涓嶆敮鎸佽鍥撅紝濡傛灉璇锋眰浜嗚鍥撅紝DBMD.getTables()涓嶅簲杩斿洖琛ㄣ
 
    -鏇存浜嗛┍鍔ㄧ▼搴忥紝褰撳湪鏈嶅姟鍣ㄧ棰勫鐞嗚鍙ヨ繑鍥炵殑缁撴灉闆嗕笂璋冪敤浜哛esultSet.getBoolean()鏃讹紝瀵逛簬鈥-1鈥濅笉杩斿洖鈥滅湡鈥濄
 
    -涓.jar鏂囦欢澧炲姞浜哅anifest.MF鏂囦欢浠ュ強瀹炴柦淇℃伅銆
 
    -鍦‵ield.isOpaqueBinary()涓彁渚涗簡鏇村娴嬭瘯锛屼互璇嗗埆鏅︽订鐨勪簩杩涘埗瀛楁锛堝嵆鍏锋湁CHAR(n)鍜孋HARACTER SET BINARY绫诲瀷鐨勫瓧娈碉級锛岃繖绫诲瓧娈垫潵鑷悇绉嶆爣閲忓嚱鏁板拰鑱氬悎鍑芥暟锛堣繑鍥炲瓧绗︿覆锛夌殑杈撳嚭銆
 
    -鏇存浜BUG#9917锛屽嚭浜庝紶缁熸柟闈㈢殑鑰冭檻锛屽嵆浣垮畠涓嶫DBC涓嶅吋瀹癸紝涔熷簲鎺ュ彈DBMD鏂规硶涓敤浜巆atalog锛堜娇鐢ㄥ綋鍓嶅硷級鐨凬ull銆傚皢杩炴帴灞炴р渘ullCatalogMeansCurrent鈥濊缃负鈥滃亣鈥濆彲绂佹瀹冿紙鍦–/J 3.2.x涓紝瀹冩槸榛樿璁剧疆锛夈
 
    -鏇存浜BUG#9769锛屽嚭浜庝紶缁熸柟闈㈢殑鑰冭檻锛屽嵆浣垮畠涓嶫DBC涓嶅吋瀹癸紝涔熷簲鎺ュ彈DBMD涓敤浜庡悕绉帮紙鈥%鈥濓級鐨凬ull銆傚皢杩炴帴灞炴р渘ullNamePatternMatchesAll鈥濊缃负鈥滃亣鈥濆彲绂佹瀹冿紙鍦–/J 3.2.x涓紝瀹冩槸榛樿璁剧疆锛夈
 
02-18-05锛氱増鏈3.1.7-stable
 
    -鏇存浜BUG#7686锛孴imestamp鍏抽敭瀛楀垪鏁版嵁闇瑕佸垎绂荤殑鈥淿binary鈥濓紝鐢ㄤ簬UpdatableResultSet.refreshRow()銆
 
    -鏇存浜BUG#7715锛屽浜庢湇鍔″櫒绔澶勭悊璇彞鍜屽彲鏇存柊缁撴灉闆嗭紝Timestamps閿欒鍦拌浆鎹负瀛楃涓层
 
    -妫娴嬪瓧绗︿覆琛ㄥ崟锛堜互鍓嶄负鏁存暟锛変腑鐨剆ql_mode鍙橀噺锛屽苟鎭板綋璋冩暣瀛楃涓茬殑寮曠敤鏂规硶銆
 
    -澧炲姞浜嗏渉oldResultsOpenOverStatementClose鈥濆睘鎬э紙榛樿涓衡滃亣鈥濓級锛屽畠鑳藉皢statement.close()鐨勭粨鏋滈泦淇濇寔鎵撳紑鐘舵侊紝鎴栨墽琛岀浉鍚岃鍙ワ紙鐢盞evin Burton鎺ㄨ崘锛夈
 
    -鏇存浜BUG#7952锛屽湪鏁呴殰鍒囨崲閰嶇疆涓嬪洖閫鑷充富杩炴帴鏃剁殑鏃犻檺閫掑綊銆
 
    -濡傛灉鍏佽浜嗛珮閫熺紦鍐诧紝灏嗙姝4.1.10鐗堜箣鍓峂ySQL-4.1鐗堟湰鐨勫璇彞鍔熻兘锛堝鏋滀互鍏佽鐨勮瘽锛夛紝杩欐槸鍥犱负鍦ㄨ閰嶇疆涓嬶紝鏈嶅姟鍣ㄤ細杩斿洖閿欒鐨勭粨鏋溿
 
    -鏇存浜哻onfigureClientCharset()涓殑閲嶅浠g爜锛岃绫讳唬鐮佸皢闃绘useOldUTF8Behavior=true鐨勬伆褰撹繍琛屻
 
    -鍒犻櫎浜嗏渄ontUnpackBinaryResults鈥濆姛鑳斤紝鐜板湪锛岄┍鍔ㄧ▼搴忓皢鎸夊師鏍蜂繚瀛樻潵鑷湇鍔″櫒绔澶勭悊璇彞鐨勭粨鏋滐紙涓庢湇鍔″櫒鎻愪緵鐨勭浉鍚岋紝骞跺湪闇瑕佹椂灞曞紑锛夈
 
    -鏇存浜BUG#8096锛屼娇鐢ㄦ湇鍔″櫒绔澶勭悊璇彞鏃讹紝妯℃嫙瀹氫綅鍣ㄧ牬鍧忎簡浜岃繘鍒舵暟鎹
 
    -鏇存浜哠erverPreparedStatement.serverPrepare()鐨勫悓姝ヤ簨瀹滐紝濡傛灉鍦ㄥ涓嚎绋嬮棿鍏变韩杩炴帴锛屽彲鑳戒細瀵艰嚧姝婚攣/宕╂簝銆
 
    -榛樿鎯呭喌涓嬶紝椹卞姩绋嬪簭鑳介氳繃鍚勭Connection.prepareStatement()鐨勫悇绉嶅彉浣撴壂鎻廠QL锛屼互鍒ゆ柇瀹冩槸鍚︽槸鑳藉鍦ㄦ湇鍔″櫒绔敮鎸佺殑璇彞绫诲瀷锛屽鏋滀笉琚湇鍔″櫒绔敮鎸侊紝浼氬皢鍏朵綔涓哄鎴风妯℃嫙棰勫鐞嗚鍙ヨ繘琛屽鐞嗭紙BUG#4718)锛夈涔熷彲浠ラ氳繃鍦↗DBC URL涓紶閫掆emulateUnsupportedPstmts=false鈥濈姝㈣鐗规с
 
    -浠嶤allableStatement涓垹闄や簡鐢ㄤ綔杈撳叆锛忚緭鍑哄弬鏁扮殑鈥淿binary鈥濆紩浠嬭瘝銆
 
    -瀵逛簬娉ㄥ唽涓*BINARY鐨勮緭鍑哄弬鏁帮紝鎬昏繑鍥瀊yte[]銆
 
    -瀵逛簬PreparedStatement.setObject(n, "true", Types.BIT)锛屽皢甯冨皵鈥淭rue鈥濈殑姝g‘鍊煎彂閫佺粰鏈嶅姟鍣ㄣ
 
    -鏇存浜嗕笌杩炴帴鏈夊叧鐨勭己闄凤紝褰撹鍙ヤ笉鏄湇鍔″櫒绔澶勭悊璇彞鏃讹紝鏃犳硶瀵规潵鑷猵repareStatement()鐨勮鍙ヨ繘琛岄珮閫熺紦鍐插鐞嗐
 
    -浣跨敤ResultSet.get(..., cal)鍜孭reparedStatement.set(...., cal)鏃讹紝濡傛灉瀹㈡埛绔拰鏈嶅姟鍣ㄥ潎浣嶄簬GMT锛堟牸鏋楀▉娌绘爣鍑嗘椂闂达級鏃跺尯锛岄夋嫨杩涜鏃堕棿璋冩暣鐨勬纭柟鍚戙
 
    -澧炲姞浜嗏渄ontTrackOpenResources鈥濋夐」锛堥粯璁や负鈥滃亣鈥濅互渚垮吋瀹笿DBC锛夛紝瀵逛簬鍏锋湁涓嶈壇鐗规х殑搴旂敤绋嬪簭锛堜緥濡傚簲鍏抽棴璇彞鏃讹紝鍗存湭鍏抽棴璇彞鐨勫簲鐢ㄧ▼搴忥級锛屽畠鏈夊姪浜庢敼鍠勫唴瀛樼殑浣跨敤銆
 
    -鏇存浜BUG#8428锛孯esultSet.getString()涓嶈兘淇濇寔瀛樺偍鍦ㄦ湇鍔″櫒涓婄殑鏍煎紡锛屼粎褰撳皢鈥渘oDatetimeStringSync鈥濆睘鎬ц缃负鈥滅湡鈥濓紙榛樿涓衡滃亣鈥濓級鏃讹紝鎵嶈兘鍏佽缂洪櫡鏇存銆
 
    -鏇存浜嗕娇鐢ㄢ渦sage advisor鈥濊屼笖缁撴灉闆嗗凡鍏抽棴鏃禦esultSet.realClose()涓殑NPE銆
 
    -鏇存浜BUG#8487锛屼笉鍒涘缓娴佸紡缁撴灉闆嗙殑PreparedStatements銆
 
    -涓嶅皢NULL浼犵粰缁橰esultSet.getNativeConvertToString()涓殑String.valueOf()锛屽師鍥犲湪浜嶴tring.valueOf()浼氬鍏惰繘琛屽瓧绗︿覆澶勭悊锛堝嵆杩斿洖鈥渘ull鈥濓級,瀵逛簬鎵杩版柟娉曪紝杩欐槸閿欒鐨勩
 
    -鏇存浜BUG#8484锛屽綋闇瑕佽垗鍏ユ搷浣滀互璁惧畾鏍囧害鏃讹紝ResultSet.getBigDecimal()鎶涘嚭寮傚父銆傚鏋滈潪鑸嶅叆鎬igDecimal.setScale()澶辫触锛岄┍鍔ㄧ▼搴忕幇鍦ㄥ皢閫夋嫨鈥滃崐鍚戜笂鈥濊垗鍏ユā寮忋
 
    -澧炲姞浜嗏渦seLocalSessionState鈥濋厤缃睘鎬э紝灏嗗叾璁剧疆涓衡滅湡鈥濇椂锛孞DBC椹卞姩绋嬪簭灏嗚涓哄簲鐢ㄧ▼搴忚涓鸿壇濂斤紝骞朵細浣跨敤java.sql.Connection鎻愪緵鐨勬柟娉曚粎璁剧疆autocommit鍜屼簨鍔¢殧绂荤骇鍒紝鍥犳锛岃兘澶熷湪澶у鏁版儏鍐典笅澶勭悊杩欎簺鍊硷紝鑰屼笉寮曞彂鏁版嵁搴撴湇鍔″櫒寰幆銆
 
    -涓鸿繛鎺ユ睜瀹炴柦瀹炰緥鐨勮鍙ュ鍔犱簡enableStreamingResults()锛屽彲妫鏌tatement.setFetchSize()鏄惁瀛樺湪鍏煎瑙勮寖鐨勫笺傝皟鐢ㄢ淪tatement.setFetchSize(>=0)鈥濆彲绂佹鍏充簬璇ヨ鍙ョ殑娴佸紡缁撴灉銆
 
    -澧炲姞浜嗗MySQL-5.0.3涓瑽IT绫诲瀷鐨勬敮鎸併傞┍鍔ㄧ▼搴忎細灏咮IT(1-8)褰撲綔JDBC鐨凚IT绫诲瀷瀵瑰緟锛堟槧灏勮嚦java.lang.Boolean锛夛紝杩欐槸鍥犱负褰撳0鏄庝簡鈥< 9 bits鈥)鏃讹紝鏈嶅姟鍣ㄧ洰鍓嶄笉浼氬彂閫佽兘纭畾姣旂壒瀛楁锛坆itfield锛夊ぇ灏忕殑瓒冲淇℃伅銆侭IT(>9)灏嗚褰撲綔VARBINARY瀵瑰緟锛屽苟褰撹皟鐢╣etObject()鏃惰繑鍥瀊yte[]銆
 
12-23-04锛氱増鏈3.1.6-stable
 
    -鏇存浜哠ocketInputStream.read()鐨勬寕璧烽棶棰橈紝褰撻┍鍔ㄧ▼搴忓繀椤荤洿鎺ユ埅鍙栫粨鏋滈泦锛岃屼笉鏄窡韪粨鏋滈泦鏈熬鐨勨淟IMIT n鈥濇椂锛屼笌Statement.setMaxRows()鍜屽涓粨鏋滈泦涓璧蜂娇鐢ㄦ椂SocketInputStream.read()鎸傝捣銆
 
    -鏇存浜BUG#7026锛孌BMD.getProcedures()涓嶈冭檻catalog鍙傛暟銆
 
12-02-04锛氱増鏈3.1.5-gamma
 
    -鏇存浜嗗瓧绗︿覆甯告暟鍜屽姩鎬佸瓧绗︿覆涔嬮棿鐨勬瘮杈冧簨瀹滐紝鎴栨槸toUpperCase()d鎴栨槸toLowerCase()d锛屼互浣跨敤Locale.ENGLISH锛屽皢鍏剁敤浣滆嫳璇殑瑕嗙洊瑙勫垯銆傛澶栵紝杩樹娇鐢⊿tringUtils.indexOfIgnoreCase()鏇夸唬浜.toUpperCase().indexOf()锛屼互閬垮厤鍒涘缓寰堢煭鐨勮繃娓℃у瓧绗︿覆瀹炰緥銆
 
    -鏇存浜BUG#5235锛屾湇鍔″櫒绔澶勭悊璇彞涓嶈冭檻鈥渮eroDateTimeBehavior鈥濆睘鎬э紝鑰屼笖褰撲娇鐢≧esultSet.getObject()鏃朵細瀵艰嚧绫绘姏寮冨紓甯革紝杩欐槸鍥犱负鎬昏繑鍥炲叏0瀛楃涓层
 
    -鏇存浜嗘壒鏇存柊鍜屾湇鍔″櫒棰勫鐞嗚鍙ユ湁鍏崇殑闂锛屼笌浠ュ墠鐨勯泦鍚堢浉姣旓紝濡傛灉鍦ㄧ粰瀹氱殑鎵瑰弬鏁伴泦鍚堜腑鍙戠敓浜嗙被鍨嬪彉鏇达紝鏈嶅姟鍣ㄩ澶勭悊璇彞涓嶄細妫娴嬭繖绫诲彉鍖栵紝浠庤屽鑷存湇鍔″櫒杩斿洖閿欒鈥淲rong arguments to mysql_stmt_execute()鈥濄
 
    -瑙e喅浜嗗綋鏃堕棿鎴崇殑瀛楃涓茶〃绀哄寘鍚悗缂鈥.鈥濅絾鍏跺悗娌℃湁鏁板瓧鏃剁殑鎯呭喌銆
 
    -鏇存浜BUG#5706锛屽ResultSet.getNativeString()涓互鍓嶅瓨鍦ㄥ瓧绗︿覆瀹炰緥鐨勪綆鏁堟娴嬨
 
    -涓嶆姏鍑洪拡瀵笴onnection.releaseSavepoint()鐨勫紓甯搞
 
    -瑙g爜鏉ヨ嚜ServerPreparedStatements鐨勬棩鏈熸椂锛岄粯璁ゆ儏鍐典笅浣跨敤鎸変細璇濊繘琛岀殑鏃ュ巻瀹炰緥锛堥氳繃璁剧疆鈥渄ynamicCalendars=true鈥濓紝璁剧疆涓烘棭鏈熺殑鎬ц兘杈冧綆鐨勬柟寮忥級銆
 
    -澧炲姞浜嗗疄楠屾ч厤缃睘鎬р渄ontUnpackBinaryResults鈥濓紝瀹冨欢杩熶簡瑙e寘浜岃繘鍒剁粨鏋滈泦鍙栧肩殑鍔熻兘锛岀洿鑷宠姹備簡瀹冧滑涓烘锛堥粯璁ゆ儏鍐典笅璁句负鈥滃亣鈥濓級銆傚浜庢煇浜泆secase/jvm缁勫悎锛屽畠瀵规棤鐢ㄤ俊鎭敹闆嗗櫒鏇村弸濂姐
 
    -鏇存浜BUG#5729锛屽鏉ヨ嚜鏈嶅姟鍣ㄧ棰勫鐞嗚鍙ョ粨鏋滈泦鐨刄NSIGNED BIGINT锛屾湭鑳芥纭В鍖呫
 
    -鏇存浜BUG#6225锛孲erverSidePreparedStatement锛屽垎閰嶄簡涓嶅繀瑕佺殑鍏锋湁鐭敓瀛樻椂闂寸殑瀵硅薄銆
 
    -鍒犻櫎浜哛esultSet鏋勯犲嚱鏁颁腑鏈夊鐨勬柊Throwable()锛屽師鍥犲湪浜庝笉鑹悎骞讹紙瀵艰嚧浠讳綍鎵鍒涘缓缁撴灉闆嗘案杩滀笉浼氫娇鐢ㄧ殑鏂板璞★級锛屽垎鏋BUG#6359鏃跺彂鐜般
 
    -鏇存浜嗗湪EscapeProcessor.escapeSQL()涓繃鏃╁垱寤篠tringBuffer鐨勯棶棰橈紝鑰屼笖鍦ㄤ笉闇瑕佽浆涔夊姛鑳芥椂浠嶈繑鍥炲瓧绗︿覆锛堥槻姝笉蹇呰鐨勫璞″垎閰嶏級銆傚垎鏋BUG#6359鏃跺彂鐜般
 
    -涓哄彲鏇存柊缁撴灉闆嗕腑鐨勯敭姣旇緝浣跨敤鈥渘ull-safe-equals鈥濄
 
    -鏇存浜BUG#6537锛屽鏋滈渶瑕0濉厖锛屼綔鐢ㄥ湪Decimal涓婄殑SUM()浠ュ強鏈嶅姟鍣ㄧ棰勫鐞嗚鍙ュ潎灏嗗拷鐣ユ爣搴︼紙鐢变簬鏈嶅姟鍣ㄥ皢鍏惰浆鎹负DOUBLE锛0濉厖灏嗙粨鏉燂紝灏嗗叾杞崲涓築igDecimal绫诲瀷鐨勫瓧绗︿覆杩涜瑙f瀽鏃讹紝涓㈠け鎵鏈夌殑濉厖鈥0鈥濓級銆
 
    -鍒涘缓DBMD鏌ヨ鏃朵娇鐢―atabaseMetaData.getIdentifierQuoteString()銆
 
    -濡傛灉鍦ㄦ湇鍔″櫒涓奓OAD DATA LOCAL INFILE灏忎簬鈥渕ax_allowed_packet鈥濓紝浣跨敤1MB鐨勪俊鎭寘鍙戦佹枃浠躲
 
    -鏇存浜BUG#6399锛屽浜庡瀛楄妭瀛楃闆嗭紝ResultSetMetaData.getColumnDisplaySize()杩斿洖閿欒鍊笺
 
    -閫氳繃鈥渁utoDeserialize鈥濆睘鎬э紙榛樿涓衡滃亣鈥濓級锛岃兘澶熷淇濆瓨鍦˙LOB涓殑java.lang.Objects鐨勮嚜鍔ㄤ覆骞惰浆鎹㈠姛鑳借繘琛岄厤缃
 
    -淇敼浜咶ield.isOpaqueBinary()浠ユ娴嬧淐HAR(n) CHARACTER SET BINARY鈥濓紝浠庤岃兘澶熸敮鎸佺敤浜嶳esultSet.getObject()鐨勫浐瀹氶暱搴︿簩杩涘埗瀛楁銆
 
    -浣跨敤鎴戜滑鑷繁鐨勭紦鍐茶緭鍏ユ祦瀹炴柦鏂瑰紡鏉ュ鐞唈ava.io.BufferedInputStream鐨勫皝闂涓恒備娇鐢ㄢ渦seReadAheadInput=false鈥濆彲绂佹瀹冦
 
    -鏇存浜BUG#6348锛屽綋缁欏畾涓绘満鍚嶇殑鏌愪竴鍦板潃鏄疘PV6鏃舵棤娉曡繛鎺ュ埌鏈嶅姟鍣紙鏈嶅姟鍣ㄥ皻鏈笌IPV6鎹嗙粦锛 椹卞姩绋嬪簭鐜板湪鑳藉鏌ユ壘缁欏畾涓绘満鐨勬墍鏈塈P鍦板潃锛屽苟鍋滃湪鎺ュ彈socket.connect()鐨勭1涓湴鍧涓娿
 
09-04-04锛氱増鏈3.1.4-beta
 
    -鏇存浜BUG#4510锛孋onnector/j 3.1.3 beta涓嶈兘姝g‘澶勭悊鏁存暟锛堢敱涓轰簡鏀寔Buffer.readInt() -> Buffer.readShort()涓殑鏃犵鍙疯鍙栨搷浣滄墍浣滅殑鏇存敼鑰屽鑷达級銆
 
    -鍦―atabaseMetaData.getTables()鍜実etTableTypes()涓鍔犱簡瀵筕IEW鐨勬敮鎸侊紝璇ョ被鐗规х幇宸插湪MySQL鏈嶅姟鍣5.0.x鐗堜腑鎻愪緵銆
 
    -鏇存浜BUG#4642锛岃В鍖呭瓧娈靛厓鏁版嵁鏃讹紝ServerPreparedStatement.execute*()鏈夋椂浼氭姏鍑篈rrayIndexOutOfBoundsException銆
 
    -浼樺寲浜嗘暣鏁拌В鏋愬姛鑳斤紝閫氳繃鈥渦seFastIntParsing=false鈥濆睘鎬э紝鍏佽浣跨敤JDK绫昏緝鎱㈢殑瑙f瀽鍔熻兘銆
 
    -澧炲姞浜嗏渦seOnlyServerErrorMessages鈥濆睘鎬э紝瀹冧細浣挎湇鍔″櫒鐢熸垚鐨勫紓甯镐腑鐨勬秷鎭枃鏈粎鍖呭惈鐢辨湇鍔″櫒鍙戦佺殑鏂囨湰锛堜笌SQLState鈥滄爣鍑嗏濅粙缁嶄腑缁欏嚭鐨勭浉鍙嶏紝姝ゆ椂鏂囨湰鍚庨潰杩樺寘鎷湇鍔″櫒鐨勯敊璇秷鎭級銆傞粯璁ゆ儏鍐典笅锛岃灞炴ц璁剧疆涓衡滅湡鈥濄
 
    -鏇存浜BUG#4689锛屽鏋滃墠闈㈢殑Null宸茶杩斿洖锛屽浜庡師璇紝ResultSet.wasNull()涓嶅伐浣溿
 
    -濡傛灉鈥渆nablePacketDebug=true鈥濓紝璺熻釜淇℃伅鍖呯殑搴忓垪鍙凤紝濡傛灉鏀跺埌鐨勪俊鎭寘娆″簭娣蜂贡锛屾姏鍑哄紓甯搞
 
    -鏇存浜BUG#4482锛屼娇鐢ㄩ澶勭悊璇彞鏃讹紝瀵逛簬瀛楃涓诧紝ResultSet.getObject()杩斿洖閿欒绫诲瀷銆
 
    -涓ゆ璋冪敤MysqlPooledConnection.close()锛堣櫧鐒朵篃鏄簲鐢ㄧ▼搴忛敊璇級浼氬鑷碞PE銆傚凡鏇存銆
 
    -鏇存浜BUG#5012锛屽鐞咲ECIMAL绫诲瀷鐨勮繑鍥炲肩殑ServerPreparedStatements涓嶅伐浣溿
 
    -鏇存浜BUG#5032锛屽浜庢潵鑷4.1.x鐗堥澶勭悊璇彞鐨勪吉浣嶇被鍨嬶紝ResultSet.getObject()涓嶈繑鍥炲竷灏旂被鍨嬶紙鍦ㄩ拡瀵逛吉浣嶇被鍨嬬殑getObject()涓娇鐢ㄤ簩杩涘埗缂栫爜鐨勭粨鏋滈泦妯$硦娴嬭瘯鏃讹紝瀹冩彁渚涗簡閬垮厤棰濆绫诲瀷杞崲鐨勫揩鎹锋柟寮忥級銆
 
    -鐜板湪鑳藉鍦ㄢ淟OAD DATA LOCAL INFILE鈥濊鍙ヤ腑浣跨敤URL锛岃屼笖椹卞姩绋嬪簭灏嗕娇鐢↗ava鐨勫唴缃鐞嗙▼搴忔潵妫绱㈡暟鎹紝骞跺皢鍏跺彂閫佸埌鏈嶅姟鍣ㄣ傞粯璁ゆ儏鍐典笅涓嶅厑璁歌鐗规э紝瑕佹兂浣跨敤瀹冿紝蹇呴』灏嗏渁llowUrlInLocalInfile鈥濊繛鎺ュ睘鎬ц缃负鈥滅湡鈥濄
 
    -瀵逛簬鍦≧esultSet.get*()鐨勬暟鍊间笂鎵ц鐨勬埅鍙栨搷浣滐紝椹卞姩绋嬪簭灏嗘洿鍔犱弗鏍硷紝鑰屼笖褰撴娴嬪埌鎴彇鎿嶄綔鏃跺皢鎶涘嚭SQLException銆傚皢鈥渏dbcCompliantTruncation鈥濊缃负鈥滃亣鈥濓紝鍙互绂佹璇ュ姛鑳斤紙鍦ㄩ粯璁ゆ儏鍐典笅鍏佽璇ュ姛鑳斤紝杩欐槸鍥犱负璇ュ姛鑳芥槸鍏煎JDBC鎵闇鐨勶級銆
 
    -浠庣粨鏋滈泦璇诲彇鈥滃叏闆垛濇棩鏈熸椂闂村兼椂锛屽鍔犱簡涓夌澶勭悊瀹冧滑鐨勬柟娉曪紝鈥渆xception鈥濓紝锛堥粯璁ゅ硷級锛岀敤浠g爜涓衡淪1009鈥濈殑SQLState鎶涘嚭SQLException锛涒渃onvertToNull鈥濓紝杩斿洖NULL鑰屼笉鏄暟鎹紱浠ュ強鈥渞ound鈥濓紝瀵规棩鏈熻繘琛岃垗鍏ュ鐞嗭紝浣夸箣鎴愪负鏈鎺ヨ繎鐨勫硷紝鍗斥0001-01-01鈥濄
 
    -鏇存浜哠erverPreparedStatement锛屼娇涔嬭兘澶熲滀互鑴辩嚎鈥濇柟寮忚鍙栭澶勭悊璇彞鍏冩暟鎹紝灏界鍦ㄧ洰鍓嶅畠鏄彇浠e湪浠讳綍鏃朵警鍧囦笉宸ヤ綔鐨凪ysqlIO.clearInputStream()鐨勫崰浣嶇锛屼箣鎵浠ュ姝わ紝鏄洜涓虹洰鍓嶅皻鏈粠鏈嶅姟鍣ㄨ鍙栨暟鎹傞氳繃鎶涘嚭ArrayIndexOutOfBoundExceptions鐨別rverPreparedStatements锛屽畠淇浜嗙敤鎴烽亣鍒扮殑鍋跺彂鎬ч敊璇
 
    -鍔犺浇璧勬簮鎹嗗寘鏃朵娇鐢╟om.mysql.jdbc.Message鐨勭被鍔犺浇鍣紝搴旇兘鏇存璋冪敤鍣ㄧ殑绫诲姞杞藉櫒涓嶈兘纭畾璧勬簮鎹嗗寘浣嶇疆鏃跺嚭鐜扮殑鍋跺彂鎬ч敊璇
 
07-07-04锛氱増鏈3.1.3-beta
 
    -瀵笴allableStatements鐨勮緭鍑哄弬鏁板悕杩涜Mangle澶勭悊锛屼娇寰楀湪涓庣敤鎴峰彉閲忓悕涓璧蜂娇鐢ㄦ椂锛岃繖绫诲悕绉颁笉浼氬穿婧冦
 
    -澧炲姞浜嗗CallableStatements涓璉NPUT鍙傛暟鐨勬敮鎸併
 
    -鏇存浜BUG#4119锛屼负鏈嶅姟鍣ㄧ棰勫鐞嗚鍙ュ彂閫佺殑null姣旂壒鎺╃爜涓嶆纭
 
    -榛樿鎯呭喌涓嬩娇鐢⊿QL鐨勬爣鍑哠QL鐘舵侊紝闄ら潪灏嗏渦seSqlStateCodes鈥濆睘鎬ц缃负鈥滃亣鈥濄
 
    -澧炲姞浜嗕俊鎭寘璋冭瘯浠g爜锛堣鍙傝鈥渆nablePacketDebug鈥濆睘鎬ф枃妗o級銆
 
    -涓篗ySQL閿欒缂栧彿澧炲姞浜嗗父閲忥紙鍙叕鍏辫闂紝璇峰弬瑙乧om.mysql.jdbc.MysqlErrorNumbers锛夛紝骞跺鍔犱簡鐢熸垚鏄犲皠鐨勮兘鍔涳紝鑳藉灏嗗巶瀹朵唬鐮佹槧灏勪负椹卞姩绋嬪簭浣跨敤鐨凷QLStates锛堝嚭浜庢枃妗g紪鍒剁洰鐨勶級銆
 
    -浣挎洿澶氭秷鎭洿涓哄叿浣擄紙姝e湪鍔姏锛夈
 
    -鏇存浜BUG#4311锛屽湪妫绱㈠叿鏈夐澶勭悊璇彞鍜屼簩杩涘埗鍗忚鐗规х殑mediumint鍒楁椂鍙戠敓閿欒銆
 
    -褰撯渦seTimezone=true鈥濇椂锛屽湪MySQL-4.1.3涓敮鎸佹柊鐨勬椂鍖哄彉閲忋
 
    -鏀寔鏃犵鍙锋暟鍊间綔涓洪澶勭悊璇彞杩斿洖鐨勭被鍨嬨傚浜庘渂igint unsigned鈥濈被鍨嬶紝杩欎篃浼氬鑷碦esultSet.getObject()涓殑鍐呭鍙戠敓鍙樺寲锛屸渂igint unsigned鈥濈被鍨嬬敤浜庤繑鍥濨igDecimal瀹炰緥锛岀幇鍦ㄥ畠灏嗚繑鍥瀓ava.lang.BigInteger瀹炰緥銆
 
06-09-04锛氱増鏈3.1.2-alpha
 
    鏇存浜嗕负鍙傛暟锛堝char(), varchar()锛夋寚瀹氬ぇ灏忔椂瀛樺偍绋嬪簭鍙傛暟鐨勮В鏋愪俊鎭
 
    -閫氳繃鈥渃acheCallableStmts鈥濆睘鎬э紝鍏佽瀵瑰彲璋冪敤璇彞杩涜楂橀熺紦鍐插鐞嗐
 
    -鏇存浜嗕笅杩伴棶棰橈細鏈负瀛樺偍绋嬪簭鎸囧畾杈撳嚭鍙傛暟鏃讹紝鍙戝嚭铏氬亣鏌ヨ鏉ユ绱㈣緭鍑哄弬鏁帮紝浠庤屽鑷存湇鍔″櫒璇硶閿欒銆
 
    -鏇存浜嗗湪CallableStatement.setOutputParameters()涓病鏈変换浣曞弬鏁颁細瀵艰嚧NullPointerException鐨勯棶棰樸
 
    -鍒犻櫎浜哅ysqlIO.changeUser()涓殑寮傚父鎹嗗寘銆
 
    -鏇存浜嗗叧浜庡彂閫佸ぇ鍨嬫煡璇㈠垎绂讳俊鎭寘鏂归潰鐨勯棶棰橈紝涔熷厑璁稿彂閫佸ぇ淇℃伅鍖呯殑nio鍔熻兘銆
 
    -涓篠erverPreparedStatement澧炲姞浜.toString()鍔熻兘锛屽鏋滀綘姝e湪璋冭瘯浣滀负棰勫鐞嗚鍙ワ紙鏄剧ず涓烘湇鍔″櫒搴斿鐞嗙殑SQL锛夌殑鏌ヨ锛屽畠搴旀湁鎵甯姪銆
 
    -澧炲姞浜嗏済atherPerformanceMetrics鈥濆睘鎬э紝浠ュ強鐢ㄤ簬鎺у埗鍦ㄤ綍鏃/浣曞璁板綍杩欑被淇℃伅鐨勫绉嶅睘鎬э紙鏇村淇℃伅璇峰弬瑙佺浉鍏虫枃妗o級銆
 
    -璋冪敤.close()鏃讹紝ServerPreparedStatements瀹為檯涓婁笉鑳藉彇娑堝鏈嶅姟鍣ㄧ璧勬簮鐨勫垎閰嶃
 
    -澧炲姞浜嗏渓ogSlowQueries鈥濆睘鎬э紝浠ュ強鈥渟lowQueriesThresholdMillis鈥濆睘鎬э紝浠ユ帶鍒跺簲鍦ㄤ綍鏃跺皢鏌ヨ瑙嗕负鈥滅紦鎱⑩濄
 
    -鐩稿浜巖egisterOutParameter()涓殣鍚殑椤哄簭锛屾纭湴灏嗚緭鍑哄弬鏁版槧灏勫埌prepareCall()涓粰瀹氱殑浣嶇疆锛岋紱鏇存浜BUG#3146
 
    -瀵逛簬鐗堟湰绛変簬楂樹簬4.1.0鐨勬湇鍔″櫒锛岃兘姝g‘鍦版娴嬪瓧绗﹂泦銆
 
    -鏁寸悊浜嗘湇鍔″櫒灞炴х殑妫娴嬪姛鑳姐
 
    -瀵逛簬鐗堟湰绛変簬楂樹簬4.1.2鐨勬湇鍔″櫒锛屾敮鎸佺敤浜庡弬鏁板厓鏁版嵁鐨勫崰浣嶇銆
 
    -鏇存浜BUG#3539锛実etProcedures()鏈繑鍥炵粨鏋滈泦涓殑浠讳綍杩涚▼銆
 
    -鏇存浜BUG#3540锛実etProcedureColumns()涓嶈兘涓庣▼搴忓悕鐨勯氶厤绗︿竴璧蜂娇鐢ㄣ
 
    -鏇存浜BUG#3520锛孌BMD.getSQLStateType()杩斿洖涓嶆纭殑鍊笺
 
    -澧炲姞浜嗏渃onnectionCollation鈥濆睘鎬э紝濡傛灉缁欏畾瀛楃闆嗙殑榛樿鏍″涓嶆伆褰擄紝椹卞姩绋嬪簭灏嗗湪杩炴帴鍒濆杩囩▼涓彂鍑衡渟et collation_connection=...鈥濇煡璇€
 
    -鏇存浜嗗湪MySQL-5.0.0涓婅繍琛屾椂鐨凞atabaseMetaData.getProcedures()闂锛堝湪5.0.1鍜5.0.0闂达紝鈥渟how procedure status鈥濈殑杈撳嚭鏈夋墍涓嶅悓锛夈
 
    -鏇存浜BUG#3804锛実etWarnings()杩斿洖SQLWarning鑰屼笉鏄疍ataTruncation銆
 
    -瀵逛簬鐗堟湰涓5.0.0鎴5.0.1鐨勬湇鍔″櫒锛屼笉瑕佸惎鐢ㄦ湇鍔″櫒绔澶勭悊璇彞锛岃繖鏄洜涓猴紝瀹冧滑涓庨┍鍔ㄧ▼搴忎娇鐢ㄧ殑鈥4.1.2+鈥濋鏍间笉鍏煎锛堥┍鍔ㄧ▼搴忛璁¤繑鍥炵殑淇℃伅骞朵笉瀛樺湪锛屽洜鑰屾寕璧凤級銆
 
02-14-04锛氱増鏈3.1.1-alpha
 
    -鏇存浜嗕笌涓嶄娇鐢ㄥ鎴风棰勫鐞嗚鍙ョ殑UpdatableResultSets鏈夊叧鐨勭己闄枫
 
    -褰揗ySQL涓嶆彁渚涘瓧绗﹂泦骞跺皢JVM璁剧疆涓哄瀛楄妭缂栫爜鏃讹紝鏇存浜嗗皢瀛楄妭杞崲涓篈SCII鏃剁殑瀛楃缂栫爜浜嬪疁锛堥氬父浼氬奖鍝嶆暟鍊兼绱級銆
 
    -灏嗘湇鍔″櫒棰勫鐞嗚鍙ョ殑鈥滄湭鐭モ濇暟鎹被鍨嬭В鍖呬负瀛楃涓层
 
    -涓烘湇鍔″櫒棰勫鐞嗚鍙ュ疄鐜颁簡闀挎暟鎹被鍨嬶紙Blob銆丆lob銆両nputStreams銆丷eaders锛夈
 
    -涓篗ySQL-4.1鍜屾洿楂樼増鏈疄鐜颁簡Statement.getWarnings()锛堜娇鐢ㄢ淪HOW WARNINGS鈥濓級銆
 
    -榛樿缁撴灉闆嗙被鍨嬫洿鏀逛负TYPE_FORWARD_ONLY锛堝吋瀹笿DBC锛夈
 
    - 缁撴灉闆嗙被鍨嬪拰骞跺彂鎬х殑闆嗕腑璁剧疆銆
 
    -鍐嶆纭畾浜嗚繛鎺ュ睘鎬х殑璁剧疆鏂瑰紡鍜屾樉绀轰负DriverPropertyInfo鐨勬柟寮忥紝浠ュ強Connection鍜孌ataSource灞炴с
 
    -鏀寔NIO銆傚湪鏀寔NIO鐨勫钩鍙颁笂浣跨敤鈥渦seNIO=true鈥濄
 
    -鏀寔SAVEPOINTs锛圡ySQL >= 4.0.14鎴4.1.1锛夈
 
    -鏀寔鈥渕ysql_change_user()...鈥濓紝璇峰弬瑙佲渃om.mysql.jdbc.Connection鈥濅腑鐨刢hangeUser()鏂规硶銆
 
    -鍑忓皯浜嗗钩鍧囨煡璇腑璋冪敤鐨勬柟娉曟暟鐩紝浣夸箣鏇存湁鏁堢巼銆
 
    -鑷姩鍐嶈繛鎺ユ椂閲嶆柊澶勭悊棰勫鐞嗚鍙ャ備换浣曢亣鍒扮殑閿欒鍧囪寤惰繜锛岀洿鑷抽娆″皾璇曞啀鎵ц缁忚繃閲嶆柊澶勭悊鐨勮鍙ヤ负姝€
 
    -鎸夌収JDBC瑙勮寖锛岀‘淇濆湪棰勫鐞嗚鍙ヤ笂鎵ц鏌ヨ鍓嶇粰鍑虹殑璀﹀憡鏄槑纭殑锛堢洰鍓嶏紝鎴戜滑鏀寔璀﹀憡鍔熻兘锛夈
 
    -鍦–onnectionProperties涓紝鏀寔鈥滄棫鐨勨漰rofileSql澶у啓鐗规с傝灞炴у凡鍙楀埌鍐疯惤锛屽簲灏介噺浣跨敤鈥減rofileSQL鈥濄
 
    -浼樺寲浜咮uffer.readLenByteArray()锛屼互渚垮綋闀垮害涓0鏃惰繑鍥炲叡浜殑绌哄瓧鑺傛暟缁勩
 
    -鍦ㄥ.execute*()鐨勫娆¤皟鐢ㄤ箣闂达紝鍏佽淇濈暀PreparedStatement.setBlob()鐨勫唴瀹广
 
    -澶勭悊浜咵scapeProcessor涓殑0闀垮害浠ょ墝锛堢敱鍙皟鐢ㄨ鍙ヨ浆涔夎娉曞鑷达級銆
 
    -鍦║pdatableResultSet涓殑鍒犻櫎锛忔洿鏂帮紡鎻掑叆琛屾搷浣滀笂锛屾鏌ュ叧闂殑杩炴帴銆
 
    -鏇存浜嗘鏌pdatableResultSet涓殑鎵鏈変富閿椂瀵硅〃鍒悕鐨勬敮鎸佷簨瀹溿
 
    -鍒犻櫎浜唘seFastDates杩炴帴灞炴с
 
    -瀵规潵鑷狫NDI Refs鐨勬暟鎹簮灞炴ц繘琛屼簡姝g‘鐨勫垵濮嬪寲锛屽寘鎷槑纭寚瀹氱殑URL銆
 
    -瀵逛簬鐗堟湰涓5.0.0鎴栨洿楂樼殑MySQL锛孌atabaseMetaData鐜板湪鑳介氭姤supportsStoredProcedures()銆
 
    -鏇存浜咰onnection.prepareCall()涓殑鍫嗘爤婧㈠嚭闂锛堜笉鑹悎骞讹級銆
 
    -瀵逛綆浜1.4鐗堢殑JDK锛屾洿姝d簡瀵笵ateTimeValue涓瑿alendar.getTimeInMillis()鐨処llegalAccessError锛堥潪娉曡闂敊璇級銆
 
    -鏇存浜BUG#1673锛屽浜庨潪鈥%鈥濆垪鍚嶏紝DatabaseMetaData.getColumns()鏈繑鍥炴纭殑鍒楅『搴忎俊鎭
 
    -鍚堝苟浜嗘暟鎹被鍨嬫槧灏勭殑鏇存浜嬮」锛屼粠MySQL绫诲瀷鈥淔LOAT鈥濆埌java.sql.Types.REAL锛堣嚜3.0鐗堣捣锛夌殑鏁版嵁绫诲瀷鏄犲皠銆
 
    -妫娴嬬敤浜嶳SMD.isCaseSensitive()鐨勫垪鏍″銆
 
    -鏇存浜嗕笌鍙戦佸ぇ浜16M鏌ヨ鏈夊叧鐨勯棶棰樸
 
    -涓篊allableStatement澧炲姞浜嗗懡鍚嶅拰绱㈠紩寮忚緭鍏ワ紡杈撳嚭鍙傛暟鏀寔銆
MySQL-5.0.x鎴栨洿楂樼増鏈
 
    -鏇存浜哠erverPreparedStatement.setTimestamp()涓殑NullPointerException锛屼互鍙奡erverPreparedStatement.setTimestamp()銆乻etDate()涓殑骞存湀宸紓銆
 
    -涓篵uild.xml涓殑涓鑷存у拰閫掑綊/鍗曞厓娴嬭瘯澧炲姞浜嗘嫢鏈夊涓暟鎹簱/JVM鐩爣鐨勮兘鍔涖
 
    -鏇存浜嗚闂甋erverPreparedStatements鍜屽叾缁撴灉闆嗕腑鏌愪簺鏃ユ湡鏃堕棿鍔熻兘鏃剁殑NPE鍜屼笉鑹勾鏈堣浆鎹㈤棶棰樸
 
    -鏄剧ず鍏抽棴杩炴帴鐨勪綅缃拰鍘熷洜锛堢敤浜庡府鍔╄皟璇曪級銆
 
    -瀹炵幇浜咰ommunicationsException锛屽畠鑳藉皾璇曞垽鏂笌鏈嶅姟鍣ㄥけ鍘婚氫俊鐨勫師鍥狅紝骞惰兘鍦ㄨ皟鐢.getMessage()鏃舵樉绀哄彲鑳界殑鍘熷洜銆
 
    -鏇存浜BUG#2359锛屼簩杩涘埗缂栫爜缁撴灉闆嗕腑鏁板肩被鍨嬬殑NULL鍊间細瀵艰嚧NullPointerExceptions銆
 
    -瀹炵幇浜咰onnection.prepareCall()锛孌atabaseMetaData.getProcedures()锛屼互鍙奼etProcedureColumns()銆
 
    -璋冪敤clearParameters()鏃讹紝閫氳繃鍙戦丆OM_RESET_STMT鑷虫湇鍔″櫒锛屽浣嶄簡ServerPreparedStatement涓殑鈥渓ong binary鈥濆弬鏁般
 
    -鑷3.0鐗堣捣锛屽悎骞朵簡棰勫鐞嗚鍙ラ珮閫熺紦鍐插拰.getMetaData()鏀寔銆
 
    -瑙e寘鏉ヨ嚜鏈嶅姟鍣ㄧ棰勫鐞嗚鍙ョ殑缁撴灉鏃讹紝鍦ㄦ煇浜涙儏鍐典笅锛屽浜嶵imeUtil.fastDate/TimeCreate()鐨勫勾浠斤紝浼氬嚭鐜皁ff-by-1900閿欒锛屾洿姝d簡璇ラ敊璇
 
    -鏇存浜BUG#2502锛実etTables()涓殑瀛楃闆嗚浆鎹簨瀹溿
 
    -瀹炵幇浜嗙敱璇彞鎴栧瓨鍌ㄧ▼搴忚繑鍥炵殑澶氫釜缁撴灉闆嗐
 
    -鏇存浜BUG#2606锛屾湇鍔″櫒绔澶勭悊璇彞鏈纭繑鍥炴暟鎹被鍨嬧淵EAR鈥濄
 
    -鍏佽瀵规潵鑷湇鍔″櫒绔澶勭悊璇彞鐨勭粨鏋滈泦杩涜娴佸鐞嗐
 
    -鏇存浜BUG#2623锛屼娇鐢ㄦ粴鍔ㄧ粨鏋滈泦鍜屾湇鍔″櫒绔澶勭悊璇彞鏃跺嚭鐜扮被鑸嶅純寮傚父銆
 
    -鑷3.0鐗堣捣锛屽悎骞朵簡鏃犵紦鍐茶緭鍏ヤ唬鐮併
 
    -鏇存浜嗕笉鑳介氳繃瀛樺彇鍣ㄦ伆褰撴樉绀虹殑ConnectionProperties锛屽苟鏁寸悊浜咰onnectionProperties浠g爜銆
 
    -鏇存浜BUG#2671锛屽湪鏈嶅姟鍣ㄧ棰勫鐞嗚鍙ヤ腑锛屽湪浠讳綍鎯呭喌涓嬪潎涓嶈兘姝g‘缂栫爜NULL瀛楁銆
 
    -鏇存浜嗗皢鏁板瓧鍐欏叆缂撳啿浠ュ彂閫侀澶勭悊璇彞鎵ц璇锋眰鏃跺嚭鐜扮殑缃曡缂撳啿鍖轰笅婧㈤棶棰樸
 
    -瀵逛簬浜や粯鐨勯┍鍔ㄧ▼搴忥紝浣跨敤浜嗘枃妗g殑DocBook鐗堛
 
02-18-03锛氱増鏈3.1.0-alpha
 
    -澧炲姞浜嗏渞equireSSL鈥濆睘鎬с
 
    -澧炲姞浜嗏渦seServerPrepStmts鈥濆睘鎬э紙榛樿涓衡滃亣鈥濓級銆傚綋鏈嶅姟鍣ㄧ増鏈敮鎸佸苟灏嗚灞炴ц缃负鈥滅湡鈥濇椂锛4.1鍜屾洿楂樼増鏈級锛岄┍鍔ㄧ▼搴忓皢浣跨敤鏈嶅姟鍣ㄧ棰勫鐞嗚鍙ャ傜洰鍓嶅叾榛樿璁剧疆涓衡滃亣鈥濓紝闄ら潪鎵鏈夌殑鎹嗙粦锛忚幏鍙栧姛鑳藉潎宸插疄鏂姐傜洰鍓嶏紝浠呬负4.1鐗堢殑鏈嶅姟鍣ㄧ棰勫鐞嗚鍙ュ疄鐜颁簡DML棰勫鐞嗚鍙ャ
 
    -璺熻釜鎵撳紑鐨勮鍙ワ紝骞跺湪璋冪敤Connection.close()鏃跺叧闂墍鏈夋墦寮鐨勮鍙ワ紙JDBC鍏煎锛夈
 
06-23-05锛氱増鏈3.0.17-ga
 
    -鏇存浜BUG#5874锛屽綋useTimeZone='true'鑰屼笖鏈嶅姟鍣ㄦ椂鍖轰笉鍚屼簬瀹㈡埛绔椂鍖烘椂锛孴imestamp/Time杞崲鍑虹幇鏂瑰悜閿欒銆
 
    -鏇存浜BUG#7081锛孌atabaseMetaData.getIndexInfo()蹇界暐鈥滃敮涓鈥濆弬鏁般
 
    -鏀寔鏂扮殑鍗忚绫诲瀷鈥淢YSQL_TYPE_VARCHAR鈥濄
 
    -澧炲姞浜嗏渦seOldUTF8Behavoior鈥濋厤缃睘鎬э紝杩炴帴鍒癕ySQL-4.1鎴栨洿楂樼増鏈笖瀛楃缂栫爜涓衡渦tf-8鈥濇椂锛岃灞炴ц兘浣縅DBC椹卞姩绋嬪簭鐨勮涓烘柟寮忕被浼间簬鍦∕ySQL-4.0.x鍜屾洿鏃╃増鏈笅鐨勮涓烘柟寮忋
 
    -鏇存浜BUG#7316锛岃皟鐢╣etConnection()鏃讹紝浠庤繛鎺ユ睜鍒涘缓鐨勮鍙ヨ繑鍥炲疄闄呰繛鎺ヨ屼笉鏄昏緫杩炴帴銆
 
    -鏇存浜BUG#7033锛屽湪闈欐丼QL瀛楃涓蹭腑锛孭reparedStatements涓嶈兘姝g‘缂栫爜Big5锛堜互鍙婂叾浠栧瀛楄妭锛夊瓧绗﹂泦銆
 
    -鏇存浜BUG#6966锛屽惎鍔ㄤ簡鏁呴殰鍒囨崲鐨勮繛鎺ワ紙鐢变簬涓昏繛鎺ュけ璐ワ級浠庝笉鍐嶆灏濊瘯涓昏繛鎺ャ
 
    -鏇存浜BUG#7061锛孭reparedStatement.fixDecimalExponent()澧炲姞棰濆鈥+鈥濓紝浣垮緱MySQL鏈嶅姟鍣ㄦ棤娉曡В鏋愭暟鍊笺
 
    -鏇存浜BUG#7686锛孴imestamp鍏抽敭瀛楀垪鏁版嵁闇瑕佸垎绂荤殑鈥淿binary鈥濓紝鐢ㄤ簬UpdatableResultSet.refreshRow()銆
 
    -鍙嶅悜绉绘浜嗘潵鑷狢onnector/J 3.1鐨凷QLState浠g爜鏄犲皠锛屼娇鐢ㄨ繛鎺ュ睘鎬р渦seSqlStateCodes=true鈥濆彲鍚敤瀹冿紝鍦ㄦ湰鐗堟湰涓粯璁や负鈥滃亣鈥濓紝浠ュ厤鐮村潖浼犵粺搴旂敤绋嬪簭锛堝浜嶤onnector/J 3.1锛岄粯璁や负鈥滅湡鈥濓級銆
 
    -鏇存浜BUG#7061锛孭reparedStatement.fixDecimalExponent()澧炲姞棰濆鈥+鈥濓紝浣垮緱MySQL鏈嶅姟鍣ㄦ棤娉曡В鏋愭暟鍊笺
 
    -杞箟搴忓垪{fn convert(..., type)}鐜板湪鏀寔鐢盨QL棰勫厛璁惧畾鐨凮DBC绫诲瀷銆
 
    -鏇存浜哻onfigureClientCharset()涓殑閲嶅浠g爜锛岃绫讳唬鐮佸皢闃绘useOldUTF8Behavior=true鐨勬伆褰撹繍琛屻
 
    -閫氳繃鏇存琛屾暟璁℃暟鍣ㄧ殑鐜粫寮忓鐞嗙▼搴忥紝鑳芥纭鐞嗗ぇ浜20浜胯鐨勬祦寮忕粨鏋滈泦銆
 
    -鏇存浜BUG#7607锛孧S932銆丼HIFT_JIS鍜學indows_31J涓嶆帴鍙楅拡瀵箂jis鐨勫埆鍚嶃
 
    -鏇存浜BUG#6549锛堟洿姝#7607鐨勫悓鏃讹級锛屼负sjis澧炲姞浜咰P943鍒悕銆
 
    -鏇存浜BUG#8064锛屼笌棰勫鐞嗚鍙ヤ竴璧蜂娇鐢ㄥ瀛楄妭瀛楃闆嗘椂锛岃姹傚浜岃繘鍒舵暟鎹繘琛屽崄鍏繘鍒惰浆涔夊鐞嗐
 
    -鏇存浜BUG#8812锛孌BMD.getIndexInfo()鐨凬ON_UNIQUE鍒楄繑鍥炲掔疆鍊笺
 
    -瑙e喅浜嗘湇鍔″櫒BUG#9098锛屾棤娉曞皢DATE/TIME/TIMESTAMP/TIMESTAMP鍒桟URRENT_*鐨勯粯璁ゅ间笌鈥滃瓧绗︿覆鈥濆煎尯鍒紑锛屽洜姝わ紝鎻掑叆榛樿鍊兼椂锛孶pdatableResultSet.moveToInsertRow()浼氱敓鎴愪笉鑹殑SQL銆
 
    -鏇存浜BUG#8629锛屽皢鈥淓UCKR鈥濅綔涓衡淪ET NAMES euc_kr鈥濆彂閫侊紝MySQL-4.1浠ュ強鏇撮珮鐗堟湰涓嶈兘鐞嗚В璇ョ壒鎬с
 
    -鏍规嵁鏈嶅姟鍣ㄧ殑鐗堟湰锛孌atabaseMetaData.supportsSelectForUpdate()杩斿洖姝g‘鍊笺
 
    -瀵逛簬鍚埆鍚峎indows-31J銆丆P934銆丮S932鐨勫弻瀛楄妭瀛楃闆嗭紝瀵逛簬PreparedStatement.setBytes()锛岄噰鐢ㄥ崄鍏繘鍒惰浆涔夌壒鎬с
 
    -澧炲姞浜嗗鈥淓UC_JP_Solaris鈥濆瓧绗︾紪鐮佺殑鏀寔锛屾槧灏勫埌鈥渆ucjpms鈥濈殑MySQL缂栫爜锛堜粠3.1鐗堝紑濮嬬殑鍙嶅悜绉绘锛夈傚畠鍙兘鍦ㄦ敮鎸乪ucjpms鐨勬湇鍔″櫒灞卞伐浣滐紝涔熷氨鏄5.0.3鎴栨洿楂樼増鏈
 
11-15-04锛氱増鏈3.0.16-ga
 
    -杩炴帴鑷矼ySQL-4.1鎴栨洿楂樼増鏈笖鍐嶆浣跨敤杩炴帴姹犲拰锛忔垨Connection.changeUser()鏃讹紝灏嗗啀娆″彂鍑哄瓧绗﹂泦閰嶇疆鍛戒护銆
 
    -鏇存浜哛esultSetMetaData.isReadOnly()锛屼互渚垮湪杩炴帴鑷矼ySQL-4.1鎴栨洿楂樼増鏈椂锛岃兘鏍规嵁鈥滃師濮嬬殑鈥濊〃鍚嶅拰鍒楀悕锛屾娴嬩笉鍙啓鐨勫垪銆
 
    -鏇存浜BUG#5664锛屽綋ResultSet.updateByte()浣嶄簬鎻掑叆琛屼笂鏃舵姏鍑篈rrayOutOfBoundsException銆
 
    -鏇存浜咲atabaseMetaData.getTypes()锛屽浜嶯UMERIC绫诲瀷锛屽畠杩斿洖涓嶆纭殑锛堥潪璐燂級鏍囧害銆
 
    -鏇存浜BUG#6198锛孊uffer.readString(string)涓殑鈥渙ff-by-one鈥濋棶棰樸
 
    -閫氳繃鈥渢inyInt1isBit鈥濆睘鎬э紝浣垮緱鑳藉瀵筎INYINT(1) -> BIT/Boolean杞崲杩涜閰嶇疆锛堜负浜嗕笌JDBC鍏煎锛岄粯璁や负鈥滅湡鈥濓級銆
 
    -濡傛灉鏈嶅姟鍣ㄧ増鏈ぇ浜庣瓑浜4.1.1锛屽湪杩炴帴寤虹珛杩囩▼涓粎璁剧疆鈥渃haracter_set_results鈥濄
 
    -鏇存浜嗗洖褰掗棶棰橈紝鍏朵腑锛寀seUnbufferedInput榛樿涓衡滃亣鈥濄
 
    -鏇存浜BUG#6231锛孯esultSet.getTimestamp()浣滅敤鍦ㄥ叿鏈塗IME鐨勫垪涓婃椂澶辫触銆
 
09-04-04锛氱増鏈3.0.15-production
 
    -鏇存浜BUG#4010锛屽浜嶨BK锛孲tringUtils.escapeEasternUnicodeByteStream浠嶈鐮村潖銆
 
    -鏇存浜BUG#4334锛屽浜巃utoReconnect鐨勬晠闅滃垏鎹紝瀵逛换浣曚富鏈哄潎涓嶄娇鐢ㄧ鍙b#鈥濓紝鑰屼笖涓嶉噸璇曟墍鏈変富鏈恒傦紙璀﹀憡锛氶渶瑕佹洿鏀筍ocketFactory connect()鏂规硶鐨勭壒寰侊紝瀹冪洰鍓嶆槸鍏叡濂楁帴瀛楄繛鎺ワ紙String host锛宨nt portNumber锛孭roperties props锛夈備篃鑳芥锛屽繀椤绘洿鏀逛换浣曠涓夋柟濂楁帴瀛楀疄鏂芥柟寮忎互鏀寔璇ョ壒寰併
 
    -褰撳畠浠凡琚叧闂苟琚繑鍥炲埌杩炴帴姹犳椂锛岀敱MysqlConnectionPoolDataSource鍒涘缓鐨勯昏緫杩炴帴灏嗗彂鍑簉ollback()銆傚鏋滀綘鐨勫簲鐢ㄦ湇鍔″櫒/杩炴帴姹犲凡甯姪浣犲畬鎴愪簡璇ヤ换鍔★紝鍙互灏嗏渞ollbackOnPooledClose鈥濆睘鎬ц缃负鈥滃亣鈥濅互閬垮厤棰濆鐨剅ollback()寮閿銆
 
    -鍒犻櫎浜嗙粨鏋滈泦涓checkRowPos()鐨勫浣欒皟鐢ㄣ
 
    -鏇存浜BUG#4742锛屽湪DBMD.getTypeInfo()涓紝鈥淒OUBLE鈥濇槧灏勪簡涓ゆ銆
 
    -澧炲姞浜咶LOSS璁稿彲璞佸厤銆
 
    -鏇存浜BUG#4808锛屽湪PooledConnection涓婅皟鐢ㄤ袱娆.close()灏嗗鑷碞PE銆
 
    -鏇存浜BUG#4138BUG#4860锛屽浜庢棤绗﹀彿鍒楋紝DBMD.getColumns()杩斿洖閿欒鐨凧DBC绫诲瀷銆傝繖涔熶細褰卞搷瀵筊SMD.getColumnType()鍜孯SMD.getColumnTypeNames()鏂规硶涓墍鏈夋暟鍊肩被鍨嬬殑绫诲瀷鏄犲皠锛屼互纭繚DBMD.getColumns()鐨勭被浼肩被鍨嬩笌RSMD.getColumnType()鍜孯SMD.getColumnTypeNames()杩斿洖鐨勭被鍨嬪尮閰嶃
 
    -鍒嗗彂鐗堝懡鍚嶆柟妗堜腑鐨勨淧roduction鈥-鈥淕A鈥濄
 
    -鏇存浜BUG#4880锛屽浜庨潪鏁板肩被鍨嬶紝RSMD.getPrecision()杩斿洖0锛堝浜庨潪浜岃繘鍒剁被鍨嬶紝搴旇繑鍥炲瓧绗︾殑鏈澶ч暱搴︼紝瀵逛簬浜岃繘鍒剁被鍨嬶紝搴旇繑鍥炴渶澶у瓧鑺傞暱搴︼級銆傛牴鎹湇鍔″櫒鍙戝洖鐨勯暱搴︼紙鍦ㄧ綉缁滃崗璁眰锛屾湇鍔″櫒涓嶅尯鍒員INYBLOB銆丅LOB銆丮EDIUMBLOB鎴朙ONGBLOB锛夛紝瀹冭繕鏇存浜嗛拡瀵笲LOB绫诲瀷鐨凴SMD.getColumnType()鍜孯SMD.getColumnTypeName()鏄犲皠銆
 
    -鏇存浜BUG#5022锛岀粨鏋滈泦搴斿湪鈥.close()鈥濅腑閲婃斁Field[]瀹炰緥銆
 
    -鏇存浜BUG#5069锛屽鏋滅粨鏋滈泦宸插叧闂紝ResultSet.getMetaData()涓嶅簲杩斿洖鏈纭垵濮嬪寲鐨勫厓鏁版嵁锛岃屾槸搴旀姏鍑篠QLException銆傛澶栵紝鍦ㄥ瀹炰緥绾у埆鐨勫瓧娈碉紙.close()杩囩▼涓彇娑堢殑瀛楁锛夎繘琛屾搷浣滀箣鍓嶏紝閫氳繃璋冪敤checkClosed()锛屽畠杩樻洿姝d簡getRow()銆乬etWarnings()鍜岄亶鍘嗘柟娉曘
 
    -浠4.1.x鐗堟湇鍔″櫒寮濮嬶紝鑳借В鏋愭柊鐨勬椂鍖哄彉閲忋
 
    -涓嶮ySQL-4.1.x鎴栨洿楂樼増鏈繛鎺ユ椂锛屼负PreparedStatement.setBytes()鍜宻et*Stream()浣跨敤鈥淿binary鈥濆紩浠嬭瘝锛屼互闃叉鍦ㄥ瓧绗﹂泦杞崲杩囩▼涓嚭鐜伴敊璇垽鏂
 
05-28-04锛氱増鏈3.0.14-production
 
    -鏇存浜哢RL瑙f瀽閿欒銆
 
05-27-04锛氱増鏈3.0.13-production
 
    -鏇存浜BUG#3848锛屾棤鏈嶅姟鍣ㄥ悕绉版椂锛屼笉鑳戒娇鐢∕ySQLDatasource銆
 
    -鏇存浜BUG#3920锛屼娇鐢∕ysqlConnectionPoolDataSource鏃跺嚭鐜扳淣o Database Selected鈥濓紙鏈夋嫨鏁版嵁搴擄級銆
 
    -鏇存浜BUG#3873锛屽浜庢壒鎻掑叆锛孭reparedStatement.getGeneratedKeys()鏂规硶浠呰繑鍥1涓粨鏋溿
 
05-18-04锛氱増鏈3.0.12-production
 
    -涓篢YPE_NAME鍒椾腑鐨凞atabaseMetaData.getColumns()杈撳嚭澧炲姞浜嗘棤绗﹀彿灞炴с
 
    -澧炲姞浜嗏渇ailOverReadOnly鈥濆睘鎬э紝鍏佽鏈缁堢敤鎴烽厤缃嚭鐜版晠闅滃垏鎹㈡椂鐨勮繛鎺ョ姸鎬侊紙鍙锛忓彲鍐欙級銆
 
    -鑷3.1寮濮嬶紝鍙嶅悜绉绘浜嗏渃hange user鈥濆拰鈥渞eset server state鈥濆姛鑳斤紝鍏佽MysqlConnectionPoolDataSource鐨勫鎴风澶嶄綅杩炴帴姹犱笂getConnection()鐨勬湇鍔″櫒鐘舵併
 
    -浣跨敤MySQL-4.1鎴栨洿楂樼増鏈椂锛屼笉瀵筍JIS/GBK/BIG5杩涜杞箟澶勭悊銆
 
    -鍏佽MysqlDataSource鍜孧ysqlConnectionPool鏁版嵁婧愪娇鐢ㄢ渦rl鈥濆弬鏁帮紝浠ヤ究鑳藉浠庡唴閮ㄥ簲鐢ㄦ湇鍔″櫒浼犻掑叾浠栧睘鎬с
 
    -灏嗗鍒堕敭鍜屽閿敊璇槧灏勫埌鈥23000鈥濈殑SQLState銆
 
    -鑷3.1寮濮嬶紝鍙嶅悜绉绘浜嗘枃妗g紪鍒跺伐鍏枫
 
    -杩斿洖鐢ㄤ簬缁撴灉闆嗙殑鍒涘缓璇彞锛岃缁撴灉闆嗙敱getGeneratedKeys()鍒涘缓锛BUG#2957锛夈
 
    -鍏佽浣滀负鍙傛暟灏唈ava.util.Date鍙戦佸埌PreparedStatement.setObject()锛屽皢鍏惰浆鎹负Timestamp绫诲瀷浠ヤ繚鎸佸畬鏁寸簿搴︼紙BUG#3103锛夈
 
    -浣跨敤setBytes()鍜/鎴杝etBinary/CharacterStream()鏃讹紝涓嶆埅鍙朆LOB/CLOB锛BUG#2670锛夈
 
    -杩炴帴鏃讹紝鍦ㄤ娇鐢ㄢ淪HOW COLLATION鈥濈殑MySQL-4.1.0鍜屾洿楂樼増鏈笂锛屼负瀛楁绾у瓧绗﹂泦鍔ㄦ侀厤缃瓧绗﹂泦鏄犲皠銆
 
    -灏嗏渂inary鈥濆瓧绗﹂泦鏄犲皠鍒扳淯S-ASCII鈥濓紝浠ユ敮鎸4.1.2鍜屾洿楂樼増鏈湇鍔″櫒鐨凞ATETIME瀛楃闆嗚瘑鍒姛鑳姐
 
    -鍦ㄥ垵濮嬪寲杩囩▼涓娇鐢ㄢ淪ET character_set_results鈥濓紝鍏佽灏嗙粨鏋滈泦鐨勪换浣曞瓧绗﹂泦杩斿洖鍒伴┍鍔ㄧ▼搴忋
 
    -鍦>= 4.1.0鐨凪ySQL涓婂彂鍑衡淪ET NAMES鈥濅箣鍓嶏紝鍦ㄨ繛鎺ヨ嚦缂栫爜鏌ヨ鐨勮繃绋嬩腑锛屼娇鐢ㄨ繑鍥炵殑charsetnr銆
 
    -涓篟esultSetMetaData锛坓etColumnCharacterEncoding()鍜実etColumnCharacterSet()锛夊鍔犱簡Helper锛堝姪鎵嬶級鏂规硶锛屽厑璁告渶缁堢敤鎴锋煡鐪嬮┍鍔ㄧ▼搴忚涓哄簲鍦ㄥ垪涓婁娇鐢ㄧ殑瀛楃闆嗐
 
    -鍦>= 4.1.0鐨凪ySQL涓婁粎璁剧疆character_set_results銆
 
    -鏇存浜BUG#3511锛孲tringUtils.escapeSJISByteStream()涓嶈兘姝g‘澶勭悊鎵鏈夌殑涓滄柟鍙屽瓧鑺傚瓧绗﹂泦銆
 
    -灏哠tringUtils.escapeSJISByteStream()閲嶆柊鍛藉悕涓烘洿璐村垏鐨別scapeEasternUnicodeByteStream()銆
 
    -鏇存浜BUG#3554锛屽湪URL涓湭鎸囧畾鏁版嵁搴撳皢瀵艰嚧MalformedURL exception銆
 
    -濡傛灉浣跨敤浜哻haracterEncoding灞炴э紝鑷姩灏哅ySQL缂栫爜鍚嶇О杞崲涓篔ava缂栫爜鍚嶇О銆
 
    -澧炲姞浜嗗湪鏌愪簺JVM涓婅兘璇嗗埆鐨勭紪鐮佸悕绉帮紝浠ユ洿姝i敊璇湴灏嗗叾閫嗗悜鏄犲皠涓篗ySQL缂栫爜鍚嶇О鐨勯棶棰樸
 
    -涓烘墍鏈夊崟鍏冩祴璇曚娇鐢╦unit.textui.TestRunner锛堝厑璁稿湪Ant鎴朎clipse浠ュ鐨勫懡浠よ涓婅繍琛屽畠浠級銆
 
    -鏇存浜BUG#3557锛孶pdatableResultSet涓嶈兘鑾峰彇moveToInsertRow()鐨勯粯璁ゅ笺
 
    -鏇存浜BUG#3570锛屼笉涓鑷寸殑鍒楃被鍨嬮氭姤銆傛湇鍔″櫒浠嶄笉鑳芥纭繑鍥*BLOBs *TEXT鐨勬墍鏈夌被鍨嬶紝鍥犳椹卞姩绋嬪簭涔熶笉鑳芥纭繑鍥炲畠浠
 
    -鏇存浜BUG#3520锛孌BMD.getSQLStateType()杩斿洖涓嶆纭殑鍊笺
 
    -鏇存浜哖reparedStatement.setString()鍜屼笢鏂瑰瓧绗︾紪鐮佷腑鐨勯掑綊闂銆
 
    - 澧炲姞浜嗗StringRegressionTest 4.1-unicode鐨勮瘑鍒
 
02-19-04锛氱増鏈3.0.11-stable
 
    -閫氳繃鈥渃haracterEncoding鈥濆睘鎬у皢缂栫爜鏂瑰紡寮哄埗璁句负鈥渦tf8鈥濇垨鈥渦tf-8鈥濇椂锛岃Е鍙戔淪ET NAMES utf8鈥濄備互鍓嶏紝鍙兘鐢↗ava椋庢牸鐨勨渦tf-8鈥濈紪鐮佸悕绉版墠鑳借Е鍙戣鎿嶄綔銆
 
    -AutoReconnect鏃堕棿鐨勫闀块熷害蹇簬鎸囨暟閫熷害锛BUG#2447锛夈
 
    -鏇存浜嗘晠闅滃垏鎹㈡昏烦鑷冲垪琛ㄤ腑鏈鍚1涓富鏈虹殑闂锛BUG#2578锛夈
 
    -澧炲姞浜嗏渦seUnbufferedInput鈥濆弬鏁帮紝瀹冧篃鏄洰鍓嶇殑榛樿鍙傛暟锛堝洜JVM浜嬪疁锛http://developer.java.sun.com/developer/bugParade/bugs/4401235.html锛夈
 
    -妫娴嬫湇鍔″櫒涓妉ower_case_table_names鐨勨渙n/off鈥濓紝鎴栤1鈥濄佲2鈥濄佲3鈥濆舰寮忋
 
    -涓篟esultSetMetaData.getColumnClassName()鐨凾INYINT鍜孲MALLINT绫诲瀷杩斿洖鈥渏ava.lang.Integer鈥濓紙鏇存浜BUG#2852锛夈
 
    -涓篟esultSetMetaData.getColumnClassName()鐨凢LOAT绫诲瀷杩斿洖鈥渏ava.lang.Double鈥濓紙鏇存浜BUG#2855锛夈
 
    -涓篟esultSetMetaData.getColumnClassName()鐨凚INARY銆乂ARBINARY鍜孡ONGVARBINARY绫诲瀷杩斿洖鈥淸B鈥濊屼笉鏄渏ava.lang.Object鈥濓紙鍏煎JDBC锛夈
 
    -鍦ㄧ敱ConnectionPoolDataSource鍒涘缓鐨勬墍鏈夊疄渚嬩笂鍙戝嚭杩炴帴浜嬩欢銆
 
01-13-04锛氱増鏈3.0.10-stable
 
    -鍦≒reparedStatement瑙f瀽涓紝褰撲綅浜庘滃瓧绗︿覆鈥濆唴鏃讹紝涓嶅寮曠敤鐨処D杩涜璁℃暟锛堟洿姝d簡BUG#1511锛夈
 
    -鍏充簬PacketTooLargeException鐨勨淔riendlier鈥濆紓甯告秷鎭紙BUG#1534锛夈
 
    -浠3.1鐗堝紑濮嬶紝鍙嶅悜绉绘浜嗗checkUpdatability()鏂规硶涓埆鍚嶈〃鍜孶pdatableResultSets鐨勮ˉ涓併
 
    -鏇存浜嗕娇鐢⊿tatement.setMaxRows()鏃跺嚭鐜扮殑ArrayIndexOutOfBounds寮傚父锛BUG#1695锛夈
 
    -鏇存浜BUG#1576锛屽鐞嗘湭姝g‘璇诲彇鐨勫ぇBLOB鍜屽垎绂讳俊鎭寘銆
 
    -鏇存浜哠tatement.getGeneratedKeys()鍜孯EPLACE璇彞鐨勯掑綊闂銆
 
    -鏇存浜BUG#1630锛屽鏋滅粨鏋滈泦鏄笉鍙洿鏂扮殑锛屽ResultSet.updateFoo()鐨勫悗缁皟鐢ㄥ皢瀵艰嚧NPE銆
 
    -纭畾浜4.1.1椋庢牸鐨刟uth锛屾棤瀵嗙爜銆
 
    -鏇存浜BUG#1731锛屽閿垪鐨勯『搴忎笌DatabaseMetaData.getImported/Exported/CrossReference()涓嶄竴鑷淬
 
    -鏇存浜BUG#1775锛孌atabaseMetaData.getSystemFunction()杩斿洖閿欒鍑芥暟鈥淰ResultsSion鈥濄
 
    -鏇存浜BUG#1592锛屾湭姝g‘妫鏌ヤ氦鍙夋暟鎹簱鍙洿鏂扮粨鏋滈泦鐨勫彲鏇存柊鎬с
 
    -瀵逛簬MySQL LONGTEXT绫诲瀷锛孌atabaseMetaData.getColumns()搴旇繑鍥濼ypes.LONGVARCHAR銆
 
    -浣滅敤鍦═INYINT鍜孲MALLINT鍒椾笂鐨凴esultSet.getObject()搴旇繑鍥濲ava绫诲瀷鈥淚nteger鈥濓紙BUG#1913锛夈
 
    -澧炲姞浜嗏渁lwaysClearStream鈥濊繛鎺ュ睘鎬э紝瀹冧細浣块┍鍔ㄧ▼搴忓湪姣忔鏌ヨ鍓嶆竻绌鸿緭鍏ユ祦涓婁换浣曚綑鐣欑殑鏁版嵁銆
 
    -澧炲姞浜嗘洿鍏锋弿杩版х殑閿欒娑堟伅鈥淪erver Configuration Denies Access to DataSource鈥濓紙鏈嶅姟鍣ㄩ厤缃嫆缁濆鏁版嵁婧愮殑璁块棶锛夛紝骞惰兘浠庢湇鍔″櫒涓婃绱㈡秷鎭
 
    -濡傛灉宸插彂鐢熷彉鍖栵紝Autoreconnect浠g爜鍦ㄧ孩蹇冭繛鎺ユ椂涓嶈缃甤atalog銆
 
    -瀹炵幇浜哛esultSet.updateClob()銆
 
    -瀵逛簬CHAR/VARCHAR鍒楋紝ResultSetMetaData.isCaseSensitive()杩斿洖閿欒鍊笺
 
    -鏇存浜BUG#1933锛屼笉灏婇噸杩炴帴灞炴р渕axRows鈥濄
 
    -鏇存浜BUG#1925锛屽湪DBMD.extractForeignKeyFromCreateTable()涓紝鍒涘缓璇彞鐨勬鏁板お澶氥
 
    -鏇存浜BUG#1914锛屾敮鎸佽浆涔夊簭鍒{fn convert ... }
 
    -鏇存浜BUG#1958锛屽綋鍙傛暟缂栧彿绛変簬鍙傛暟鏁扮洰锛1鏃讹紝ArrayIndexOutOfBounds銆
 
    -鏇存浜BUG#2006锛屽綋SELECT鏌ヨ涓湁澶氫釜閲嶅鍒楀悕鏃讹紝ResultSet.findColumn()搴斾娇鐢ㄧ1涓尮閰嶇殑鍒楀悕锛堝吋瀹笿DBC锛夈
 
    -浠嶱reparedStatement.setTimestamp()涓垹闄や簡闈欐佸悓姝ョ摱棰堛
 
    -浠嶴ingleByteCharsetConverter鐨勫疄渚嬫柟娉曚腑鍒犻櫎浜嗛潤鎬佸悓姝ョ摱棰堛
 
    -鍏佽閫氳繃鈥渃achePrepStmts鈥濄佲減repStmtCacheSize鈥濆拰鈥減repStmtCacheSqlLimit鈥濆睘鎬э紝瀵归澶勭悊璇彞鐨勮В鏋愭楠よ繘琛岄珮閫熺紦鍐插鐞嗭紙榛樿鎯呭喌涓嬬姝級銆
 
    -鍔犲揩浜哖reparedStatements鐨勮В鏋愭搷浣滐紝鍙鍙兘锛屽敖閲忛噰鐢ㄤ竴娆℃ф柟寮忋
 
    -鏇存浜嗗湪灏忓簲鐢ㄧ▼搴忎腑浣跨敤鏃剁殑瀹夊叏寮傚父闂锛堝皬搴旂敤绋嬪簭涓嶈兘璇诲彇LOAD DATA LOCAL INFILE鎵闇鐨勭郴缁熷睘鎬р渇ile.encoding鈥濓級銆
 
    -涓篠QLStates浣跨敤甯告暟銆
 
    -杩炴帴鑷矼ySQL-4.1.0鎴栨洿楂樼増鏈椂锛屽皢瀛楃闆嗏渒o18_ru鈥濇槧灏勫埌鈥渒o18r鈥濄
 
    -纭繚Buffer.writeString()淇濆瓨鍦ㄢ\0鈥濅箣澶栫殑绌洪棿鍐呫
 
    -鏇存浜嗏渃onnect w/ JDK-1.4.0鈥濅笂鐨勫紓甯糕滄湭鐭ュ瓧绗﹂泦danish鈥濄
 
    -鏇存浜哠QLError涓殑鏄犲皠鍔熻兘锛岀敤鈥41000鈥漇QLStates閫氭姤姝婚攣鐘舵併
 
    -鈥渕axRows鈥濆睘鎬т細褰卞搷鍐呴儴璇彞锛屽洜姝わ紝搴旀鏌ヤ负椹卞姩绋嬪簭鍒涘缓鐨勬墍鏈夊唴閮ㄨ鍙ワ紝骞跺湪涓嶆槸鍐呴儴璇彞鐨勬儏鍐典笅灏嗗叾璁句负0銆
 
10-07-03锛氱増鏈3.0.9-stable
 
    -ResultSet鍜孭reparedStatement涓洿蹇殑鏃ユ湡澶勭悊浠g爜锛堜笉鍐嶄娇鐢ㄧ敤鏉ュ悓姝ラ潤鎬佹棩鍘嗙殑Date鏂规硶锛夈
 
    -鏇存浜嗗Buffer.readString()涓紦鍐插尯鏈鐨勬祴璇曘
 
    -鏇存浜哛esultSet.previous()琛屼负鏂瑰紡锛屽綋浣嶄簬缁撴灉闆嗙殑绗1琛屼笂鏃讹紝灏嗗綋鍓嶄綅缃Щ鍒扮粨鏋滈泦涔嬪墠锛坆ugs.mysql.com BUG#496锛夈
 
    -鏇存浜嗗綋宸蹭娇鐢╯etMaxRows()鑰屼笖鍦ㄦ煡璇腑鍖呭惈LIMIT瀛愬彞鏃跺彂鍑轰吉鏌ヨ鐨勮鍙ュ拰PreparedStatement銆
 
    -鏇存浜BUG#661锛屽綋涓婚敭鍊煎寘鍚渶瑕佽浆涔夌殑鍊兼椂refreshRow涓嶅伐浣滐紙浠ュ弻鍊嶈浆涔夌粨鏉燂級銆
 
    -鎻愬彇DatabaseMetaData涓殑澶栭敭淇℃伅鏃讹紝鏀寔InnoDB绾︽潫鍚嶏紝BUG#517BUG#664锛堢敱Parwinder Sekhon鎻愬嚭锛夈
 
    -浠3.1鐗堝紑濮嬶紝鍙嶅悜绉绘浜4.1鍗忚鍙樺寲锛堟湇鍔″櫒绔疭QL鐘舵侊紝鏂板瓧娈典俊鎭紝杈冨ぇ鐨勫鎴风鑳藉姏鏍囧織锛屼笌鏁版嵁搴撶殑杩炴帴绛夛級銆
 
    -鏇存浜哢pdatableResultSet锛屼綔鐢ㄥ湪鎻掑叆琛屼笂鏃讹紝涓篻etXXX()杩斿洖鍊硷紙BUG#675锛夈
 
    -璋冪敤moveToInsertRow()鏃讹紝鑳藉鐢ㄩ粯璁ょ殑鍒楀煎姞杞経pdatableResultSet涓殑insertRow锛BUG#688锛夈
 
    -瀵逛簬鎸囧畾涓篘ULL鐨勯粯璁ゅ硷紝DatabaseMetaData.getColumns()鏈繑鍥濶ULL銆
 
    -灏嗛粯璁ょ殑璇彞绫诲瀷锛忓苟鍙戣鏇存敼涓篢YPE_FORWARD_ONLY鍜孋ONCUR_READ_ONLY锛堝吋瀹硅鑼冿級銆
 
    -濡傛灉MySQL涓嶆敮鎸侊紝涓嶈灏濊瘯鎴栧浣嶅啀杩炴帴涓婄殑闅旂绾у埆銆
 
    -涓嶅皢SQLExceptions灏佸湪RowDataDynamic鍐呫
 
    -濡傛灉useTimezone==true锛屼笉鏇存敼鏃堕棿鎴砊Z涓ゆ锛BUG#774锛夈
 
    -鏇存浜嗗ぇ鐨勫垎绂讳俊鎭寘澶勭悊涓瓨鍦ㄧ殑鍥炲綊闂锛BUG#848锛夈
 
    -鏇村ソ鍦拌瘖鏂滄祦寮忊濈粨鏋滈泦寮傚父涓殑閿欒娑堟伅銆
 
    -鍦ㄧ┖缁撴灉闆嗕笂鎶涘嚭鍏充簬ResultSet.getXXX()鐨勫紓甯革紙鍦ㄦ煇浜涙儏鍐垫湭琚繕鑾凤級銆
 
    -涓嶉殣钘忓叧浜庡湪I/O灞備腑鎶涘嚭寮傚父鐨勬秷鎭
 
    -鍏抽棴杩炴帴姹犳椂鎴栧湪鍏锋湁宸叉墦寮杩炴帴鐨凱ooledConnection.getConnection()涓婏紝涓嶈Е鍙戣繛鎺ュ叧闂椂闂达紙BUG#884锛夈
 
    -鎴煭+/- INF锛堟渶灏忓拰鏈澶т唬琛ㄥ硷紝瀵逛簬MySQL涓殑绫诲瀷锛夛紝浠ュ強NaN锛堣嚦0锛屽浜巗etDouble/setFloat()锛夛紝褰撴湇鍔″櫒涓嶆敮鎸+/- INF鎴朜aN鏃讹紝灏辫鍙ュ彂鍑鸿鍛娿
 
    -鏇存浜BUG#879锛屽綋瀛楃闆嗕负SJIS鎴朑BK鏃讹紝浠ュ強鈥\鈥濆嚭鐜板湪闈炶浆涔夎緭鍏ヤ腑鏃跺鈥\鈥濈殑鍙岃浆涔夊鐞嗐
 
    -娓呯┖鈥滄祦寮忊濈粨鏋滈泦鏈娇鐢ㄨ鐨勮緭鍏ユ祦鏃讹紝姣100琛屽潎鏈夊綋鍓嶇嚎绋媦ield()锛屼互鍏嶇嫭鍗燙PU鏃堕棿銆
 
    -鏇存浜BUG#1099锛孌atabaseMetaData.getColumns()寮勪笉娓呭瓧绗﹀垪涓殑鍏抽敭瀛椻渟et鈥濄
 
    -鏇存浜嗕笌Statement.setMaxRows()鐩稿叧鐨勬閿佷簨瀹溿
 
    -鏇存浜咰LOB.truncate()锛BUG#1130
 
    -浼樺寲浜咰LOB.setChracterStream(), BUG#1131
 
    -浣縟atabaseName銆乸ortNumber浠ュ強serverName鎴愪负MysqlDataSourceFactory鐨勫彲閫夊弬鏁帮紙BUG#1246锛夈
 
    -淇浜BUG#1247锛屽鑷村瓧绗127鎹熷潖鐨凴esultSet.get/setString銆
 
    -浠3.1鐗堝紑濮嬶紝鍙嶅悜绉绘浜嗛拡瀵4.11鍜屾洿楂樼増鏈殑auth.鏇存敼銆
 
    -澧炲姞浜哻om.mysql.jdbc.util.BaseBugReport锛屼互甯姪鍒涘缓缂洪櫡鎶ュ憡鐨勬祴璇曡寖渚嬨
 
    -閫氳繃灏嗏渃lobberStreamingResults鈥濆睘鎬ц缃负鈥滅湡鈥濓紙榛樿涓衡滃亣鈥濓級锛屼负鈥渃lobber鈥濇祦寮忕粨鏋滃鍔犱簡灞炴с傝繖浼氫娇鈥滄祦寮忊濈粨鏋滈泦琚嚜鍔ㄥ叧闂紝濡傛灉鍦ㄦ墍鏈夋暟鎹皻鏈粠鏈嶅姟鍣ㄤ腑璇诲彇瀹屼箣鍓嶏紝鎵ц浜嗗彟涓鏌ヨ锛屾鍦ㄤ粠鏈嶅姟鍣ㄦ祦鍑虹殑浠讳綍鏈畬鎴愭暟鎹潎灏嗚鑸嶅純銆
 
05-23-03锛氱増鏈3.0.8-stable
 
    -鍏佽鍦―river.getPropertyInfo()涓娇鐢ㄤ吉URL銆
 
    -涓嶴tatement.getGeneratedKeys()涓璧蜂娇鐢ㄥ鍊糏NSERTS鏃讹紝杩斿洖鎵鐢熸垚閿殑鍒楄〃銆
 
    -涓庢枃浠跺悕鍜屸淟OAD DATA [LOCAL] INFILE鈥濅竴璧蜂娇鐢↗VM瀛楃闆嗐
 
    -鏇存浜嗕笌Connection.cleanup()鏈夊叧鐨勬棤闄愬惊鐜
 
    -灏咥nt鐩爣鈥渃ompile-core鈥濇洿鏀逛负鈥渃ompile-driver鈥濓紝骞朵娇娴嬭瘯濂椾欢缂栬瘧鎴愪负鍗曠嫭鐨勭洰鏍囥
 
    -鏇存浜嗘湭鑾峰緱鍏充簬Statement.executeUpdate()鐨勯泦鍚堢殑缁撴灉闆嗭紝鍦ㄦ煇浜涙儏鍐典笅锛屽畠浼氬奖鍝峠etGeneratedKeys()鍜実etUpdateCount()銆
 
    -瀛楃涓蹭腑鐨刄nicode瀛楃0xFFFF浼氬鑷撮┍鍔ㄧ▼搴忔姏鍑篈rrayOutOfBoundsException锛Bug #378锛夈
 
    -浣跨敤鈥淩EPLACE鈥濊鍙ユ椂杩斿洖鎵鐢熸垚閿殑姝g‘鏁扮洰銆
 
    -鏇存浜嗗湪鏌愪簺鎯呭喌涓嬫娴嬫湇鍔″櫒瀛楃闆嗙殑闂銆
 
    -鏇存浜嗕娇鐢ㄦ瀬澶т俊鎭寘鏃剁殑琛屾暟鎹В鐮侀敊璇
 
    -浼樺寲浜嗚鏁版嵁瑙g爜銆
 
    -鍦ㄥ凡鍏抽棴棰勫鐞嗚鍙ヤ笂鎵ц鎿嶄綔浣挎姏鍑哄紓甯搞
 
    -鏇存浜哠JIS缂栫爜缂洪櫡锛屾劅璋aoto Sato銆
 
    -浼樺寲浜咵scapeProcessor鐨勪娇鐢ㄣ
 
    -鍏佽瀵筍tatement.close()鐨勫娆¤皟鐢ㄣ
 
04-08-03锛氱増鏈3.0.7-stable
 
    -鏇存浜嗚皟鐢ㄩ敊璇簨浠剁被鍨嬬殑MysqlPooledConnection.close()銆
 
    -鏇存浜哖reparedStatement.setClob()涓殑StringIndexOutOfBoundsException銆
 
    - 4.1鐗堝垪鍏冩暟鎹洿姝c
 
    -浠嶥river.connect()鍜孌river.acceptsUrl()涓垹闄や簡鍚屾鍔熻兘銆
 
    -浜嬪姟杩囩▼涓殑IOExceptions鐜板湪浼氬鑷村叧闂繛鎺ャ
 
    -鏇存浜哛esultSetMetaData.getColumnTypeName()涓涪澶辩殑鈥淵EAR鈥濈被鍨嬭浆鎹€
 
    -瀵逛簬DBMD.getPrimaryKeys()锛屼笉鎻愬彇浠モ減ri鈥濅綔涓轰富閿捣濮嬬殑绱㈠紩銆
 
    -璇曞浘鍦ㄥ己鍒跺叧闂殑杩炴帴涓婃墽琛屾搷浣滄椂鎶涘嚭SQLExceptions锛堝嵆锛岄氫俊閾捐矾澶辫触鏃讹級銆
 
    -鐜板湪锛屽彲浠ヤ娇鐢–onnection.setProfileSql(boolean)鏉ユ墦寮鎴栧叧闂豢鍨嬪姛鑳姐
 
    鏇存浜嗕笌鏁版嵁搴撳厓鏁版嵁鏈夊叧鐨勫瓧绗﹂泦浜嬪疁锛堝瓧绗﹂泦涓嶈兘姝g‘鑾峰彇闆嗗悎锛夈
 
    -涓嶮ySQL-4.1鎴栨洿楂樼増鏈繛鎺ユ椂锛岀幇鍦ㄨ兘澶熶负鍒悕琛/鍒楀垱寤哄彲鏇存柊缁撴灉闆嗐
 
    -鏇存浜嗘枃浠跺ぇ浜庘渕ax_allowed_packet鈥濇椂鐨勨淟OAD DATA LOCAL INFILE鈥濈己闄枫
 
    -瀵逛簬GBK鍜孊ig5瀛楃闆嗭紝鏇存浜0x5c ('\')瀛楃鐨勮浆涔夊姛鑳姐
 
    -鏇存浜嗗熀纭瀛楁涓篋ATE绫诲瀷鏃剁殑ResultSet.getTimestamp()闂銆
 
    -淇濊瘉浜嗘潵鑷猘lignPacketSize()鐨勪俊鎭寘澶у皬涓嶈秴杩嘙AX_ALLOWED_PACKET锛圝VM缂洪櫡锛夈
 
    -autoReconnecting锛堣嚜鍔ㄥ啀杩炴帴锛夋椂涓嶅浣岰onnection.isReadOnly()銆
 
02-18-03锛氱増鏈3.0.6-stable
 
    -鏇存浜哛esultSetMetaData锛屽綋catalog鏈煡鏃惰繑鍥""銆傛洿姝d簡涓嶴un CachedRowSet鏈夊叧鐨凬ullPointerExceptions銆
 
    -鏇存浜咲BMD.getTypeInfo()鍜孌BMD.getColumns()涓篢EXT/BLOB绫诲瀷涓殑绮惧害杩斿洖涓嶅悓鍊肩殑闂銆
 
    -閫氳繃灏嗏渋gnoreNonTxTables鈥濊缃负鈥滅湡鈥濓紝鍦ㄥ洖閫鏈熼棿锛堝吋瀹规э紡鍙敤鎬э級锛屽厑璁稿拷鐣モ渘on transactional tables鈥濓紙闈炰簨鍔¤〃锛夊憡璀︺
 
    -鏇存浜嗗湪鍒濆杩炴帴涓奡QLExceptions鑰楀敖鐨勯棶棰樸
 
    -鏇存浜哠tatement.setMaxRows()锛屽綋鍏朵笉闇瑕佹椂锛屽仠姝㈠彂閫佲淟IMIT鈥濈被鍨嬬殑鏌ヨ锛堟ц兘锛夈
 
    -鏁寸悊浜嗚鍙ユ煡璇/鏂规硶澶遍厤娴嬭瘯锛堝嵆锛屼笉鍏佽涓.executeQuery()涓璧蜂娇鐢↖NSERT锛夈
 
    -鍦≧esultSet閬嶅巻鏂规硶涓鍔犱簡鏇村妫鏌ワ紝浠ヨ幏鍙栦綍鏃跺浜庡叧闂姸鎬佺殑淇℃伅銆
 
    -鏇存浜哛esultSetMetaData.isWritable()浠ヨ繑鍥炴纭笺
 
    -涓篋BMD.nullsAreSortedAtStart澧炲姞浜嗕笉鍚孨ULL鍒嗙被琛屼负鐨勨滅獥鍙b濓紙4.0.2鑷4.0.10锛岀湡锛屽叾浠栦负鈥滃惁鈥濓級銆
 
    -瀹炵幇浜咮lob.setBytes()銆備粛闇瑕佸皢鎵寰楃殑Blob浼犲洖鍒板彲鏇存柊ResultSet锛堢粨鏋滈泦锛夋垨PreparedStatement浠ヤ繚鎸佸彉鏇达紝杩欐槸鍥犱负MySQL涓嶆敮鎸佲滃畾浣嶅櫒鈥濄
 
    -浠嶤onnector/J 3.1鍙嶅悜绉绘浜4.1瀛楃闆嗗瓧娈点
 
01-22-03锛氱増鏈3.0.5-gamma
 
    -鏇存浜嗚В鍖呭瓧娈垫椂瀵规煇浜涙煡璇uffer.fastSkipLenString()瀵艰嚧ArrayIndexOutOfBounds寮傚父鐨勯棶棰樸
 
    -涓篊onnection.getTypeMap()瀹炵幇浜嗙┖鐨凾ypeMap锛屼互渚挎煇浜涚涓夋柟搴旂敤绋嬪簭鑳戒笌MySQL涓璧峰伐浣滐紙IBM WebSphere 5.0杩炴帴姹狅級銆
 
    -涓篋BMD.getColumns()澧炲姞浜嗕涪澶辩殑LONGTEXT绫诲瀷銆
 
    -褰揗ySQL鐗堟湰鏀寔鏃讹紝Connection.getTransactionIsolation()鑳戒粠鏁版嵁搴撴绱X_ISOLATION锛岃屼笉鏄疄渚嬪彉閲忋
 
    -寮曠敤DatabaseMetaData.getColumns()銆乬etPrimaryKeys()銆乬etIndexInfo()銆乬etBestRowIdentifier()涓殑琛ㄥ悕銆
 
    -澶у箙搴﹂檷浣庝簡PreparedStatements涓璼etBinaryStream()鎵闇鐨勫唴瀛樸
 
    -鏇存浜哛esultSet.isBeforeFirst()澶勭悊绌虹粨鏋滈泦鏂归潰鐨勯棶棰樸
 
    -涓哄閿厓鏁版嵁澧炲姞浜嗏滄洿鏂扳濋夐」銆
 
 
01-06-03锛氱増鏈3.0.4-gamma
 
    -涓篊onnection.setCatalog澧炲姞浜嗗鏁版嵁搴撳悕鐨勫紩鐢↖D銆
 
    -鍦≒reparedStatement鍒嗘瀽绋嬪簭涓鍔犱簡瀵瑰紩鐢↖D鐨勬敮鎸併
 
    -瀵逛簬setByte()锛屽湪PreparedStatements涓紝娴佺嚎寮忓瓧绗﹁浆鎹㈠拰byte[]澶勭悊銆
 
    -閫氳繃涓嶮ysqlIO鍏变韩鍑虹珯淇℃伅鍖咃紝闄嶄綆浜哖reparedStatements鐨勫唴瀛樺崰鐢ㄣ
 
    -澧炲姞浜嗏渟trictUpdates鈥濆睘鎬э紝鑳藉瀵瑰彲鏇存柊缁撴灉闆嗙殑澶ч噺鈥滄纭р濇鏌ヨ繘琛屾帶鍒躲傚鏋滃笇鏈涜幏寰楁洿蹇殑鍙洿鏂扮粨鏋滈泦锛屽苟浣跨敤涓婚敭閫氳繃浣滅敤鍦ㄨ〃涓婄殑SELECT鍒涘缓浜嗙粨鏋滈泦锛岃屼笖鍦ㄦ煡璇腑閫夋嫨浜嗘墍鏈夌殑涓婚敭锛屽簲灏嗗叾璁剧疆涓衡滃亣鈥濄
 
    -澧炲姞浜嗗4.0.8椋庢牸澶т俊鎭寘鐨勬敮鎸併
 
    -鏇存浜哖reparedStatement.executeBatch()鍙傛暟閲嶅啓鐨勯棶棰樸
 
12-17-02锛氱増鏈3.0.3-dev
 
    -灏哠ingleByteCharConverter涓殑charsToByte鏇存敼涓洪潪闈欐佺被鍨嬨
 
    -鏇存敼浜哠ingleByteCharConverter锛屼互浣跨敤鍚勮浆鎹㈠櫒鐨勭┖闂插垵濮嬪寲鐗规с
 
    -鏇存浜咶ields.java涓殑瀛楃闆嗗鐞嗗姛鑳姐
 
    -瀹炵幇浜咰onnection.nativeSQL()銆
 
    -鏇村彲闈犵殑杞箟鏍囧織鈥-- recognize '--'鈥濇敞閲婏紝骞跺厑璁稿祵濂楀紡杞箟搴忓垪锛堣鍙傝testsuite.EscapeProcessingTest锛夈
 
    -DBMD.getImported/ExportedKeys()鐜板湪鑳藉鐞嗘瘡涓〃涓婄殑澶氫釜澶栭敭銆
 
    -鏇存浜嗗鏌愪簺娴偣绫诲瀷ResultSetMetaData.getPrecision()杩斿洖閿欒鍊肩殑闂銆
 
    -鏇存浜哛esultSetMetaData.getColumnTypeName()瀵筎EXT绫诲瀷杩斿洖BLOB锛屽BLOB绫诲瀷杩斿洖TEXT鐨勯棶棰樸
 
    -瀵逛簬4.1鍜屾洿楂樼増鏈湇鍔″櫒锛屾洿姝d簡Buffer.isLastDataPacket()銆
 
    -澧炲姞浜咰LIENT_LONG_FLAG锛屼互渚胯兘鑾峰緱鏇村鐨勫垪鏍囧織锛坕sAutoIncrement()鏈閲嶈锛夈
 
    -鐢变簬涓婅堪鍘熷洜锛屽疄鐜颁簡ResultSetMetaData.isAutoIncrement()浠ヤ娇鐢‵ield.isAutoIncrement()銆
 
    -鍦―atabaseMetaData鏂规硶涓瘮杈冭〃鍚嶄笖鍦ㄦ湇鍔″櫒涓厑璁告椂锛屼紭鍏堣冭檻鈥渓ower_case_table_names鈥濄
 
    -涓浜汳ySQL-4.1鍗忚鏀寔锛堟墿灞曞瓧娈典俊鎭級銆
 
    -浣跨敤闈炲埆鍚嶈〃/鍒楀悕鍜屾暟鎹簱鍚嶏紝浠ュ畬鍏ㄩ檺瀹歎pdatableResultSet涓殑琛ㄥ拰鍒楋紙闇瑕丮ySQL-4.1鎴栨洿楂樼増鏈級銆
 
    -鍏佽鐢ㄦ埛閫氳繃鈥渃ontinueBatchOnError鈥濆睘鎬э紙榛樿涓衡滅湡鈥濓級鏇存敼Statement/PreparedStatement.executeBatch()鐨勮涓恒
 
    -鍦ㄦ洿澶氳繛鎺ユ柟娉曪紙createStatement銆乸repareStatement銆乻etTransactionIsolation銆乻etAutoCommit锛変腑妫鏌ュ叧闂殑杩炴帴銆
 
    -鏇村彲闈犲湴瀹炵幇浜嗗彲鏇存柊缁撴灉闆嗐傛鏌ヨ〃鐨勬墍鏈変富閿槸鍚﹀凡琚夋嫨銆
 
    -濡傛灉鍦ㄦ湇鍔″櫒鐨勯厤缃厑璁革紝鈥淟OAD DATA LOCAL INFILE ...鈥濈幇鍦ㄨ兘姝e父宸ヤ綔銆備笉鑳戒娇鐢ㄢ渁llowLoadLocalInfile鈥濆睘鎬у叧闂畠锛堣鍙傝README锛夈
 
    -鍦ㄥ崟瀛楄妭瀛楃闆嗕腑锛屽浜庢湭鐭ョ殑瀛楃杞崲锛岀敤鈥?鈥濇浛浠b\0鈥濄
 
    - NamedPipeSocketFactory鐜拌兘姝e父宸ヤ綔锛堜粎瀵筗indows骞冲彴锛夈傚叿浣撹鏄庤鍙傝README銆
 
11-08-02锛氱増鏈3.0.2-dev
 
    -鏇存浜嗗彲鏇存柊缁撴灉闆嗗拰PreparedStatements涓嶅伐浣滅殑闂銆
 
    -鏇存浜哛esultSet.setFetchDirection(FETCH_UNKNOWN)銆
 
    -鏇存浜嗕娇鐢ㄤ换鎰忓煎苟璋冪敤Statement.setFetchSize()鏃剁殑闂銆
 
    -鏇存浜哛esultSet.getLong()涓殑涓嶆纭浆鎹€
 
    -瀹炵幇浜哛esultSet.updateBlob()銆
 
    -鍒犻櫎浜哢pdatableResultSet涓殑閲嶅浠g爜锛堣兘浠嶳esultSet缁ф壙鑰屾潵锛屼笉闇瑕佸悇鏂规硶澶勭悊鍙洿鏂版х殑棰濆浠g爜锛屼絾鎴戣涓哄湪灏嗘潵鍙兘闇瑕侊級銆
 
    -鏇存浜嗛氳繃灞炴р滃己鍒垛濆瓧绗︾紪鐮佹椂鎶涘嚭鐨勨淯nsupportedEncodingException鈥濄
 
    -鏇存浜嗗悇绉嶉潪ASCII瀛楃缂栫爜闂銆
 
    -澧炲姞浜嗛┍鍔ㄧ▼搴忓睘鎬р渦seHostsInPrivileges鈥濄傞粯璁ゅ间负鈥滅湡鈥濄傚畠灏嗗奖鍝嶆槸鍚﹀湪鈥淒BMD.getColumn/TablePrivileges鈥濅腑浣跨敤鈥淍hostname鈥濄
 
    -鎻忚堪鏂规鐨勬墍鏈塂BMD缁撴灉闆嗗垪鐜拌繑鍥濶ULL锛屼互渚胯兘涓庣敤浜庡叾浠栨暟鎹簱鐨勫叾浠朖DBC椹卞姩绋嬪簭鐨勮涓烘洿鍏煎锛圡ySQL涓嶆敮鎸佹柟妗堬級銆
 
    -澧炲姞浜哠SL鏀寔銆傚叧浜庡浣曚娇鐢ㄥ畠鐨勬洿澶氫俊鎭紝璇峰弬瑙丷EADME銆
 
    -鎵ц鑷姩鍐嶈繛鎺ユ垨鏁呴殰鍒囨崲鏃讹紝鎭板綋鎭㈠杩炴帴灞炴э紝鍖呮嫭autoCommit鐘舵佷互鍙婇殧绂荤骇鍒
 
    -鍙兘鏃讹紝浣跨敤鈥淪HOW CREATE TABLE鈥濓紝浠ョ‘瀹氱敤浜嶥atabaseMetaData鐨勫閿俊鎭紝瀵逛簬杩斿洖鐨凞ELETE淇℃伅杩樺厑璁哥骇鑱旈夐」銆
 
    -瀵逛簬SJIS瀛楃闆嗭紝杞箟浜嗗瓧绗︿覆涓殑鈥0x5c鈥濆瓧绗︺
 
    -鏇存浜咰lob.getSubString()涓捣濮嬩綅缃亸绂1鐨勯敊璇
 
    -瀹炵幇浜咰lob.truncate()銆
 
    -瀹炵幇浜咰lob.setString()銆
 
    -瀹炵幇浜咰lob.setAsciiStream()銆
 
    -瀹炵幇浜咰lob.setCharacterStream()銆
 
    -澧炲姞浜哻om.mysql.jdbc.MiniAdmin绫伙紝璇ョ被鍏佽浣犲皢鈥渟hutdown鈥濆懡浠ゅ彂閫佽嚦MySQL鏈嶅姟鍣ㄣ傚湪鏈缁堢敤鎴峰簲鐢ㄤ腑宓屽叆Java鍜孧ySQL鏈嶅姟鍣ㄦ椂浣跨敤銆
 
    -澧炲姞浜嗏渃onnectTimeout鈥濆弬鏁帮紝鍏佽JDK-1.4鍜屾洿楂樼増鏈殑鐢ㄦ埛鎸囧畾寤虹珛杩炴帴鎵闇绛夊欑殑鏈闀挎椂闂淬
 
    -浠呭綋杩炴帴澶勪簬autoCommit(false)鐘舵佹椂锛屾晠闅滃垏鎹㈠拰autoReconnect鎵嶈兘宸ヤ綔锛岀洰鐨勫湪浜庝繚鎸佷簨鍔$殑瀹夊叏銆
 
    -澧炲姞浜嗏渜ueriesBeforeRetryMaster鈥濆睘鎬э紝鍑虹幇鏁呴殰鍒囨崲鏃惰屼笖鍦ㄩ噸鏂拌繛鎺ュ埌涓绘湇鍔″櫒涔嬪墠锛岃灞炴ф寚瀹氫簡鑳藉鍙戝嚭鐨勬煡璇㈡暟鐩紙榛樿涓50锛夈
 
    -鏇存浜咲BMD.supportsResultSetConcurrency()锛屼互渚夸负ResultSet.TYPE_SCROLL_INSENSITIVE鍜孯esultSet.CONCUR_READ_ONLY鎴朢esultSet.CONCUR_UPDATABLE杩斿洖鈥滅湡鈥濄
 
    -鏇存浜哛esultSet.isLast()澶勭悊绌虹粨鏋滈泦鏂归潰鐨勯棶棰橈紙搴旇繑鍥炩滃亣鈥濓級銆
 
    - PreparedStatement鐜板湪灏嗕紭鍏堣冭檻setBinary/Ascii/Character Stream()涓殑娴侀暱搴︼紝闄ら潪灏嗚繛鎺ュ睘鎬р渦seStreamLengthsInPrepStmts鈥濊缃负鈥滃亣鈥濄
 
    -鍒犻櫎浜嗕竴浜涗娇鐢‥scapeProcessor銆丆onnection鍜孌atabaseMetaData绫讳腑鐨勨淪trings smarter鈥濆垱寤虹殑涓嶉渶瑕佺殑涓存椂瀵硅薄銆
 
09-21-02锛氱増鏈3.0.1-dev
 
    -鏇存浜哛esultSet.getRow()鍋忓樊1鐨勭己闄枫
 
    -鏇存浜哛owDataStatic.getAt()鍋忓樊1鐨勭己闄枫
 
    -澧炲姞浜嗘湁闄怌lob鍔熻兘锛圧esultSet.getClob()銆丳reparedStatemtent.setClob()銆丳reparedStatement.setObject(Clob)锛夈
 
    -涓篣RL澧炲姞浜唖ocketTimeout鍙傛暟銆
 
    - Connection.isClosed()涓嶅啀瀵规湇鍔″櫒鎵ц鈥淧ing鈥濇搷浣溿
 
    -褰撯済etAutoCommit() == false鈥濇椂Connection.close()鍙戝嚭rollback()銆
 
    -澧炲姞浜嗏滃鎯斥濆弬鏁帮紝閫氳繃鍒犻櫎鍏朵腑鐨勨滄晱鎰熲濅俊鎭竻鐞嗕簡閿欒娑堟伅锛堝嵆锛屼富鏈哄悕銆佺鍙c佺敤鎴峰悕绛夛級锛屽苟鍦ㄥ彲鑳界殑鎯呭喌涓嬶紝娓呯悊浜嗏滄晱鎰熲濈殑鏁版嵁缁撴瀯銆
 
    -鏇存浜哛esultSetMetaData.isSigned()鍦ㄥ鐞員INYINT鍜孊IGINT鏂归潰鐨勯棶棰樸
 
    - 鐜板湪灏嗚嚜鍔ㄦ娴嬪瓧绗﹂泦銆備紭鍖栦簡鍗曞瓧鑺傚瓧绗﹂泦杞崲鐨勪唬鐮併
 
    -瀹炵幇浜哛esultSet.getCharacterStream()銆
 
    -涓篋atabaseMetaData.getTableTypes()涓殑琛ㄧ被鍨嬪鍔犱簡鈥淟OCAL TEMPORARY鈥濄
 
    - 鏁寸悊浜嗗ぇ鍧椾唬鐮侊紝浠ラ伒寰狫ava缂栫爜鎯緥锛堟椂鏈烘垚鐔燂級銆
 
 
07-31-02锛氱増鏈3.0.0-dev
 
    - !!! 璁稿彲鍙樺寲!!! 椹卞姩鐜板湪鏄疓PL銆傚鏋滈渶瑕侀潪GPL璁稿彲锛岃涓庢垜浠仈绯伙紙mark@mysql.com锛夈
 
    - JDBC-3.0鍔熻兘鍖呮嫭Statement/PreparedStatement.getGeneratedKeys()鍜孯esultSet.getURL()銆
 
    -鎬ц兘澧炲己锛屽湪澶у鏁版儏鍐典笅锛岄┍鍔ㄧ▼搴忓揩浜50-100锛咃紝鑰屼笖鍒涘缓鐨勪复鏃跺璞℃洿灏戙
 
    -閲嶆柊灏佽...鏂扮殑椹卞姩绋嬪簭鍚嶆槸鈥渃om.mysql.jdbc.Driver鈥濓紝浣嗘棫鍚嶇О渚濈劧鏈夋晥锛堥┍鍔ㄧ▼搴忕幇鐢盡ySQL-AB鎻愪緵锛夈
 
    -鏇村ソ鍦板湪璇彞鍜孭reparedStatement涓鏌ュ凡鍏抽棴鐨勮繛鎺ャ
 
    -鏀寔娴佸紡缁撴灉闆嗭紙鎸夎锛夛紝璇峰弬瑙丷EADME锛屾劅璋oron銆
 
    -鏀寔澶т俊鎭寘锛圡ySQL-4.0鍗忚鐨勬柊澧炲唴瀹癸級锛屾洿澶氫俊鎭鍙傝README銆
 
    - JDBC鍏煎锛岄櫎浜嗗瓨鍌ㄧ▼搴忔祴璇曞锛屾彁渚涗簡鎵鏈夋祴璇曘
 
 
    -鏇存骞跺垎绫讳簡DBMetaData涓殑涓婚敭鍚嶇О锛圫F缂洪櫡582086鍜582086锛夈
 
    -娴偣绫诲瀷鐜颁负java.sql.Types.FLOAT锛圫F缂洪櫡579573锛夈
 
    - ResultSet.getTimestamp()鐜板湪鑳藉鐞咲ATE绫诲瀷锛圫F缂洪櫡559134锛夈
 
    - ResultSet.getDate/Time/Timestamp鐜板湪鑳借瘑鍒敱MySQL璁剧疆涓哄叏闆剁殑鎵鏈夊舰寮忕殑鏃犳晥鍊硷紙SF缂洪櫡586058锛夈
 
    - Testsuite鐜板湪灏嗕娇鐢↗unit锛堝彲浠www.junit.org鑾峰緱锛夈
 
    -椹卞姩绋嬪簭鐜板湪浠呰兘涓嶫DK-1.2鎴栨洿楂樼増鏈竴璧峰伐浣溿
 
    -澧炲姞浜嗗涓绘満鏁呴殰鍒囨崲鏀寔锛堣鍙傝README锛夈
 
    -杩涜浜嗕竴鑸х殑婧愮爜娓呯悊銆
 
    -璇诲彇淇℃伅鍖呮椂锛岄氳繃鎺у埗MysqlIO绫诲垱寤虹殑杩囨浮瀵硅薄锛屾敼鍠勪簡鎬荤殑閫熷害銆
 
    -鏀瑰杽浜嗗瓧绗︿覆澶勭悊鍜屽瓧娈靛厓鏁版嵁鍒涘缓鐨勬ц兘锛堜緥绀猴級锛岀敱Alex Twisleton-Wykeham-Fiennes鎻愪緵銆
 
 
05-16-02锛氱増鏈2.0.14
 
    -鏇村浠g爜鏁寸悊銆
 
    - PreparedStatement鐜板湪鑳介噴鏀.close()涓婄殑璧勬簮锛圫F缂洪櫡553268锛夈
 
    -濡傛灉鏈嶅姟鍣ㄧ増鏈笉鏀寔锛屼笉浣跨敤寮曠敤ID銆傛澶栵紝濡傛灉鏈嶅姟鍣ㄦ槸浠モansi鈥濇垨鈥--sql-mode=ANSI_QUOTES鈥濆紑濮嬶紝閭d箞鈥"鈥濆皢鐢ㄤ綔ID寮曠敤锛屽惁鍒欏皢浣跨敤鈥渀鈥濄
 
    - ResultSet.getDouble()鐜板湪鑳芥洿鍑嗙‘鍦颁娇鐢↗DK鍐呯疆鐨勪唬鐮侊紙浣嗚緝鎱級銆
 
    - LogicalHandle.isClosed()璋冪敤锛岀洿鑷崇墿鐞嗚繛鎺ャ
 
    -澧炲姞浜哠QL浠垮瀷鍔熻兘锛堝埌STDERR锛夈傚湪JDBC url涓缃減rofileSql=true鈥濄傛洿澶氫俊鎭鍙傝README銆
 
    -鏇存浜唕elaxAutoCommit鍙傛暟鐨勭被鍨嬨
 
04-24-02锛氱増鏈2.0.13
 
    -鏇村浠g爜鏁寸悊銆
 
    -鏇存浜嗘湭鑳芥纭鍙栫殑unicode瀛楃锛圫F缂洪櫡541088锛夈
 
    -涓篜repStmt鎻愪緵浜嗘洿蹇殑Blob杞箟鍔熻兘銆
 
    -涓篋ataSource(s)澧炲姞浜唖et/getPortNumber()锛圫F缂洪櫡548167锛夈
 
    -涓篗ySQLXADataSource澧炲姞浜唖etURL()锛圫F缂洪櫡546019锛夈
 
    -鏇存浜哖reparedStatement.toString()锛圫F缂洪櫡534026锛夈
 
    -瀹炵幇浜哛esultSetMetaData.getColumnClassName()銆
 
    - 鐜板湪瀹炴柦浜嗘潵鑷狫DBC-3.0鐨凷tatement.getGeneratedKeys()鐨勫垵绾х増鏈紙瑕佹兂浣夸箣宸ヤ綔锛岄渶瑕佷娇鐢↗DK-1.4锛屾垜涓汉璁や负锛夈
 
    - DBMetaData.getIndexInfo()锛屾洿姝d簡涓嶈壇鐨凱AGES锛圫F缂洪櫡542201锛夈
 
04-07-02锛氱増鏈2.0.12
 
    -涓鑸т唬鐮佹暣鐞嗐
 
    -涓篊onnection鍜孧ysqlLogicalHandle澧炲姞浜唃etIdleFor()鏂规硶銆
 
    -鏀炬澗浜嗘墍鏈夌被涓殑鍔熻兘锛屽簲鏇存520615鍜520393銆
 
    -涓篋BMD澧炲姞浜唃etTable/ColumnPrivileges()锛堟洿姝484502锛夈
 
    -涓篻etTypeInfo()澧炲姞浜嗘柊绫诲瀷锛屾洿姝d簡宸叉湁绫诲瀷锛屾劅璋l Davis鍜孠id Kalanon銆
 
    -涓篜reparedStatement澧炲姞浜咮IT绫诲瀷鏀寔锛51870锛夈
 
    -鏇存浜哛esultSet涓殑getRow()缂洪櫡锛527165锛夈
 
    -鏇存浜哖reparedStatement涓殑ResultSet鍙洿鏂版с
    -鏇存浜哖reparedStatement涓椂鍖哄亸宸1灏忔椂鐨勭己闄凤紙538286銆528785锛夈
 
    - ResultSet: 鏇存浜嗗彲鏇存柊鎬э紙濡傛灉涓嶅彲鏇存柊锛屽皢鍊艰涓篘ULL锛夈
 
    - DataSources锛屾洿姝d簡setUrl缂洪櫡锛511614銆525565锛夛紝閿欒鐨勬暟鎹簮绫诲悕锛532816銆528767锛夈
 
    -涓洪渶瑕佸畠浠殑鎵鏈塂atabaseMetaData鏂规硶澧炲姞浜咺D寮曠敤锛堝簲鏇存518108锛夈
 
    -澧炲姞浜嗗YEAR绫诲瀷鐨勬敮鎸侊紙533556锛夈
 
    - ResultSet.insertRow()鐩墠鑳藉鍦ㄥぇ澶氭暟鎯呭喌涓嬫娴媋uto_increment瀛楁锛屽苟鍦ㄦ柊琛屼腑浣跨敤璇ュ笺備絾鏄紝璇ユ娴嬩笉閫傜敤浜庡鍊奸敭锛屽師鍥犲湪浜嶮ySQL鍗忚涓嶈繑鍥炶绫讳俊鎭
 
    -瀹炵幇浜哛esultSet.refreshRow()銆
 
    -鏇存浜唗estsuite.Traversal afterLast()缂洪櫡锛屾劅璋gor Lastric銆
 
01-27-02锛氱増鏈2.0.11
 
    
-鏇存浜DBMD.getImported/ExportedKeys()getCrossReference()涓涪澶辩殑DELETE_RULE鍊笺
 
    -Statement.java鐨勫畬鍏ㄥ悓姝ャ
 
    -澶氬淇敼锛屾洿姝d簡璇诲彇BLOB鏃剁殑鈥淯nexpected end of input stream鈥濓紙杈撳叆娴佹剰澶栫粨鏉燂級閿欒銆傝繖搴旀槸鏈鍚庢洿姝c
 
01-24-02锛氱増鏈2.0.10
 
     -鏇存浜哅ysqlIO涓殑铏氬亣鈥淯nexpected end of input stream鈥濓紙杈撳叆娴佹剰澶栫粨鏉燂級閿欒锛堢己闄507456锛夈
 
     -鏇存浜嗕笌Websphere 4涓璧蜂娇鐢∕ysqlConnectionPoolDataSource鏃剁殑鈥渘ull-pointer-exceptions鈥濓紙缂洪櫡505839锛夈
 
01-13-02锛氱増鏈2.0.9
 
     - Ant鍒涘缓澶辫触锛屽寘鎷琷ar鏂囦欢锛屽凡鏇存锛堢己闄487669锛夈
 
     -鏇存浜哅ysqlIO.readPacket()涓澶栫殑鍐呭瓨鍒嗛厤锛堢己闄488663锛夈
 
     -瀹炵幇浜咲atabaseMetaData.getExported/ImportedKeys()鍜実etCrossReference()銆
 
     -鍦ㄦ洿鏀瑰疄渚嬪拰绫诲叡浜紩鐢ㄧ殑鏂规硶涓婏紝瀹炵幇浜嗗畬鍏ㄥ悓姝ワ紝椹卞姩绋嬪簭鐜板湪鏄畬鍏ㄧ嚎绋嬪畨鍏ㄧ殑锛堝鏋滈亣鍒伴棶棰橈紝璇峰憡璇夋垜锛夈
 
     -灏咲ataSource瀹炴柦绉昏嚦org.gjt.mm.mysql.jdbc2.optional杞欢鍖咃紝PooledConnectionDataSource鍜孹ADataSource鐨勫師濮嬪疄鏂戒粛淇濈暀鍦ㄥ師澶勶紙鎰熻阿Todd Wolff缁欏嚭浜哖ooledConnectionDataSource涓嶪BM WebSphere 4涓璧风殑瀹炴柦鏂规鍜屾祴璇曠粨鏋滐級銆
 
     -澧炲姞浜嗚鍙栦俊鎭寘鏃跺鍏抽棴缃戠粶杩炴帴鐨勬娴嬶紙鎰熻阿Todd Lizambri锛夈
 
     -鏇存浜嗕笌杞箟澶勭悊鍏舵湁鍏崇殑閿欒锛堢己闄486265锛夈
 
     -閫氳繃DatabaseMetaData锛屾敮鎸佹壒鏇存柊锛堢己闄495101锛夈
 
     -鏇存浜哖reparedStatement.setTimestamp()涓亸宸1灏忔椂鐨勯敊璇紙缂洪櫡491577锛夈
 
     -浠庨┍鍔ㄧ▼搴忎腑鍒犻櫎浜嗙骇杩炴敮鎸侊紙鈥渱|鈥濇搷浣滅锛夛紝杈冩棭鐨刅isualAge鐗堟湰浼间箮鏄娇鐢ㄥ畠鐨勫敮涓杞欢锛屽畠涓庨昏緫鈥渱|鈥濇搷浣滅鍐茬獊銆傝鎯充娇鐢ㄢ渱|鈥濇搷浣滅浣滀负绾ц仈锛岄渶瑕佺敤鈥--ansi鈥濇爣蹇楀惎鍔╩ysqld锛堢己闄491680锛夈
 
     -鏇存浜哖reparedStatement涓殑鑸嶅純缂洪櫡锛488663锛夈
 
11-25-01锛氱増鏈2.0.8
 
     -鐜板湪鏀寔鎵规洿鏂帮紙鎰熻阿Daniel Rall鐨勯紦鍔憋級銆
 
     - XADataSource/ConnectionPoolDataSource浠g爜锛堝疄楠屾э級銆
 
     - PreparedStatement.setAnyNumericType()鐜板湪鑳芥纭鐞嗘鎸囨暟锛堝鍔犱簡鈥+鈥濓紝鍥犳MySQL鑳界悊瑙e畠锛夈
 
     - DatabaseMetaData.getPrimaryKeys()鍜実etBestRowIdentifier()鐩墠鍦ㄨ瘑鍒富閿柟闈㈡洿鍔犲彲闈狅紙鍖归厤锛屼笉绠′富閿湪Key_type鍒椾腑鐨勫ぇ灏忓啓銆佹垨缂╁啓锛忓叏鍚嶏級銆
 
10-24-01锛氱増鏈2.0.7
 
     - PreparedStatement.setCharacterStream()鐜板凡瀹炵幇銆
 
     -鏇存浜嗗浜庨珮鍒╃敤鐜囨ā寮忥紙autoReconnect=true锛変笅鏃剁殑鎮寕濂楁帴瀛楅棶棰橈紝杩炴帴鐨刦inalizer灏嗗叧闂换浣曞湪GC涓婃偓鎸傜殑濂楁帴瀛椼
 
     -鏇存浜嗗湪杈冩柊鐗堟湰鐨凪ySQL涓奟esultSetMetaData.getPrecision()杩斿洖鐨勫兼瘮瀹為檯鍊煎皬1鐨勯棶棰樸
 
     -濡傛灉鍒楀间负NULL锛孯esultSet.getBlob()鐜板湪灏嗚繑鍥濶ULL銆
 
     -濡傛灉useUnicode=true鑰屼笖鏈缃甤haracterEncoding锛屽皢浠庢暟鎹簱璇诲彇瀛楃闆嗐傦紙鎰熻阿Dmitry Vereshchagin锛夈
 
     -浠庢暟鎹簱璇诲彇鍒濆浜嬪姟闅旂绾у埆锛堝鏋滃彲鐢ㄧ殑璇濓級锛堟劅璋mitry Vereshchagin锛夈
 
     -鏇存浜咲atabaseMetaData.supportsTransactions()锛宻upportsTransactionIsolationLevel()锛実etTypeInfo() SQL_DATETIME_SUB锛屼互鍙婁笉鍙鍙栫殑SQL_DATA_TYPE瀛楁銆
 
     -鏇存浜嗙敤浜庣敓鎴怱QL骞跺洖鍦ㄦ煇浜涙煡璇腑浠ヨ娉曢敊璇粨鏉熺殑PreparedStatement銆
 
     -鏇存浜哛esultSet.isAfterLast()鎬昏繑鍥炩滃亣鈥濈殑闂銆
 
     -鏇存浜哖reparedStatement.setTimestamp()涓殑鏃跺尯闂锛堟劅璋rik Olofsson锛夈
 
     -鍦║RL鎴栧睘鎬т腑浼犻掍簡鈥渃aptializeTypeNames=true鈥濇椂锛屽皢绫诲瀷鍚嶈浆鎹负澶у啓锛堝浜嶹ebObjects锛屾劅璋njo Krank锛夈
 
     -鍙洿鏂扮粨鏋滈泦鐜板湪鑳芥纭鐞嗗瓧娈典腑鐨凬ULL鍊笺
 
     - PreparedStatement.setDouble()鐜板湪鑳戒娇鐢ㄥ弻绮惧害鍊硷紙鎾ら攢浜嗕互鍓嶆墍浣滅殑鎴彇鏇存锛夈
 
     -濡傛灉MySQL鐨勭増鏈珮浜庢垨绛変簬3.21.23锛孭reparedStatement.setBoolean()灏嗕娇鐢1/0鍊笺
 
06-16-01锛氱増鏈2.0.6
 
     -鏇存浜哖reparedStatement鍙傛暟妫鏌ュ姛鑳姐
 
     -鏇存浜哛esultSet.java涓尯鍒嗗ぇ灏忓啓鐨勫垪鍚嶃
 
06-13-01锛氱増鏈2.0.5
 
     - 鏇存浜哛esultSet.getBlob() ArrayIndex瓒呭嚭鑼冨洿鐨勯棶棰樸
 
     -鏇存浜哛esultSetMetaData.getColumnTypeName鍏充簬TEXT/BLOB鐨勯棶棰樸
 
     -鏇存浜嗗彂閫佸ぇBLOB鏌ヨ鏃剁殑ArrayIndexOutOfBounds闂锛堟湭璁剧疆鏈澶т俊鎭寘澶у皬锛夈
 
     -涓篊onnection.setIsolationLevel()澧炲姞浜咺SOLATION绾у埆鏀寔銆
 
     -鏇存浜嗘墍鏈夊垪鍧囨湭璁剧疆鏃跺湪PreparedStatement.executeUpdate()涓婄殑NPE闂銆
 
     -鏇存浜嗛噰鐢ㄤ袱浣嶆暟瀛楀勾浠界殑TIMESTAMP鐨勬暟鎹В鏋愰棶棰樸
 
     -涓篜reparedStatement.setObject()澧炲姞浜咮yte銆
 
     - ResultSet.getBoolean()鐜板湪鑳藉皢鈥-1鈥濊瘑鍒负鈥滅湡鈥濄
 
     - ResultSet鍏锋湁+/-Inf/inf鏀寔鐗规с
 
     -鍗充娇骞堕潪鎵鏈夊垪鍧囧凡琚缃紙璁句负NULL锛夛紝ResultSet.insertRow()鐜板湪涔熻兘宸ヤ綔銆
 
     - DataBaseMetaData.getCrossReference()涓嶅啀浣跨敤ArrayIndexOOB銆
 
     -浣滅敤鍦ㄧ粨鏋滈泦涓婄殑getObject()鑳芥纭墽琛孴INYINT->Byte鍜孲MALLINT->Short鎿嶄綔銆
 
12-03-00锛氱増鏈2.0.3
 
     -涓篔DBC2瀹炵幇浜嗕笉甯︽爣搴︾粍鍒嗙殑getBigDecimal()銆
 
     -鏇存浜嗕笌鍙洿鏂扮粨鏋滈泦鏈夊叧鐨勫鍚堥敭闂銆
 
     -澧炲姞浜-/+INF瀵瑰弻绮惧害鐨勬娴嬨
 
     -鏇村揩鐨凙SCII瀛楃涓叉搷浣溿
 
     -鏇存浜哅AX_ALLOWED_PACKET鐨勪笉姝g‘妫娴嬶紝鍥犳锛岀幇鍦ㄨ兘鍙戦佸ぇ鐨凚lob銆
 
     -鏇存浜唈ava.sql.Blob瀹炴柦浠g爜涓殑鈥滃亸宸1鈥濋敊璇
 
     -澧炲姞浜嗏渦ltraDevHack鈥漊RL鍙傛暟锛屽皢鍏惰缃负鈥滅湡鈥濓紝鍙厑璁窶acromedia UltraDev浣跨敤璇ラ┍鍔ㄧ▼搴忋
 
04-06-00锛氱増鏈2.0.1
 
     -鏇存浜哛SMD.isWritable()杩斿洖閿欒鍊肩殑闂銆傛劅璋oritz Maass銆
 
     -鏁寸悊浜嗚繛鎺ョ‘瀹氭椂鐨勫紓甯稿鐞嗗姛鑳姐
 
     -浣跨敤getObject()锛屽叿鏈塗EXT绫诲瀷鐨勫垪鐜板湪浼氫綔涓哄瓧绗︿覆杩斿洖銆
 
     - DatabaseMetaData.getPrimaryKeys()鐜板湪鑳芥纭伐浣滐紙鍐欏叆鍒発ey_seq锛夈傛劅璋rian Slesinsky銆
 
     -鎸夌収JDBC瑙勮寖锛屽湪PreparedStatements涓婏紝涓嶅啀杩涜杞箟澶勭悊銆
 
     -鏇存浜嗗緢澶欽DBC-2.0閬嶅巻銆佸畾浣嶉敊璇紝灏ゅ叾鏄啓鍏ョ┖缁撴灉闆嗙殑闂銆傛劅璋on Smits銆丯ick Brook銆丆essar Garcia鍜孋arlos Martinez銆
 
     -鏇存浜嗕娇鐢ㄥ涓富閿椂锛屼笌缁撴灉闆嗕腑鍙洿鏂版ф敮鎸佹湁鍏崇殑涓浜涢棶棰樸
 
02-21-00锛氱増鏈2.0pre5
 
     -鏇存浜嗕笉鑹殑鎻℃墜闂銆
 
01-10-00锛氱増鏈2.0pre4
 
     -鏇存浜嗛拡瀵筰nsertRow()鐨勭粨鏋滈泦锛屾劅璋esar Garcia銆
 
     -瀵归┍鍔ㄧ▼搴忚繘琛屼簡淇敼锛屼娇涔嬭兘澶熼氳繃鍔犺浇JDBC-2.0绫绘潵璇嗗埆JDBC-2.0锛岃屼笉鏄緷闈燡DK鐗堟湰鍙枫傛劅璋ohn Baker銆
 
     -鏇存浜嗙粨鏋滈泦锛屼互杩斿洖姝g‘鐨勮鍙枫
 
     - Statement.getUpdateCount()鐜板湪鑳借繑鍥炲尮閰嶇殑琛岋紝鑰屼笉鏄疄闄呮洿鏂扮殑琛岋紝瀹冩洿鍍廠QL-92銆
 
10-29-99
 
     -鏇存浜哠tatement/PreparedStatement.getMoreResults()缂洪櫡銆傛劅璋oel J. Bergman銆
 
     -涓篜reparedStatement.setObject()澧炲姞浜哠hort绫诲瀷銆傛劅璋eff Crowder銆
 
     -椹卞姩绋嬪簭鐜板湪鑳介氳繃鏌ヨ鏈嶅姟鍣ㄨ嚜鍔ㄩ厤缃渶澶/棣栭夌殑淇℃伅鍖呭ぇ灏忋
 
     -濡傛灉鏈嶅姟鍣ㄦ敮鎸侊紝Autoreconnect浠g爜灏嗕娇鐢ㄦ洿蹇殑ping鍛戒护銆
 
     -鏇存浜嗕粠鏈嶅姟鍣ㄨ鍙栦俊鎭寘銆佷互鍙婁负鍐欏叆鍒版湇鍔″櫒鑰屽垎閰嶄俊鎭寘鏃朵笌淇℃伅鍖呭ぇ灏忔湁鍏崇殑澶氱缂洪櫡銆
 
08-17-99锛氱増鏈2.0pre
 
     -鐩墠鏄湪JDK-1.2涓嬬紪璇戠殑銆傞氳繃鏍稿績绫婚泦鍚堬紝椹卞姩绋嬪簭鍚屾椂鏀寔JDK-1.1鍜孞DK-1.2銆傚湪杩愯鏃讹紝閫氳繃鍒ゆ柇浣犳墍浣跨敤鐨凧VM鐗堟湰锛岄┍鍔ㄧ▼搴忓皢鍔犺浇鎭板綋鐨勬帴鍙g被銆
 
     -淇浜嗗湪棣栬涓叏涓篘ULL鐨勭粨鏋滈泦銆傦紙鐢盩im Endres鎸囧嚭锛夈
 
     -鏇存浜嗙粨鏋滈泦鍐匰QLExceptions鐨勫垪缂栧彿锛堟劅璋las Rodriguez Somoza锛夈
 
     -涓嶅啀闇瑕佸皢鏁版嵁搴撴寚瀹氱粰杩炴帴銆傦紙鎰熻阿Christian Motschke锛夈
 
07-04-99锛氱増鏈1.2b
 
     -鏇村ソ鐨勬枃妗o紙涓嶆柇鏀瑰杽锛夛紝doc/mm.doc/book1.html銆
 
     -瀵逛簬鍒楀悕妯″紡锛孌BMD鐜板湪鍏佽null锛堟湭鍦ㄨ鑼冧腑瀹氫箟锛夛紝瀹冨皢琚洿鏀逛负鈥%鈥濄
 
     - DBMD鐜板湪鎻愪緵浜嗛拡瀵筭etXXX()鐨勬纭被鍨嬶紡闀垮害銆
 
     -淇敼浜哛esultSet.getDate()銆乬etTime()鍜実etTimestamp()銆傦紙鐢盇lan Wilken鎻愪緵锛夈
 
     - EscapeProcessor鐜板湪鑳芥纭鐞嗗紩鍙峰唴鐨勨\{ \}鈥濆拰鈥{ or }鈥濄傦紙鎰熻阿Alik灏卞浣曚慨姝e畠缁欏嚭鐨勮鐐癸級銆
 
     -瀵硅繛鎺ヤ腑鐨勫睘鎬у鐞嗗姛鑳借繘琛屼簡淇銆傦紙鐢盝uho Tikkala鎻愪緵锛夈
 
     -瀵逛簬琛ㄤ腑鐨凬ULL鍒楋紝ResultSet.getObject()鐜板湪鑳借繑鍥濶ULL锛岃屼笉鏄攢姣併傦紙鎰熻阿Ben Grosman锛夈
 
     -瀵逛簬MySQL涓嶄簡瑙g殑绫诲瀷锛孯esultSet.getObject()鐜板湪鑳借繑鍥炲瓧绗︿覆銆傦紙鐢盋hris Perdue寤鸿锛夈
 
     -鍒犻櫎浜嗕笉闇瑕佺殑DataInput/Output娴侊紝瀵逛簬姣忔IO鎿嶄綔锛1锛2鐨勬柟娉曡皟鐢ㄩ兘鏄笉闇瑕佺殑銆
 
     -濡傛灉鏈寚瀹氬瓧绗︾紪鐮侊紝浣跨敤榛樿鐨勫瓧绗︾紪鐮併傝繖鏄宸叉崯鍧廕VM鐨勪竴绉嶉伩瑙勬帾鏂斤紝杩欐槸鍥犱负锛屾寜鐓ц鑼冿紝鎵鏈夌殑JVM閮藉繀椤绘敮鎸佲淚SO8859_1鈥濓紝浣嗗苟闈炲姝ゃ
 
     -鏇存浜嗚繛鎺ヤ簨瀹滐紝濡傛灉鏈槑纭缃瓧绗︾紪鐮侊紝灏嗕娇鐢ㄥ钩鍙扮殑瀛楃缂栫爜锛岃屼笉鏄淚SO8859_1鈥濄傚畠淇浜嗗姞杞藉苟涓嶆诲瓨鍦ㄧ殑瀛楃杞崲鍣ㄧ被鏃跺瓨鍦ㄧ殑闂锛圝VM缂洪櫡锛夈傦紙鎰熻阿Fritz Elfert鎸囧嚭浜嗚闂锛夈
 
     -淇敼浜哅ysqlIO锛屼娇涔嬪湪鍙兘鐨勬儏鍐典笅鍐嶆浣跨敤淇℃伅鍖咃紝鑰屼笉鏄檷浣庡唴瀛樹娇鐢ㄧ巼銆
 
     -鏇存浜嗕笌寮曞彿鍐呪{}鈥濇湁鍏崇殑杞箟澶勭悊鍣ㄧ己闄枫
 
04-14-99锛氱増鏈1.2a
 
     -鏇存浜嗗闈濲avasoft JVM鐨勫瓧绗﹂泦鏀寔锛堟劅璋㈠緢澶氭寚鍑鸿闂鐨勪汉鍛橈級銆
 
     -鏇存浜哛esultSet.getBoolean()锛屼娇涔嬭兘澶熻瘑鍒綔涓哄竷灏旀爣蹇楃殑鈥測鈥濆拰鈥渘鈥濓紝浠ュ強鈥1鈥濆拰鈥0鈥濄傦紙鎰熻阿Tim Pizey锛夈
 
     -鏇存浜哛esultSet.getTimestamp()锛屼互鎻愪緵鏇村ソ鐨勬ц兘銆傦紙鎰熻阿Richard Swift锛夈
 
     - 鏇存浜唃etByte()鍦ㄥ鐞嗘暟鍊肩被鍨嬫柟闈㈢殑闂銆傦紙鎰熻阿Ray Bellis锛夈
 
     - 鏇存浜咲atabaseMetaData.getTypeInfo()鍦ㄥ鐞咲ATE绫诲瀷鏃跺瓨鍦ㄧ殑闂銆傦紙鎰熻阿Paul Johnston锛夈
 
     -鏇存浜嗙敤浜庘渇n鈥濊皟鐢ㄧ殑EscapeProcessor銆傦紙鎰熻阿locomotive.org鐨凱iyush Shah锛夈
 
     -鏇存浜咵scapeProcessor锛屽鏋滄病鏈夎浆涔変唬鐮侊紝涓嶆墽琛岄澶栨搷浣溿傦紙鎰熻阿Ryan Gustafson锛夈
 
     -鏇存浜嗛┍鍔ㄧ▼搴忥紝浣夸箣鑳借В鏋愨渏dbc:mysql://host:port鈥濆舰寮忕殑URL锛堟劅璋ichard Lobb锛夈
 
03-24-99锛氱増鏈1.1i
 
     -鏇存浜嗗叧浜嶱reparedStatements鐨凾imestamps闂銆
 
     -鏇存浜哛SMD鍜孯S涓殑Null鎸囬拡寮傚父銆
 
     -瀵逛簬鏈夋晥鐨勭被鏂囦欢锛屼笌jikes涓璧疯繘琛屼簡鍐嶇紪璇戯紙鎰熻阿ms!锛夈
 
03-08-99锛氱増鏈1.1h
 
     -鏇存浜嗚浆涔夊鐞嗗櫒锛屼互澶勭悊涓嶅尮閰嶇殑鈥{鈥濆拰鈥}鈥濓紙鎰熻阿Craig Coles锛夈
 
     -鏇存浜嗚浆涔夊鐞嗗櫒锛屼互鍒涘缓绉绘鎬ф洿濂界殑锛堝湪DATETIME鍜孴IMESTAMP绫诲瀷闂达級琛ㄨ揪寮忥紝浠ヤ究鑳戒笌BETWEEN瀛愬彞涓璧蜂娇鐢ㄣ傦紙鎰熻阿Craig Longman銆
 
     - MysqlIO.quit()鐜板湪鑳藉叧闂鎺ュ瓧杩炴帴銆傚湪姝や箣鍓嶏紝澶氭杩炴帴澶辫触鍚庯紝鏌愪簺鎿嶄綔绯荤粺灏嗚楀敖鏂囦欢鎻忚堪绗︺傦紙鎰熻阿Michael Brinkman锛夈
 
     -鏇存浜咲river.getPropertyInfo涓殑NullPointerException锛堟劅璋ave Potts锛夈
 
     -淇浜哅ysqlDefs锛屽厑璁稿瓧瀛楃涓插舰寮忔绱㈡墍鏈夌殑*text瀛楁銆傦紙鎰熻阿Chris at Leverage锛夈
 
     -鏇存浜哖reparedStatement涓殑setDouble锛屼娇涔嬭兘鐢ㄤ簬澶勭悊澶ф暟瀛楋紝闃叉灏嗙瀛﹁鏁版硶鍙戦佸埌鏁版嵁搴撱傦紙鎰熻阿J.S. Ferguson锛夈
 
     -鏇存浜哛SMD涓殑getScale()鍜実etPrecision()銆傦紙鐢盝ames Klicman璐$尞锛夈
 
     -鏇存浜嗗瓧娈典负DECIMAL鎴朜UMERIC鏃剁殑getObject()锛堟劅璋ert Hobbs锛夈
 
     -浼犻扤ull琛ㄥ悕鏃讹紝DBMD.getTables()鍑虹幇涓ラ噸鏁呴殰銆傚凡鏇存锛堟劅璋ichard Lobb锛夈
 
     -澧炲姞浜嗗湪杩炴帴杩囩▼涓鈥渃lient not authorized鈥濓紙瀹㈡埛绔湭琚巿鏉冿級閿欒鐨勬鏌ャ傦紙鎰熻阿Hannes Wallnoefer锛夈
 
02-19-99锛氱増鏈1.1g
 
     -缁撴灉闆嗚鐜板湪鏄瓧鑺傛暟缁勩侭lob鍜孶nicode鐜板湪鑳藉弻鍚戝伐浣溿傜洰鍓嶅疄鏂戒簡useUnicode鍜岀紪鐮侀夐」銆
 
     -淇浜哖reparedStatement锛屼娇鐢╯etXXXStream锛堜笉鏀瑰彉鍦板彂閫侊級灏嗕簩杩涘埗闆嗗悎鍙戦佸埌MySQL鏈嶅姟鍣ㄣ
 
     -淇浜唃etDriverPropertyInfo()銆
 
12-31-98锛氱増鏈1.1f
 
     -灏嗘墍鏈夌殑缁撴灉闆嗗瓧娈垫洿鏀逛负瀛楃涓诧紝杩欐牱锛屽簲鑳戒娇Unicode宸ヤ綔锛屼絾浣犵殑JVM蹇呴』鑳藉鍦ㄥ瓧绗﹂泦闂磋繘琛岃浆鎹€傚畠杩樿兘浣垮鏈嶅姟鍣ㄧ殑鏁版嵁璇诲彇鏇村揩锛屽師鍥犲湪浜庯紝鐜板湪涓嶅瓨鍦ㄤ粠StringBuffer鍒癝tring锛堝瓧绗︿覆锛夌殑杞崲銆
 
     -鏇存敼浜哖reparedStatement.streamToString()锛屼娇涔嬫洿鏈夋晥锛堜唬鐮佺敱Uwe Schaefer鎻愪緵锛夈
 
     - URL瑙f瀽鍔熻兘鏇村彲闈狅紙瀵逛簬閿欒锛屾姏鍑篠QL寮傚父锛岃屼笉鏄疦ullPointerExceptions锛夈
 
     - PreparedStatement鐜板湪鑳介氳繃setObject()灏哠tring杞崲涓篢ime/Date鍊硷紙浠g爜鐢盧obert Currey鎻愪緵锛夈
 
     -鍦˙uffer.readInt()涓紝IO杩涚▼涓嶅啀琚寕璧凤紝璇ョ己闄锋槸鍦1.1d涓綋灏嗙粨鏋滈泦鏇存敼涓哄叏瀛楄妭鏁扮粍鏃跺紩鍏ョ殑銆傦紙鐢盨amo Login鎸囧嚭锛夈
 
11-03-98锛氱増鏈1.1b
 
     -淇浜咲atabaseMetaData锛屽厑璁窱BM VA鍜孞-Builder鍚屾椂宸ヤ綔銆傝鍛婅瘔鎴戝畠鐨勫伐浣滄満鍒躲傦紙鎰熻阿Jac Kersing锛夈
 
     -淇浜哛esultSet.getBoolean()鍦ㄥ鐞哊ULL瀛楃涓叉柟闈㈢殑闂锛堟劅璋arry Lagerweij锛夈
 
     -寮濮嬩唬鐮佹暣鐞嗭紝骞惰繘琛屼簡鏍煎紡澶勭悊銆傚紑濮嬪皢鍏跺垎鍑轰负骞惰鐨凧DBC-2.0婧愭爲銆
 
     -涓篗ysqlIO鍜孊uffer鍐呯殑鍏抽敭閮ㄥ垎澧炲姞浜嗏滄渶缁堚濋檺瀹氱锛屽厑璁哥紪璇戝櫒閲囩敤鍐呰仈鏂规硶浠ユ彁楂橀熷害銆
 
9-29-98
 
     -濡傛灉浼犻掔粰PreparedStatement涓璼etXXX()鐨勫璞″紩鐢ㄦ槸绌虹殑锛屽皢鑷姩璋冪敤setNull()銆傦紙鎰熻阿Erik Ostrom缁欏嚭鐨勬彁璁級銆
 
     -瀵逛簬Types.OTHER瀵硅薄鍜屾湭鐭ョ被鍨嬪璞★紝PreparedStatement涓殑setObject()鐜板湪浼氬皾璇曞皢瀵硅薄鐨勪覆琛屽寲琛ㄧず鍐欏叆鍒版暟鎹簱銆
 
     - Util鐜板湪鏈変簡1涓潤鎬佹柟娉時eadObject()锛岀粨鏋滈泦鍜屽垪绱㈠紩灏嗕互涓婅堪鏂瑰紡鍦ㄦ渚嬬ず搴忓垪鍖栫殑瀵硅薄銆
 
9-02-98 鈥 鐗堟湰1.1
 
     -娑堥櫎浜哅ysqlIO.nextRow()涓殑鈥滀笐闄嬬己闄封濄傛洿姝d簡Buffer.isLastDataPacket()锛岃屼笉鏄幏鍙栧紓甯搞
 
     - Connection.getCatalog()鍜孋onnection.setCatalog()鐜板湪鑳藉宸ヤ綔銆
 
     - Statement.setMaxRows()鑳藉姝e父宸ヤ綔锛屼篃鑳戒娇鐢ㄥ睘鎬axRows杩涜璁剧疆銆傞氳繃灞炴ф垨URL鍙傛暟锛孲tatement.setMaxRows()鑳借鐩杕axRows璁剧疆銆
 
     -鎻愪緵浜嗚嚜鍔ㄥ啀杩炴帴鍔熻兘銆傜敱浜庡湪姣忔鏌ヨ鍓嶄笉寰椾笉Ping鏁版嵁搴擄紝鍦ㄩ粯璁ゆ儏鍐典笅锛屽畠灏嗚鍏抽棴銆傝鎯充娇鐢ㄨ鍔熻兘锛岃鍦ㄨ繛鎺RL涓紶閫掆渁utoReconnect=true鈥濄傞氳繃鈥渕axReconnects=n鈥濓紙榛樿涓3锛夊拰鈥渋nitialTimeout=n鈥濓紙榛樿涓2绉掞級鍙傛暟锛屼綘涔熷彲浠ユ洿鏀瑰啀杩炴帴灏濊瘯鐨勬鏁板拰鍒濆瓒呮椂鍊笺俆imeout鏄秴鏃剁殑鎸囨暟琛ュ伩绫诲瀷銆備緥濡傦紝濡傛灉鍒濆瓒呮椂璁剧疆涓2绉掞紝maxReconnects涓3锛岄偅涔堝啀杩炴帴灏濊瘯涔嬮棿鐨勯棿闅斿垎鍒槸2绉掞紝4绉掑拰16绉掋
 
8-24-98锛氱増鏈1.0
 
     - 鏇存浜咮uffer.java涓瑽lob鏁版嵁鐨勫鐞嗗姛鑳姐
 
     -鏇存浜嗕笌灏哄杩囧皬鐨勯壌瀹氫俊鎭寘鏈夊叧鐨勭己闄枫
 
     -JDBC椹卞姩绋嬪簭鐜板湪閲囩敤LPGL銆
 
8-14-98 -
 
     - 鏇存浜 Buffer.readLenString()锛屼娇涔嬭兘姝g‘璇诲彇BLOB鏁版嵁銆
 
     -鏇存浜哖reparedStatement.stringToStream锛屼娇涔嬭兘姝g‘璇诲彇BLOB鏁版嵁銆
 
     -鏇存浜哖reparedStatement.setDate()锛屼娇涔嬩笉澧炲姞1澶┿傦紙鎰熻阿Vincent Partington鍦ㄤ笂杩颁慨姝i」鏂归潰鐨勮础鐚級銆
 
     -澧炲姞浜哢RL鍙傛暟瑙f瀽鍔熻兘锛?user=...绛夌瓑锛夈
 
 
8-04-98锛氱増鏈0.9d
 
     - 閲嶅ぇ鏂伴椈锛 鏂扮殑杞欢鍖呭悕銆侷CE宸ョ▼鍏徃鐨凾im Endres鐫鎵嬩负GNU GPL鐨凧ava杞欢寤虹珛鏂扮殑婧愭爲銆備粬鍙嬪ソ鍦板皢org.gjt.mm杞欢鍖呯洰褰曟彁渚涚粰鎴戯紝鍥犳锛岀幇鍦ㄩ┍鍔ㄧ▼搴忓湪org.gjt.mm.mysql杞欢鍖呬腑銆傜洰鍓嶆垜鏄悎娉曠敤鎴枫傛湡寰匱im椤圭洰鐨勬洿澶氫俊鎭
 
     -鐜板湪閲囩敤浜嗗姩鎬佺‘瀹氬ぇ灏忕殑淇℃伅鍖咃紝鍚戞暟鎹簱鍙戦佸懡浠ゆ椂锛岃兘澶熷噺灏戝唴瀛樹娇鐢ㄣ
 
     -瀵筭etTypeInfo()鐨勫弬鏁扮瓑鏂归潰杩涜浜嗗皬鐨勪慨姝c
 
     - DatabaseMetaData鐜板凡瀹屽叏瀹炵幇銆傚鏋滆繖浜涢┍鍔ㄧ▼搴忚兘涓庡悇绉岻DE涓璧峰伐浣滐紝璇峰憡鐭ャ傛垜宸插惉璇村畠浠涓嶫builder涓璧蜂娇鐢ㄣ
 
     -鍦ㄨ蒋浠跺寘涓鍔犱簡JavaDoc鏂囨。銆
 
     -杞欢鍖呴噰鐢.zip鎴.tar.gz鏍煎紡鎻愪緵銆
 
7-28-98锛氱増鏈0.9
 
     -瀹炵幇浜唃etTypeInfo()銆傛牴鎹甁DBC瑙勮寖锛孋onnection.rollback()鐜板湪鑳芥姏鍑篠QLException銆
 
     -澧炲姞浜哖reparedStatement锛屽畠鏀寔棰勫鐞嗚鍙ョ殑鎵鏈塉DBC API鏂规硶锛屽寘鎷琁nputStreams銆傝妫鏌ヨ鐐癸紝濡傛湁闂锛岃鍛婄煡銆
 
     -鏇存浜哛esultSet涓殑1涓己闄凤紝璇ョ己闄蜂細鐮村潖浠呰繑鍥1琛岀殑鏌愪簺鏌ヨ銆
 
     - 鏇存浜咲atabaseMetaData.getTables()銆丏atabaseMetaData.getColumns()鍜孌atabaseMetaData.getCatalogs()涓瓨鍦ㄧ殑缂洪櫡銆
 
     -澧炲姞浜嗚鍙ョ殑鍔熻兘锛屽厑璁竐xecuteUpdate()淇濆瓨鐢盇UTO_INCREMENT瀛楁鑷姩鐢熸垚鐨処D鍊笺備竴鑸岃█锛屾墽琛宔xecuteUpdate()鍚庯紝灏嗘煡鎵維QLWarnings浠ヤ簡瑙h鍛婁俊鎭紝濡侺AST_INSERTED_ID = 'some number'锛孋OMMAND = 'your SQL query'銆
 
 濡傛灉鍦ㄨ〃涓浣跨敤AUTO_INCREMENT瀛楁锛屽苟鍦ㄤ竴鏉¤鍙ヤ笂鎵ц浜嗗涓猠xecuteUpdate()锛屽姟蹇呮瘡娆¢兘鎵цclearWarnings()浠ヨ妭鐪佸唴瀛樸
 
7-06-98锛氱増鏈0.8
 
     -灏哅ysqlIO鍜孊uffer鍒嗙涓哄崟鐙被銆傚浜庤繖涓や釜绫讳腑鐨勬煇浜涘瓧娈碉紝涓浜汣lassLoader锛堢被鍔犺浇鍣級浼氱粰鍑篒llegalAccess锛堥潪娉曡闂級閿欒銆傜幇鍦紝mm.mysql鑳藉鍦ㄥ皬搴旂敤绋嬪簭鍜屾墍鏈夌被鍔犺浇鍣ㄤ腑姝e父宸ヤ綔銆
 
 鎰熻阿Joe Ennis jce@mail.boone.com鎸囧嚭璇ラ棶棰橈紝骞朵笌鎴戜竴璧疯繘琛屼簡淇銆
 
7-01-98锛氱増鏈0.7
 
     -鏇存浜唃etColumns()涓殑DatabaseMetadata problems锛屽苟鏇存浜嗗瓧娈垫瀯閫犲嚱鏁板唴寮鍏宠鍙ヤ腑瀛樺湪鐨勭己闄枫
 
 鎰熻阿Costin Manolache costin@tdiinc.com鎸囧嚭浜嗗畠浠
 
5-21-98锛氱増鏈0.6
 
     -鍦∕ysqlIO.java鍜孯esultSet.java涓紝缁撳悎Richard Swift Richard.Swift@kanatek.ca缁欏嚭鐨勬湁鏁堝彉鏇村唴瀹广
 
     -鐜板湪锛屾垜浠殑椹卞姩绋嬪簭姣擥WE鐨勯┍鍔ㄧ▼搴忓揩15锛呫
 
     - 寮濮嬬潃鎵嬪鐞咲atabaseMetaData銆
 
 瀹炵幇浜嗕笅杩版柟娉曪細
  * getTables()
  * getTableTypes()
  * getColumns
  * getCatalogs()

26.4.聽MySQL Connector/MXJ

26.4.1. 鍓嶈█

MySQL Connector/MXJ鏄竴绉岼ava瀹炵敤宸ュ叿杞欢鍖咃紝鐢ㄤ簬閮ㄧ讲鍜岀鐞哅ySQL鏁版嵁搴撱傚彲浠ュ皢Connector/MXJ鎹嗙粦鍒板凡鏈夌殑Java搴旂敤绋嬪簭锛屾垨灏嗗叾浣滀负JMX Mbean閮ㄧ讲銆侻ySQL鐨勯儴缃插拰浣跨敤鍗佸垎绠鍗曪紝灏卞儚涓篔DBC杩炴帴URL娣诲姞棰濆鍙傛暟涓鏍风畝鍗曪紝杩炴帴寤虹珛鍚庯紝杩炴帴URL灏嗗惎鍔ㄦ暟鎹簱銆傝繖鏍凤紝Java寮鍙戜汉鍛樿兘澶熼氳繃闄嶄綆鍏舵渶缁堢敤鎴风殑瀹夎闅惧害锛屾洿瀹规槗鍦伴儴缃查渶瑕佹暟鎹簱鐨勫簲鐢ㄧ▼搴忋

MySQL Connector/MXJ浣垮緱MySQL鏁版嵁搴撳儚鏄熀浜巎ava鐨勭粍浠躲傚畠閫氳繃涓嬭堪姝ラ瀹屾垚璇ヤ换鍔★紝纭畾绯荤粺鎵杩愯鐨勫钩鍙帮紝閫夋嫨鎭板綋鐨勪簩杩涘埗鏂囦欢锛屽苟鎵ц绋嬪簭銆備篃鑳藉彲閫夊湴閮ㄧ讲鍏锋湁浠讳綍鎸囧畾鍙傛暟鐨勪釜鍒濆鏁版嵁搴撱

浣滀负涓绉岼MX Mbean锛孧ySQL Connector/MXJ闇瑕佷笌JMX v1.2鍏煎鐨凪bean瀹瑰櫒锛屽Jboss鐗堟湰4銆侻bean灏嗕娇鐢ㄦ爣鍑嗙殑JMX绠$悊API鏉ュ睍绀轰笌骞冲彴鐩搁傚簲鐨勫弬鏁帮紙骞跺厑璁歌缃弬鏁帮級銆

鍏朵腑鍖呭惈涓嶫DBC椹卞姩绋嬪簭涓璧蜂娇鐢ㄧ殑璇存槑锛屼互鍙婁互JMX Mbean鏂瑰紡灏嗗叾閮ㄧ讲鑷矹boss鐨勮鏄庛

鍙粠涓嬭堪绔欑偣涓嬭浇婧愮増鏈拰浜岃繘鍒剁増鏈細http://dev.mysql.com/downloads/connector/mxj/

杩欐槸涓绉嶆祴璇曟澘锛屾杩庡弽棣堝拰榧撳姳銆

濡傛湁浠讳綍闂鎴栨剰瑙侊紝璇峰彂閫佺數瀛愰偖浠惰嚦java@lists.mysql.com

26.4.2. 鏀寔骞冲彴锛

  • Linux, i386

  • Windows NT, x86

  • Windows 2000, x86

  • Windows XP, x86

  • Solaris 9, SPARC 32

26.4.3. Junit娴嬭瘯瑕佹眰

瑕佹兂纭繚浣犵殑骞冲彴鏄湪鏀寔鑼冨洿鍐咃紝鏈濂芥柟娉曟槸杩愯Junit娴嬭瘯銆

棣栧厛搴旂‘淇濈粍浠惰兘澶熷湪骞冲彴涓婂伐浣溿傜敱浜庘淢ysqldResource鈥濈被瀹為檯涓婃槸MySQL鍥烘湁鐗堟湰鐨勫寘瑁呭櫒锛屽苟闈炴墍鏈夌殑骞冲彴鍧囨敮鎸佸畠銆傜紪鍐欐湰鏂囨椂锛屽杩愯鍦╥386鏋舵瀯涓婄殑Linux杩涜浜嗘祴璇曪紝鐪嬩笂鍘诲伐浣滆壇濂斤紝灏卞儚鍦∣S X v10.3涓婁竴鏍枫傚湪Windows鍜孲olaris骞冲彴涓婅繘琛屼簡鏈夐檺娴嬭瘯銆

瑕佹眰锛

1.    JDK-1.4鎴栨洿楂樼増鏈紙鎴朖RE锛屽鏋滀笉鎵撶畻缂栬瘧婧愭枃浠舵垨JSP鐨勮瘽锛夈

2.    閫氳繃CLASSPATH瀹夎浜嗗苟鎻愪緵浜哅ySQL Connector/J鐗堟湰3.1鎴栨洿楂樼増鏈紙http://dev.mysql.com/downloads/connector/j/ 锛夈

3.    鐢ㄤ簬JMX鐗堟湰1.2.1鐨javax.management绫伙紝瀹冧滑浣嶄簬涓嬭堪搴旂敤鏈嶅姟鍣ㄤ笂锛

         JBoss - 4.0rc1鎴栨洿楂樼増鏈

         Apache Tomcat - 5.0鎴栨洿楂樼増鏈

         Sun鍏徃鐨凧MX鍙傝冨疄鏂界増鏈1.2.1锛http://java.sun.com/products/JavaManagement/

4.      Junit 3.8.1锛http://www.junit.org/

濡傛灉浠庢簮鐮佸垱寤猴紝闄や簡涓婅堪鎵鏈夎姹傚锛岃繕椤绘弧瓒筹細

1.      Ant鐗堟湰1.5鎴栨洿楂樼増鏈紙鍙粠http://ant.apache.org/涓婁笅杞斤級銆

26.4.4. 杩愯Junit娴嬭瘯

1.    杩欑被娴嬭瘯灏嗗皾璇曞湪3336绔彛涓婂惎鍔∕ySQL銆傚鏋滄湁姝e湪杩愯鐨凪ySQL锛屽彲鑳戒細鍑虹幇鍐茬獊锛屼絾鍙兘鎬т笉澶э紝鍘熷洜鍦ㄤ簬MySQL鐨勯粯璁ょ鍙f槸3306銆傜劧鑰岋紝涔熷彲浠ュ皢鈥渃-mxj_test_port鈥滼ava灞炴ц缃负浣犳墍閫夋嫨鐨勭鍙c備綔涓哄彲閫夋柟寮忥紝浣犱篃鍙互閫氳繃鍏抽棴杩愯鍦ㄧ洰鏍囨満鍣ㄤ笂鐨凪ySQL瀹炰緥鏉ュ惎鍔ㄦ祴璇曘

榛樿鎯呭喌涓嬶紝娴嬭瘯缁撴灉灏嗚緭鍑哄埌鎺у埗鍙般傝鎯宠幏寰楄缁嗚緭鍑猴紝鍙互灏嗏渃-mxj_test_silent鈥滼ava灞炴ц缃负鈥滃亣鈥濄

2.    瑕佹兂杩愯Junit娴嬭瘯濂椾欢锛$CLASSPATH蹇呴』鍖呭惈涓嬭堪閮ㄥ垎锛

         JUnit

         JMX

         Connector/J

         MySQL Connector/MXJ

3.    濡傛灉浣犱笅杞界殑鏂囦欢涓笉鍚connector-mxj.jar锛岃瑙e寘MySQL Connector/MXJ婧愮爜妗f鏂囦欢銆

4.           cd mysqldjmx
5.           ant dist
     

闅忓悗锛屽皢$TEMP/cmxj/stage/connector-mxj/connector-mxj.jar娣诲姞鍒CLASSPATH锛堢被璺緞锛夈

6.    濡傛灉鏈junit锛屾墽琛屽崟鍏冩祴璇曘浠庡懡浠よ涓婅緭鍏ワ細

7.           java junit.textui.TestRunner com.mysql.management.AllTestsSuite
    

杈撳嚭涓庝笅闈㈢粰鍑虹殑绫讳技锛

.........................................
.........................................
..........
Time: 259.438
 
OK (101 tests)
  

娉ㄦ剰锛屽湪蹇粨鏉熸椂閫熷害浼氬彉鎱紝璇疯愬績绛夊欍

26.4.5. 浣滀负JDBC椹卞姩绋嬪簭鐨勪竴閮ㄥ垎杩愯

MySQL Connector/J JDBC椹卞姩绋嬪簭鐨1涓壒鐐规槸锛岃兘澶熷湪JDBC杩炴帴瀛楃涓蹭腑灏嗏淪ocketFactory鈥濇寚瀹氫负鍙傛暟銆侻ySQL Connector/MXJ鍖呭惈1涓畾鍒剁殑SocketFactory銆傞娆¤繛鎺ユ椂锛孲ocketFactory灏嗛儴缃插苟鍚姩MySQL鏁版嵁搴撱係ocketFactory涔熶細鏄剧ず1涓渟hutdown鈥濇柟娉曘

瑕佹兂浣跨敤瀹冿紝璇峰湪JDBC杩炴帴瀛楃涓蹭笂鎸囧畾鈥渟ocketFactory鈥濆弬鏁帮紝骞跺皢鍏跺艰涓衡渃om.mysql.management.driverlaunched.ServerLauncherSocketFactory鈥濄

鍦ㄤ笅闈㈢殑绀轰緥涓紝鏈1涓兘鍒涘缓杩炴帴鐨勭▼搴忥紝鎵ц鏌ヨ锛屽苟灏嗙粨鏋滆緭鍑哄埌System.out銆侻ySQL鏁版嵁搴撳皢浣滀负杩炴帴杩涚▼鐨勭粍鎴愰儴鍒嗕簣浠ラ儴缃插苟鍚姩锛屾渶鍚庢槸缁撴潫閮ㄥ垎銆

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

import com.mysql.management.driverlaunched.ServerLauncherSocketFactory;

public class ConnectorMXJTestExample {
    public static void main(String[] args) throws Exception {
        String hostColonPort = "localhost:3336";
        
        String driver = com.mysql.jdbc.Driver.class.getName();
        String url = "jdbc:mysql://" + hostColonPort + "/" + "?"
                + "socketFactory="
                + ServerLauncherSocketFactory.class.getName();
        String userName = "root";
        String password = "";

        Class.forName(driver);
        Connection conn = null;
        try {
            conn = DriverManager.getConnection(url, userName, password);
            Statement stmt = conn.createStatement();
            ResultSet rs = stmt.executeQuery("SELECT VERSION()");
            rs.next();
            String version = rs.getString(1);
            rs.close();
            stmt.close();

            System.out.println("------------------------");
            System.out.println(version);
            System.out.println("------------------------");
        } finally {
            try {
                conn.close();
            } catch (Exception e) {
                e.printStackTrace();
            }
            ServerLauncherSocketFactory.shutdown(hostColonPort);
        }
    }
}
  

瑕佹兂杩愯涓婅堪绋嬪簭锛屽湪CLASSPATH涓繀椤绘湁connector-mxj.jar鍜孋onnector/J銆傜劧鍚庨敭鍏ワ細

java ConnectorMXJTestExample
  

褰撶劧锛屽浜嶮ySQL鏁版嵁搴擄紝鏈夊緢澶氬彲璁剧疆鐨勯夐」銆傞氳繃涓烘瘡涓湇鍔″櫒閫夐」鍐犱互鍓嶇紑鈥渟erver鈥濓紝鍙皢鍏朵綔涓篔DBC杩炴帴瀛楃涓茬殑閮ㄥ垎锛岀畝鍗曞湴鎸囧畾杩欎簺閫夐」銆傚湪涓嬭堪绀轰緥涓紝鎴戜滑璁剧疆浜3涓┍鍔ㄧ▼搴忓弬鏁板拰2涓湇鍔″櫒鍙傛暟锛

        String url = "jdbc:mysql://" + hostColonPort + "/" 
                + "?"
                + "socketFactory="
                + ServerLauncherSocketFactory.class.getName();
                + "&"
                + "cacheServerConfiguration=true"
                + "&"
                + "useLocalSessionState=true"
                + "&"
                + "server.basedir=/opt/myapp/db"
                + "&"
                + "server.datadir=/mnt/bigdisk/myapp/data";
  

26.4.6. 鍦↗ava瀵硅薄涓繍琛

鏈1涓猨ava搴旂敤绋嬪簭骞舵墦绠楀祵鍏ySQL鏁版嵁搴擄紝鐩存帴浣跨敤com.mysql.management.MysqldResource绫汇傚彲浠ヤ娇鐢ㄩ粯璁ょ殑鏋勯犲嚱鏁帮紙鏃犲弬閲忥級渚嬬ず璇ョ被锛屾垨鑰呴氳繃鍦╦ava.io.File瀵硅薄锛堜唬琛ㄥ笇鏈涙湇鍔″櫒瑙e寘鑷崇殑鐩綍锛変腑浼犻掔被鏉ヤ緥绀轰箣銆備篃鍙敤閽堝鈥渟tdout鈥濆拰鈥渟tderr鈥濓紙鐢ㄤ簬璁板綍锛夌殑杈撳嚭娴佷緥绀哄畠銆

涓鏃﹀畬鎴愪緥绀猴紝java.util.Map锛岃瀵硅薄灏嗚兘鎻愪緵涓庡钩鍙颁互鍙婂笇鏈涗娇鐢ㄧ殑MySQL鐗堟湰鐩搁傚簲鐨勬湇鍔″櫒閫夐」鐨刯ava.util.Map銆

MysqldResource鍏佽浣犱娇鐢ㄦ墍鎻愪緵鐨勬湇鍔″櫒閫夐」鐨刯ava.util.Map鍚姩MySQL锛屽苟鍏佽浣犲叧闂暟鎹簱銆傚湪涓嬮潰鐨勭ず渚嬩腑锛岀粰鍑轰簡浣跨敤鏄庣爜java瀵硅薄灏哅ySQL宓屽叆鍒板簲鐢ㄧ▼搴忕殑绠鍗曟柟娉曘

import com.mysql.management.MysqldResource;

 ...

    public void startMySQL() {
        File baseDir = new File(ourAppDir, "mysql");
        mysqldResource = new MysqldResource(baseDir);
        Map options = new HashMap();
        options.put("port", "3336");
        String threadName = "OurApp MySQL";
        mysqldResource.start(threadName, options);
    }
    
    public void stopMySQL() {
        if (mysqldResource != null) {
            mysqldResource.shutdown();
        }
        mysqldResource = null;
    }
    
    public java.sql.Connection getConnection() throws Exception {
        String db = "test";
        String url = "jdbc:mysql://localhost:3336/" + db;
        String userName = "root";
        String password = "";
        Class.forName(com.mysql.jdbc.Driver.class.getName());
        return DriverManager.getConnection(url, userName, password);
    }
  

26.4.7. MysqldResource API

鏋勯犲嚱鏁帮細

         public MysqldResource(File baseDir, PrintStream out, PrintStream err);

鍏佽璁剧疆瀹夎MySQL鏂囦欢鐨勨渂asedir鈥濓紝骞惰缃爣鍑嗚緭鍑哄拰鏍囧噯閿欒鐨勮緭鍑烘祦銆

         public MysqldResource(File baseDir);

鍏佽璁剧疆瀹夎MySQL鏂囦欢鐨勨渂asedir鈥濄傛爣鍑嗚緭鍑哄拰鏍囧噯閿欒鐨勮緭鍑哄皢琚鑷砈ystem.out鍜孲ystem.err銆

         public MysqldResource();

Basedir鏄痡ava.io.tempdir鐨勯粯璁ゅ瓙鐩綍銆傛爣鍑嗚緭鍑哄拰鏍囧噯閿欒鐨勮緭鍑哄皢琚鑷砈ystem.out鍜孲ystem.err銆

MysqldResource API鍖呭惈涓嬭堪鏂规硶锛

         void start(String threadName, Map mysqldArgs);

閮ㄧ讲骞跺惎鍔∕ySQL銆傗渢hreadName鈥濆瓧绗︿覆鐢ㄤ簬鍛藉悕瀹為檯鎵цMySQL鍛戒护琛屽懡浠ょ殑绾跨▼銆傗渕ap鈥濇槸灏嗚浼犻掔粰鍛戒护琛岀殑鍙傞噺鍜屽弬鑱斿肩殑闆嗗悎銆

         void shutdown();

鍏抽棴鐢盡ysqldResource瀵硅薄绠$悊鐨凪ySQL瀹炰緥銆

         Map getServerOptions();

杩斿洖鎵鏈夐夐」浠ュ強MySQL鏁版嵁搴撳彲鐢ㄧ殑褰撳墠閫夐」锛堟垨榛樿閫夐」锛屽鏋滄湭杩愯鐨勮瘽锛夌殑鏄犲皠銆

         boolean isRunning();

濡傛灉MySQL鏁版嵁搴撴鍦ㄨ繍琛岋紝杩斿洖鈥滅湡鈥濄

         boolean isReadyForConnections();

涓鏃︽暟鎹簱閫氭姤瀹冨凡鍋氬ソ杩炴帴鍑嗗锛岃繑鍥炩滅湡鈥濄

         void setKillDelay(int millis);

榛樿鐨勨淜ill Delay鈥濇槸30绉掋傚畠琛ㄧず鍙戝嚭鍒濆鍏抽棴璇锋眰鍜屽彂鍑衡滃己鍒舵潃姝烩濓紙濡傛灉鏁版嵁搴撴湭鍏抽棴锛夊懡浠や箣闂撮渶瑕佺瓑寰呯殑鏃堕棿銆

         void addCompletionListenser(Runnable listener);

褰撴湇鍔″櫒杩涚▼瀹屾垚鏃讹紝鍏佽閫氱煡搴旂敤绋嬪簭銆傛瘡涓渓istener鈥濓紙鐩戝惉绋嬪簭锛夊皢鍦ㄨ嚜宸辩殑绾跨▼涓彂鍑恒

         String getVersion();

杩斿洖MySQL鐨勭増鏈

         void setVersion(int MajorVersion, int minorVersion, int patchLevel);

鏍囧噯鍒嗗彂鐗堟湰浠呮彁渚涗簡1绉嶇増鏈殑MySQL杞欢鍖呫備絾涔熻兘灏嗗涓増鏈皝瑁呭湪涓璧凤紝骞舵寚瀹氳浣跨敤鐨勭増鏈

26.4.8. 鍦↗MX浠g悊(custom)涓繍琛

濡傛灉浣犳鍦ㄤ娇鐢↗MX鐨凷UN鍙傝冨疄鏂界増鏈紝鍙烦杩囨湰鑺傘傛垨鑰咃紝濡傛灉浣犳鍦ㄩ儴缃睯boss锛岃璺冲埌涓嬩竴鑺傘

鎴戜滑甯屾湜鍦↗MX浠g悊鐨勬椿鍔ㄤ腑鐪嬪埌MysqldDynamicMBean銆傚湪com.mysql.management.jmx.sunri杞欢鍖呬腑锛屽畠鏄甫鏈2涓狹beans鐨凧MX浠g悊锛

1.      MysqldDynamicMBean锛屼互鍙

2.    com.sun.jdmk.comm.HtmlAdaptorServer锛屽畠鎻愪緵浜嗙敤浜庢搷鎺MX浠g悊鍐呬紬澶氬厓绱犵殑Web鎺ュ彛銆

鍚姩浜嗚繖涓崄鍒嗙畝鍗曠殑浠g悊绋嬪簭鍚庯紝鍏佽鐢╓eb娴忚鍣ㄥ惎鍔ㄥ苟鍋滄MySQL鏁版嵁搴撱

1.    濡傚墠鎵杩帮紝瀹屾垚骞冲彴娴嬭瘯銆

         褰撳墠JDK, JUnit, Connector/J, MySQL Connector/MXJ

         鏈妭闇瑕丣MX鐨凷UN鍙傝冨疄鏂界増鏈

         PATH, JAVA_HOME, ANT_HOME, CLASSPATH

2.      濡傛灉涓嶆槸浠庢簮鐮佸垱寤虹殑锛岃烦鍒颁笅涓姝ャ

rebuild with the "sunri.present"

ant -Dsunri.present=true dist 
re-run tests:
java junit.textui.TestRunner com.mysql.management.AllTestsSuite

3.    浠庡懡浠よ鍚姩娴嬭瘯浠g悊锛

4.    java com.mysql.management.jmx.sunri.MysqldTestAgentSunHtmlAdaptor &
     

5.    浠庢祻瑙堝櫒锛

6.           http://localhost:9092/
     

7.      鍦∕ysqldAgent涓

8.             閫夋嫨鈥渘ame=mysqld鈥
     

9.      瑙傚療Mbean瑙嗗浘

10.  婊氬姩鍒板睆骞曞簳閮紝鎸startMysqld鎸夐挳

11.  鐐瑰嚮鈥Back to MBean View鈥濓紙杩斿洖Mbean瑙嗗浘锛

12.  婊氬姩鍒板睆骞曞簳閮紝鎸stopMysqld鎸夐挳

13.  鏉姝昏繍琛屾祴璇曚唬鐞嗙殑Java杩涚▼锛坖mx鏈嶅姟鍣級

26.4.9. 閮ㄧ讲鍦ㄦ爣鍑嗙殑JMX浠g悊鐜涓 (JBoss)

涓鏃︾‘瀹歁bean鑳藉鍦ㄥ钩鍙颁笂宸ヤ綔锛屾帴涓嬫潵搴斿湪鏍囧噯鐨凧MX浠g悊鍐呴儴缃睲bean銆傚叾涓寘鍚儴缃插埌Jboss鐨勮鏄庛

1.    纭繚鏈夋渶鏂扮増鏈殑java寮鍙戝伐鍏风锛坴1.4.x锛夛紝璇峰弬瑙佸墠闈㈢殑浠嬬粛銆

         纭繚璁剧疆JAVA_HOME锛圝boss瑕佹眰JAVA_HOME锛夈

         纭繚JAVA_HOME/bin浣嶄簬PATH涓紙涓嶉渶瑕佽缃瓹LASSPATH锛屼篃涓嶉渶瑕佷互鍓嶆祴璇曚腑浣跨敤鐨勪换浣昷ar鏂囦欢锛夈

2.      纭繚瀹夎浜咼boss鐨勬渶鏂扮増鏈紙v4.0RC1鎴栨洿楂橈級銆

3.             http://www.jboss.org/index.html
4.             閫夋嫨鈥淒ownloads鈥濄
5.             閫夋嫨鈥渏boss-4.0.zip鈥濄
6.             閫夋嫨1涓暅鍍忋
7.             unzip ~/dload/jboss-4.0.zip
8.             鍒涘缓JBOSS_HOME鐜鍙橀噺锛岃缃В鍖呯洰褰曘
9.             浠呭Unix锛
10.       cd $JBOSS_HOME/bin
11.       chmod +x *.sh

12.connector-mxj.jar瀹夎锛堟嫹璐濓級鍒$JBOSS_HOME/server/default/lib

13.mysql-connector-java-3.1.4-beta-bin.jar瀹夎锛堟嫹璐濓級鍒$JBOSS_HOME/server/default/lib

14.$JBOSS_HOME/server/default/deploy涓嬪垱寤簃xjtest.war鐩綍銆

15.  index.jsp瀹夎锛堟嫹璐濓級鍒$JBOSS_HOME/server/default/deploy/mxjtest.war銆

16.$JBOSS_HOME/server/default/deploy涓嬪垱寤簃ysqld-service.xml鏂囦欢

17.       <?xml version="1.0" encoding="UTF-8"?>
18.        <server>
19.         <mbean code="com.mysql.management.jmx.jboss.JBossMysqldDynamicMBean"
20.            name="mysql:type=service,name=mysqld">
21.         <attribute name="datadir">/tmp/xxx_data_xxx</attribute>
22.         <attribute name="autostart">true</attribute>
23.         </mbean>
24.        </server>
     

25.鍚姩jboss锛

         鍦║nix涓婏細$JBOSS_HOME/bin/run.sh

         鍦╓indows涓婏細%JBOSS_HOME%\bin\run.bat

鍑嗗灏辩华锛欽boss鍦ㄥ睆骞曚笂鏄剧ず澶ч噺杈撳嚭銆

26.  褰揓boss鐪嬩笂鍘诲仠姝㈠皢淇℃伅杈撳嚭鍒板睆骞曚笂鏃讹紝鎵撳紑Web娴忚鍣細http://localhost:8080/jmx-console

27.婊氬姩鍒mysql閮ㄥ垎椤甸潰搴曢儴锛岄夋嫨bulleted mysqld閾炬帴銆

28.瑙傚療JMX MBean View椤甸潰銆侻ySQL搴斿凡杩愯銆

29.  锛堝鏋滆缃簡鈥渁utostart=true鈥濆彲璺宠繃璇ユ锛夈傛粴鍔ㄥ埌灞忓箷搴曢儴銆傛寜Invoke鎸夐挳鍋滄锛堟垨鍚姩锛塎ySQL锛岃瀵熷凡鎴愬姛瀹屾垚鑰屼笖鏃犺繑鍥炲肩殑鎿嶄綔銆傜偣鍑烩Back to MBean View鈥濓紙杩斿洖Mbean瑙嗗浘锛

30.  瑕佹兂纭畾MySQL鏄惁姝e湪杩愯锛屾墦寮Web娴忚鍣http://localhost:8080/mxjtest/锛屽簲鐪嬪埌锛

SELECT 1

returned with a result of

1

31.鎸夌収$JBOSS_HOME/server/default/deploy/mxjtest.war/index.jsp涓殑浠嬬粛锛岃兘澶熷湪浣犵殑Web搴旂敤绋嬪簭涓浣跨敤MySQL銆傚叾涓彁渚涗簡渚涙祴璇曠敤鐨勬祴璇曟暟鎹簱鍜屾牴鐢ㄦ埛锛堟棤瀵嗙爜锛夈傚垱寤鸿〃锛屾彃鍏ヤ竴浜涜锛屽苟杩涜涓浜涢夋嫨銆

32.  鍏抽棴MySQL銆傚仠姝boss鏃讹紝MySQL灏嗚嚜鍔ㄥ仠姝紝鎴栵細鍦ㄦ祻瑙堝櫒涓紝婊氬姩鍒癕Bean View搴曢儴锛屽苟鎸夊仠姝㈡湇鍔Invoke鎸夐挳涓鏈嶅姟銆瑙傚療宸叉垚鍔熷畬鎴愯屼笖鏃犺繑鍥炲肩殑鎿嶄綔銆備娇鐢ps鎴栦换鍔$鐞嗗櫒鏌ョ湅MySQL鏄惁宸蹭笉鍐嶈繍琛屻

瀵逛簬1.0.6-beta鐗堬紝鑳藉鍦ㄥ惎鍔ㄦ椂璁㎝bean鍚姩MySQL鏁版嵁搴撱傛澶栵紝鎴戜滑杩樺熼壌浜咼boss鐢熷懡鍛ㄦ湡鎵╁睍鏂规硶鐨勪紭鐐癸紝鍏抽棴Jboss鏃惰兘浼橀泤鍦板叧闂暟鎹簱銆

26.4.10. 瀹夎

濡傛灉闃呰浜嗕笂杩伴儴鍒嗭紝搴斿凡瀹屾垚浜嗚繖浜涙楠ゃ備絾鎴戜滑鍦ㄤ笅闈㈠垪鍑轰簡瀹冧滑锛屼互渚涘揩閫熷弬鑰冦

鍚姩浜嗛┍鍔ㄧ▼搴忥細

1.      涓嬭浇骞惰В鍖匔onnector/MXJ锛屽皢connector-mxj.jar娣诲姞鍒癈LASSPATH銆

2.    涓篔DBC杩炴帴瀛楃涓叉坊鍔犱笅杩板弬鏁帮細"socketFactory=" + ServerLauncherSocketFactory.class.getName()

JBoss:

1.    涓嬭浇Connector/MXJ锛屽皢connector-mxj.jar鏂囦欢鎷疯礉鍒扮洰褰$JBOSS_HOME/server/default/lib

2.    涓嬭浇Connector/J锛屽皢connector-mxj.jar鏂囦欢鎷疯礉鍒扮洰褰$JBOSS_HOME/server/default/lib

3.    鏈変换鎰忓睘鎬ц缃湪$JBOSS_HOME/server/default/deploy鐩綍涓嬪垱寤Mbean鏈嶅姟xml鏂囦欢锛屼緥濡datadirautostart

4.      璁剧疆Web搴旂敤绋嬪簭鐨凧DBC鍙傛暟锛屼互浣跨敤锛String driver = "com.mysql.jdbc.Driver"; String url = "jdbc:mysql:///test?propertiesTransform="+ "com.mysql.management.jmx.ConnectorMXJPropertiesTransform"; String user = "root"; String password = ""; Class.forName(driver); Connection conn = DriverManager.getConnection(url, user, password);

浣犳垨璁稿笇鏈涗负姣忎釜搴旂敤绋嬪簭鍒涘缓鍗曠嫭鐢ㄦ埛鍜屾暟鎹簱琛ㄧ┖闂达紝鑰屼笉鏄娇鐢ㄦ牴鐢ㄦ埛鍜屾祴璇曟暟鎹簱銆

寮虹儓寤鸿瀹氭湡澶囦唤锛屽皢鏁版嵁搴撴枃浠跺浠藉埌datadir鐩綍涓嬨


杩欐槸MySQL鍙傝冩墜鍐岀殑缈昏瘧鐗堟湰锛屽叧浜嶮ySQL鍙傝冩墜鍐岋紝璇疯闂dev.mysql.com銆傚師濮嬪弬鑰冩墜鍐屼负鑻辨枃鐗堬紝涓庤嫳鏂囩増鍙傝冩墜鍐岀浉姣旓紝鏈炕璇戠増鍙兘涓嶆槸鏈鏂扮殑銆