Àí½âoracleÖÐÁ¬½ÓºÍ»á»°
Àí½âoracleÖÐÁ¬½ÓºÍ»á»° 1. ¸ÅÄͬ£º¸ÅÄͬ£º
Á¬½ÓÊÇÖ¸ÎïÀíµÄÍøÂçÁ¬½Ó¡£
ÔÚÒѽ¨Á¢µÄÁ¬½ÓÉÏ£¬½¨Á¢¿Í»§¶ËÓëoracleµÄ»á»°£¬ÒÔºó¿Í»§¶ËÓëoracleµÄ½»»¥¶¼ÔÚÒ»¸ö»á»°»·¾³ÖнøÐС£
2. ¹ØϵÊǶà¶Ô¶à£º
Ò»¸öÁ¬½ÓÉÏ¿ÉÒÔ½¨Á¢0¸ö£¬1¸ö£¬2¸ö£¬¶à¸ö»á»°¡£
OracleÔÊÐí´æÔÚÕâÑùµÄ»á»°£¬¾ÍÊÇʧȥÁËÎïÀíÁ¬½ÓµÄ»á»°¡£
3. ¸ÅÄîÓ¦Ó㺸ÅÄîÓ¦Óãº
oracleµÄsessions²ÎÊý¾ö¶¨µÄÊǻỰÊý¶ø²»ÊÇÎïÀíÁ¬½ÓÊý¡£
oracleµÄÁÙʱ±íÖеÄÊý¾ÝÊǸ÷»á»°¼ä¸ôÀëµÄ£¬¶øÓëÁ¬½Ó¸ÅÄîÎ޹ء£
jdbcµÄconnection£¬¶ÔoracleÊÇÒ»¸ö»á»°µÄ¸ÅÄî¡£
4. ʵ¼ÊÓ¦Óãº
Á¬½Ó³Ø£¬ÎªÁËÌá¸ßÊý¾Ý¿â½»»¥Ð§ÂÊ£¬Ò»°ãÇý¶¯³ÌÐò¶¼ÓÐÁ¬½Ó³Ø¸ÅÄîµÄʵÏÖ¡£
Oracle²»Í¬µÄÇý¶¯ÌṩÁ½ÖÖÁ¬½Ó³Ø¸ÅÄî¡£
Ò»ÖÖÒëΪÒþʽÁ¬½Ó»º³å
OracleDataSource ods = new OracleDataSource();
ods.setURL("jdbc:oracle:thin:@10.1.3.60:1521:orcl");
ods.setUser("NC50_DEV");
ods.setPassword("NC50_DEV");
ods.setConnectionCachingEnabled(true);
java.util.Properties jup = new java.util.Properties();
jup.setProperty("InitialLimit", "1");
jup.setProperty("MinLimit", "1");
jup.setProperty("MaxLimit", "2");
ods.setConnectionCacheProperties(jup);
Connection cx0 = ods.getConnection();
ÒþʽÁ¬½Ó»º³åÔÚµÚÒ»´Îgetconnection£¨£©Ê±½«¸ù¾ÝÅäÖóõʼ»¯Á¬½Ó£¬²¢ÔÚÿһ¸öÁ¬½ÓÉϽ¨Á¢Ò»¸ö»á»°¡£È»ºó´ÓÕâЩ»á»°Öзµ»ØÒ»¸ö¸ø±¾´Îµ÷Óá£ÒÔºóÈç¹ûÔÚ±¾´Îconnection.close()Ç°µ÷ÓÃgetconnection£¨£©£¬½«¿Ï¶¨µÃµ½ÁíÍâÒ»¸ö»á»°¡£Èç¹û³õʼʱ½¨Á¢µÄ»á»°²»¹»ÁË£¬ÄÇô½«Ð½¨ÎïÀíÁ¬½Ó£¬²¢ÔÚÁ¬½ÓÉϽ¨Á¢Ò»¸ö»á»°¡£µ±È»²»Äܳ¬¹ýÁ½¸öÏÞÖÆ£º1.MaxLimit¡¾¼û³ÌÐò£¬ÏÞÖÆÎïÀíÁ¬½ÓÊý¡¿¡£2.sessions¡¾oracle²ÎÊý¡¿¡£Ã¿´Îclose()²¢²»¹Ø±Õʵ¼ÊµÄ»á»°£¬¶øÊÇ·µ»ØÁ¬½Ó»º³åÖУ¬¹©ÁíÒ»¸ögetconnection()ʹÓá£ËùÒÔ¿ÉÒÔµÃÖª£¬Èç¹ûÒ»¸ögetconnection()Öиøijһ¸ö»á»°¼¶ÁÙʱ±í²åÈëÊý¾Ý£¬È»ºóclose(),ÄÇô֮ºóÈç¹ûÕâ¸ö»á»°±»ÖØеõ½£¬ÊÇ¿ÉÒÔ¿´µ½²åÈëµÄÊý¾ÝµÄ¡£
Ò»ÖÖÒëΪOCIÁ¬½Ó³Ø¡£
OracleOCIConnectionPool ods = new OracleOCIConnectionPool();
String tns = "(DESCRIPTION=(ADDRESS_LIST=(ADDRESS="
+ "(PROTOCOL=TCP)(HOST=10.1.3.60)(PORT=1521)))"
+ "(CONNECT_DATA=(SERVICE_NAME=ORCL)))";
ods.setURL("jdbc:oracle:oci:@" + tns);
ods.setUser("NC50_DEV");
ods.setPassword("NC50_DEV");
java.util.Properties jup = new java.
Ïà¹ØÎĵµ£º
ÎÒÔÚ¹¤×÷ÖÐÔÚOracleÖжà±í²éѯÔÙ°´Ê±¼äµ¹Ðòʱ£¬ÓÃorder by ±íÃû.datatime desc ×ÜÊÇʵÏÖ²»ÁË¡£
²»¹ý×îºóÎÊÑî¾é×îºóºÍÎÒ˵¿ÉÒÔ°ÑÎÒÃDzéѯµÄ×ܸösqlÓï¾ä×öΪһ¸ö±íÀ´ÅÅÐò£º
select rownum,aa.* from (.... order by ±íÃû.datatime desc ) aa ......
ÉÏһƪÎÄÕÂдÁËÒ»¸öoracleµÄÒ»¸öÐÐתÁеÄÀý×Ó£¬ÀïÃæÓõ½ÁËoracleÖÐÖØÒªµÄº¯Êý decode,ÕâƪÎÄÕ¾ÍÀ´¼òµ¥µÄѧϰÕâ¸öº¯Êý
DECODEº¯ÊýºÍÎÒÃÇÓïÑԽṹÖеÄÌõ¼þÓï¾ä£¨IF£©ÏàËÆ¡£Ëü½«ÊäÈëÊýÖµÓ뺯ÊýÖеIJÎÊýÁбíÏà±È½Ï£¬¸ù¾ÝÊäÈëÖµ·µ»ØÒ»¸ö¶ÔÓ¦Öµ¡£
DECODEº¯ÊýÏ൱ÓÚÒ»Ìõ¼þÓï¾ä(IF).Ëü½«ÊäÈëÊýÖµÓ뺯ÊýÖеIJÎÊýÁбíÏà±È½Ï£¬¸ù¾ÝÊ ......
create database link user_auth
¡¡¡¡ connect to user_auth identified by user_auth
¡¡¡¡ using '(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.0.236)(PORT=1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=develop1)))'; ......
oracle 10g em¡¢isqlplus·ÃÎʲ»Á˵Ľâ¾ö·½·¨£¨»ã×Ü£©
oracle 10g em¡¢isqlplusµÄ¹ÜÀí
Èç¹ûweb·½Ê½µÄem£¬isqlplus·ÃÎʲ»ÁË¡£
1. ¼ì²éÖ÷»úÃû/IP¡¢¶Ë¿ÚÊÇ·ñÕýÈ·
°²×°Ê±µÄÖ÷»úÃû/IP¡¢¶Ë¿Ú¼Ç¼ÔÚ$ORACLE_HOME/install/portlist.ini ÎļþÖС£
ȱʡÊÇ£º
Ò»°ãÓû§   ......