Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

ͨ¹ý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Êý¾Ý¿âÃÜÂëÔõô°ì

ºÜ¾Ã²»ÓõÄoralceÊý¾Ý¿â£¬Èç¹ûÍü¼ÇÁËÃÜÂ룬¿ÉÒÔÕâÑù½â¾ö£º
Èç¹ûûÓÐÉèÖû·¾³±äÁ¿£¬ ȥĿ¼C:\oracle\product\10.2.0\db_1\BIN Ö´ÐÐÒÔÏÂÃüÁ
C:\oracle\product\10.2.0\db_1\BIN>sqlplus /nolog
SQL*Plus: Release 10.2.0.1.0 - Production on Fri Jan 22 16:00:18
2010 Copyright (c) 1982, 2005, Oracle. All ri ......

oracleµÄһЩ»ù±¾Óï·¨ºÍһЩÓÅ»¯ÎÊÌâ

²éѯ£º
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Êý¾Ý¿â¼àÌýÅäÖÃ


ת£ºhttp://oracle.chinaitlab.com/install/755900.html
        ¼òµ¥À´Ëµ£¬OracleÊý¾Ý¿âµÄ¼àÌýÅäÖðüÀ¨·þÎñÆ÷¶ËµÄÅäÖúͿͻ§¶ËµÄÅäÖ᣷þÎñÆ÷¶ËÊÇͨ¹ý¼àÌýÆ÷¼´LISTENERÀ´Íê³ÉµÄ£¬¶ø¿Í»§¶ËÅäÖÃÓжàÖÖ£¬³£ÓõÄÊDzÉÓñ¾µØ·þÎñÃûÀ´ÅäÖ᣹ØÓÚ¼àÌýÆ÷ºÍ±¾µØ·þÎñÃû£¬Ïêϸ½âÊÍÈçÏ£º
Ò»¡¢ ......

OracleÐÞ¸ÄSYSÃÜÂë

OracleÌṩÁ½ÖÖÑéÖ¤·½Ê½£¬Ò»ÖÖÊÇOSÑéÖ¤£¬ÁíÒ»ÖÖÃÜÂëÎļþÑéÖ¤·½Ê½£¬Èç¹ûÊǵÚÒ»ÖÖ·½Ê½ÓÃÒÔÏ·½·¨ÐÞ¸ÄÃÜÂ룺
¡¡¡¡sqlplus / as sysdba
¡¡¡¡alter user sys identified by ÐÂÃÜÂë;
¡¡¡¡alter user system identified by ÐÂÃÜÂë;
¡¡¡¡Èç¹ûÊǵڶþÖÖ·½·¨ÓÃÒÔÏ·½·¨ÐÞ¸ÄÃÜÂ룺
¡¡¡¡orapwd file=pwdxxx.ora password=ÄãÉ趨µÄÐ ......

J2EEÓ¦ÓÃÖÐÓëOracleÊý¾Ý¿âµÄÁ¬½Ó

ÔÚJ2EEÓ¦ÓóÌÐò¿ª·¢ÖУ¬Ó¦ÓóÌÐòÓëÊý¾Ý¿âÁ¬½ÓµÄ½¨Á¢ÊÇÎÒÃǾ­³£Óöµ½µÄÎÊÌâÖ®Ò»¡£ÔÚÕâÀïÎÒÖ÷Ҫ̸̸ÔÚ±¾µØÓ¦ÓóÌÐòÖÐͨ¹ýOCI·½Ê½¡¢thin·½Ê½ºÍJdbcOdbcÇÅ·½Ê½Á¬½ÓOracleÊý¾Ý¿â£¬ÔÚiPlanet Application Server 6.5ºÍSun ONE Application Server 7ÖжÔOracleÊý¾Ý¿âÁ¬½Ó³ØµÄÅäÖÃÒÔ¼°Ó¦ÓÃÖÐÈçºÎ´ÓÁ¬½Ó³ØÖлñµÃÁ¬½Ó¡£
Ò»¡¢±¾µØͨ¹ýJ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ