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

Oracleѧϰ±Ê¼Ç5 JDBC²Ù×÷Oracle

ÓÃJavaÀ´²Ù×÷Êý¾Ý¿â£¬ÓÐÈçϼ¸ÖÖ·½Ê½£º
1JDBC-ODBCÇÅ£ºODBCÊý¾ÝÔ´ÔÚ²Ù×÷ϵͳ²ãÃæ¸øÓèÁËÖ§³Ö£¬ÎÒÃÇ¿ÉÒÔ²»ÓÃÁ˽âµ×²ãµ½µ×ÊÇ·â×°µÄÄÄÖÖÊý¾ÝÔ´£¬Ò²ÕÕÑù¿ÉÒÔÍê³É¶ÔÊý¾ÝµÄ²Ù×÷¡£µ«ÊÇËüÓÐƽ̨ÒÀÀµÐÔ£¬²»Ì«ÍƼöʹÓá£
2Javaµ½±¾µØAPI
3Javaµ½ÍøÂçЭÒé
4Javaµ½Êý¾Ý¿âЭÒ飺ËÙ¶È×î¿ì
Á¬½ÓÊý¾Ý¿â¿ÉÒÔ·ÖΪËIJ½£º
A¼ÓÔØÇý¶¯³ÌÐò£¨Ïòϵͳע²áËùÐèµÄJDBCÇý¶¯³ÌÐò£©
B½¨Á¢µ½Ö¸¶¨Êý¾Ý¿âµÄÁ¬½Ó
CÌá½»Êý¾Ý¿â²éѯ
DÈ¡µÃ²éѯ½á¹û
OracleµÄÇý¶¯³ÌÐò£¬ÔÚoracleµÄ°²×°Ä¿Â¼ÏµÄJDBCÎļþ¼ÐÏ¿ÉÒÔÕÒµ½
ResultSetµÈÀàµÄʹÓÿÉÒԲ鿴JAVA EE APIÎĵµ
ÕâÀï¼òµ¥½éÉÜÒ»ÖÖJDBCÁ¬½Ó·½Ê½£¬Å×שÒýÓñ¡£
ÎÒÕâÖ±½Ó¸ø³ö´úÂ룬×÷³öÏàÓ¦µÄ×¢ÊÍ£º
 
package morflame;
 
import java.sql.*; //Á¬½ÓÊý¾Ý¿âÖ÷ÒªÓÃÕâ¸ö°ü
 
public class JdbcTest1 {
 
    public static void main(String[] args) {
       ResultSet rs = null;// ÕâÊÇÔ¤¶¨ÒåµÄ²éѯ½á¹û¼¯
       Statement stmt = null;
       Connection conn = null;
       try {
           // Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
           // ¼ÓÔØÇý¶¯£¬²»Í¬µÄÊý¾Ý¿â¶ÔÓ¦Óв»Í¬µÄÇý¶¯
           Class.forName("oracle.jdbc.driver.OracleDriver");
           // Á¬½ÓµÄURL£¬jdbcÊÇЭÒ飬oracle£ºthinÊÇ×ÓЭÒ飬@ºóÊÇIP:¶Ë¿Ú£ºÊý¾Ý¿âʵÀý
           String connectionUrl = "jdbc:oracle:thin:@127.0.0.1:1521:orcl";
           // µÃµ½Á¬½Ó£¬Ìá¹ýURL£¬Óû§ÃûºÍÃÜÂë
           conn = DriverManager.getConnection(connectionUrl, "scott", "tiger");
           // Connection
           // conn=DriverManager.ge


Ïà¹ØÎĵµ£º

Oracle ³£Óüà¿ØSQL

1.¼à¿ØÊÂÀýµÄµÈ´ý£º
         select event,sum(decode(wait_time,0,0,1)) prev, sum(decode(wait_time,0,1,0)) curr,count(*)
from v$session_wait
group by event order by 4;
2.»Ø¹ö¶ÎµÄÕùÓÃÇé¿ö£º
select name,waits,gets,waits/gets ratio from v$rollstat a,v$rollnam ......

oracleѧϰ±Ê¼Ç2 ±íµÄ»ù±¾²Ù×÷

Oracle±íµÄ¹ÜÀí
±íÃûºÍÁÐÃûµÄÃüÃû¹æÔò£º
1±ØÐëÒÔ×Öĸ¿ªÍ·
2³¤¶È²»Äܳ¬¹ý30¸ö×Ö·û
3²»ÄÜʹÓÃOracleµÄ±£Áô×Ö
4Ö»ÄÜʹÓÃÈçÏÂ×Ö·û£ºA-Z,a-z,0-9,$,#µÈ
OracleÖ§³ÖµÄÊý¾ÝÀàÐÍ£º
1char ¶¨³¤£¬×î´ó2000×Ö·û
Àý×Ó£ºchar(10) ‘Ïþ»Ô’ Ç°Ëĸö×Ö·û·Å’Ïþ»Ô’£¬ºóÌíÁù¸ö¿Õ¸ñ²¹È«
2varchar2(20) ±ä³¤£¬×î´ ......

Oracle×ܽá

Ò».OracleÊý¾Ý¿âÖг£ÓõÄÊý¾ÝÀàÐÍ
varchar2(³¤¶È)¿É±ä³¤×Ö·û´®
char(³¤¶È) ¶¨³¤
number()±íʾÕûÊý»òÕ߸¡µãÊýnumber(8) number(8,2)
clog ×Ö·ûµÄ´ó¶ÔÏó
blog ¶þ½øÖƵĴó¶ÔÏó
¶þ.Êý¾Ý¿â²éѯ
1£©SELECTÓï¾ä
´Ó±íÖÐÌáÈ¡²éѯÊý¾Ý.Ó﷨ΪSELECT [DISTINCT] {column1,column2,…} from tablename WHERE {con ......

oracle HINTS µÄʹÓÃ

Õª×ÔÐìÓñ½ðµÄ<<sqlÐÔÄܵĵ÷Õû-×ܽá>>
ÈçºÎʹÓÃhints:
HintsÖ»Ó¦ÓÃÔÚËüÃÇËùÔÚsqlÓï¾ä¿é(statement block£¬ÓÉselect¡¢update¡¢delete¹Ø¼ü×Ö±êʶ)ÉÏ£¬¶ÔÆäËüSQLÓï¾ä»òÓï¾äµÄÆäËü²¿·ÖûÓÐÓ°Ïì¡£È磺¶ÔÓÚʹÓÃunion²Ù×÷µÄ2¸ösqlÓï¾ä£¬Èç¹ûÖ»ÔÚÒ»¸ösqlÓï¾äÉÏÓÐhints£¬Ôò¸Ãhints²»»áÓ°ÏìÁíÒ»¸ösqlÓï¾ä¡£
ÎÒÃÇ¿ÉÒÔÊ ......

ORACLEÁ¬½Ó×Ö·û´®µÄд·¨

½ñÌìÉÏÎç²âÊÔÒ»¸ö·ÃÎÊORACLEµÄc++À࣬ÎĵµÉÏ˵Á¬½Ó×Ö·û´®µÄ¸ñʽΪ"Óû§Ãû/¿ÚÁî@Á¬½ÓÃû"£¬ÎÒ²»ÊÇÌ«Ã÷°×Á¬½ÓÃûµ½µ×ΪºÎÎÏÈÓÃIPµØÖ·ÊÔÁËÊÔ
£¬×ÜÊDZ¨´í£¬ËµÎÞ·¨½âÎöµÄÁ¬½Ó±êʶ·û£¬ºóÀ´ÔÚÍøÉϲéÁË°ëÌ죬¿´µ½ÓиöÈË˵Á¬½ÓÃû¾ÍÊÇ$(ORACLE_HOME)/network/admin/tnsnames.oraÀﶨÒåµÄÊý¾Ý¿âÁ¬½ÓµÄÃû³Æ£¬ÊÔÁËһϣ¬¹ûÈ»Èç´Ë¡£ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ