ͨ¹ýJDBCÁ¬½ÓoracleÊý¾Ý¿âµÄÊ®´ó¼¼ÇÉ
JavaÊý¾Ý¿âÁ¬½Ó£¨JDBC£©APIÊÇһϵÁÐÄܹ»ÈÃJava±à³ÌÈËÔ±·ÃÎÊÊý¾Ý¿âµÄ½Ó¿Ú£¬¸÷¸ö¿ª·¢É̵Ľӿڲ¢²»ÍêÈ«Ïàͬ¡£ÔÚʹÓöàÄêµÄOracle¹«Ë¾µÄJDBCºó£¬ÎÒ»ýÀÛÁËÐí¶à¼¼ÇÉ£¬ÕâЩ¼¼ÇÉÄܹ»Ê¹ÎÒÃǸüºÃµØ·¢»ÓϵͳµÄÐÔÄܺÍʵÏÖ¸ü¶àµÄ¹¦ÄÜ¡£¡¡
¡¡¡¡1¡¢ÔÚ¿Í»§¶ËÈí¼þ¿ª·¢ÖÐʹÓÃThinÇý¶¯³ÌÐò¡¡
¡¡¡¡ÔÚ¿ª·¢JavaÈí¼þ·½Ã棬OracleµÄÊý¾Ý¿âÌṩÁËËÄÖÖÀàÐ͵ÄÇý¶¯³ÌÐò£¬¶þÖÖÓÃÓÚÓ¦ÓÃÈí¼þ¡¢applets¡¢servletsµÈ¿Í»§¶ËÈí¼þ£¬ÁíÍâ¶þÖÖÓÃÓÚÊý¾Ý¿âÖеÄJava´æ´¢¹ý³ÌµÈ·þÎñÆ÷¶ËÈí¼þ¡£ÔÚ¿Í»§»ú¶ËÈí¼þµÄ¿ª·¢ÖУ¬ÎÒÃÇ¿ÉÒÔÑ¡ÔñOCIÇý¶¯³ÌÐò»òThinÇý¶¯³ÌÐò¡£OCIÇý¶¯³ÌÐòÀûÓÃJava±¾µØ»¯½Ó¿Ú£¨JNI£©£¬Í¨¹ýOracle¿Í»§¶ËÈí¼þÓëÊý¾Ý¿â½øÐÐͨѶ¡£ThinÇý¶¯³ÌÐòÊÇ´¿JavaÇý¶¯³ÌÐò£¬ËüÖ±½ÓÓëÊý¾Ý¿â½øÐÐͨѶ¡£ÎªÁË»ñµÃ×î¸ßµÄÐÔÄÜ£¬Oracle½¨ÒéÔÚ¿Í»§¶ËÈí¼þµÄ¿ª·¢ÖÐʹÓÃOCIÇý¶¯³ÌÐò£¬ÕâËÆºõÊÇÕýÈ·µÄ¡£µ«ÎÒ½¨ÒéʹÓÃThinÇý¶¯³ÌÐò£¬ÒòΪͨ¹ý¶à´Î²âÊÔ·¢ÏÖ£¬ÔÚͨ³£Çé¿öÏ£¬ThinÇý¶¯³ÌÐòµÄÐÔÄܶ¼³¬¹ýÁËOCIÇý¶¯³ÌÐò¡£¡¡
¡¡¡¡2¡¢¹Ø±Õ×Ô¶¯Ìá½»¹¦ÄÜ£¬Ìá¸ßϵͳÐÔÄÜ¡¡
¡¡¡¡ÔÚµÚÒ»´Î½¨Á¢ÓëÊý¾Ý¿âµÄÁ¬½Óʱ£¬ÔÚȱʡÇé¿öÏ£¬Á¬½ÓÊÇÔÚ×Ô¶¯Ìύģʽϵġ£ÎªÁË»ñµÃ¸üºÃµÄÐÔÄÜ£¬¿ÉÒÔͨ¹ýµ÷Óôø²¼¶ûÖµfalse²ÎÊýµÄConnectionÀàµÄsetAutoCommit()·½·¨¹Ø±Õ×Ô¶¯Ìá½»¹¦ÄÜ£¬ÈçÏÂËùʾ£º¡¡
conn.setAutoCommit(false);¡¡
¡¡¡¡ÖµµÃ×¢ÒâµÄÊÇ£¬Ò»µ©¹Ø±ÕÁË×Ô¶¯Ìá½»¹¦ÄÜ£¬ÎÒÃǾÍÐèҪͨ¹ýµ÷ÓÃConnectionÀàµÄcommit()ºÍrollback()·½·¨À´È˹¤µÄ·½Ê½¶ÔÊÂÎñ½øÐйÜÀí¡£¡¡
¡¡¡¡3¡¢ÔÚ¶¯Ì¬SQL»òÓÐʱ¼äÏÞÖÆµÄÃüÁîÖÐʹÓÃStatement¶ÔÏó¡¡
¡¡¡¡ÔÚÖ´ÐÐSQLÃüÁîʱ£¬ÎÒÃÇÓжþÖÖÑ¡Ôñ£º¿ÉÒÔʹÓÃPreparedStatement¶ÔÏó£¬Ò²¿ÉÒÔʹÓÃStatement¶ÔÏó¡£ÎÞÂÛ¶àÉٴεØÊ¹ÓÃͬһ¸öSQLÃüÁPreparedStatement¶¼Ö»¶ÔËü½âÎöºÍ±àÒëÒ»´Î¡£µ±Ê¹ÓÃStatement¶ÔÏóʱ£¬Ã¿´ÎÖ´ÐÐÒ»¸öSQLÃüÁîʱ£¬¶¼»á¶ÔËü½øÐнâÎöºÍ±àÒë¡£Õâ¿ÉÄÜ»áʹÄãÈÏΪ£¬Ê¹ÓÃPreparedStatement¶ÔÏó±ÈʹÓÃStatement¶ÔÏóµÄËٶȸü¿ì¡£È»¶ø£¬ÎÒ½øÐеIJâÊÔ±íÃ÷£¬ÔÚ¿Í»§¶ËÈí¼þÖУ¬Çé¿ö²¢·ÇÈç´Ë¡£Òò´Ë£¬ÔÚÓÐʱ¼äÏÞÖÆµÄSQL²Ù×÷ÖУ¬³ý·Ç³ÉÅúµØ´¦ÀíSQLÃüÁÎÒÃÇÓ¦µ±¿¼ÂÇʹÓÃStatement¶ÔÏ󡣡¡
¡¡¡¡´ËÍ⣬ʹÓÃStatement¶ÔÏóҲʹµÃ±àд¶¯Ì¬SQLÃüÁî¸ü¼Ó¼òµ¥£¬ÒòΪÎÒÃÇ¿ÉÒÔ½«×Ö·û´®Á¬½ÓÔÚÒ»Æð£¬½¨Á¢Ò»¸öÓÐЧµÄSQLÃüÁî¡£Òò´Ë£¬ÎÒÈÏΪ£¬Statement¶ÔÏó¿ÉÒÔʹ¶¯Ì¬SQLÃüÁîµÄ´´½¨ºÍÖ´ÐбäµÃ¸ü¼Ó¼òµ¥¡£¡¡
¡¡¡¡4¡¢ÀûÓÃhelperº¯Êý¶Ô¶¯Ì¬SQLÃüÁî½øÐиñʽ»¯¡¡
¡¡¡¡ÔÚ´´½¨Ê¹ÓÃStatement¶ÔÏóÖ´ÐеĶ¯Ì¬SQLÃüÁîʱ£¬ÎÒÃÇÐèÒª´¦ÀíһЩ¸ñ
Ïà¹ØÎĵµ£º
¶ÔÓÚOracle ORA-24343ÕâÖÖ´íÎó£¬OracleµÄ¹Ù·½½âÊÍÊÇ£º
Error Message: ORA-24343 user defined callback error
Error Cause:
The only valid return value for a user defined callback function is OCI_ CONTINUE. Any other value will cause this error.
Action:
Make sure that OCI_CONTINUE i ......
1. NLS_LANG
²ÎÊý×é³É
NLS_LANG
²ÎÊýÓÉÒÔϲ¿·Ö×é³É:
NLS_LANG
=<Language>_<Territory>.<Clients
Characterset>
NLS_LANG
¸÷²¿·Öº¬ÒåÈçÏÂ:
LANGUAGEÖ¸¶¨:
-OracleÏûϢʹÓõÄÓïÑÔ
-ÈÕÆÚÖÐÔ·ݺÍÈÕÏÔʾ
TERRITORYÖ¸¶¨
-»õ±ÒºÍÊý×Ö¸ñʽ
-µØÇøºÍ¼ÆËãÐÇÆÚ¼°ÈÕÆÚµÄϰ¹ß
CHARACTERSET:
-¿Ø ......
ÏîÄ¿ÀïÒ»¸ö¹¦ÄÜÒªÓõ½Ëæ»úÅÅÐò£¬µ«ÊǺóÀ´ÓÖÒòΪÊý¾ÝÁ¿´óµÄÔÒò£¬Òª·Öҳȥ²éѯÊý¾Ý£¬½á¹ûµ¼Ö²éѯ³öÀ´µÄÊý¾Ý³öÏÖÖØ¸´¡£
ÔsqlÈçÏÂselect * from ( select row_.*, rownum rownum_ from
(select * from tble order by dbms_random.random) row_ where rownum <= 12) where rownum_ > 10;
ºóÀ´½â¾ö°ì·¨£¬²åÈ ......
²éѯ£º
select distinct(empno) , name , age from t_person t where (t.age between 21 and 25 or name like '%Íõ%') and
empno like '32%';
¸üУº
update t_person set name = 'ww' where empno = '321654';
update t_person set(empno,name,age) = (select empno,name,age f ......
ÒªÕÒOracle 9i for LinuxͦÂé·³µÄ£¬¸É´à×Ô¼ºÁô¸ö¼Ç¼±È½Ï·½±ã¡£
Oracle9i Database Release 2 Enterprise/Standard/Personal Edition for Windows NT/2000/XP
http://download.oracle.com/otn/nt/oracle9i/9201/92010NT_Disk1.zip
http://download.oracle.com/otn/nt/oracle9i/9201/92010NT_Disk2.zip
http://downlo ......