javaÊý¾Ý¿â¿ª·¢ÖÐÁ½ÖÖ×¢²áoracleÇý¶¯µÄ·½Ê½
Ò»¡¢ÀûÓÃClass.forNameº¯Êý£¨ÓÃjava¿ª·¢B/SģʽµÄ³ÌÐò£© 1.´úÂëÈçÏ£º //×¢²áÇý¶¯³ÌÐò
public boolean connectDb() {
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
return true;
} catch (ClassNotFoundException e) {
System.out.println(e);
return false;
}
}
//»ñÈ¡Á¬½Ó
private Connection getConn(){
try{
connection=DriverManager.getConnection(url,user,password);
}catch(Exception e){
System.out.println(e);
}
return connection;
}
2.Ç°ÌáÌõ¼þ£º
JDKµÄ°²×°¼°»·¾³±äÁ¿µÄÅäÖô˴¦²»ÔÙ׸Êö£»
½«oracle°²×°Ä¿Â¼ÏµÄjdbcϵÄclasses12.jarÎļþ¿½±´µ½tomcatĿ¼ÏµÄcommon\lib\ÏÂÃ棬·ñÔò»áÅ׳öClassNotFoundException£»
url,user,passwordÊÓ¿ª·¢»·¾³¶ø¶¨
¶þ¡¢ÀûÓÃDriverManager.registerDriverº¯Êý£¨¿ª·¢C/SģʽµÄ³ÌÐòʱ£©
1.´úÂëÈçÏ£º
public Connection connectDatabase(){
try{
DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
conn=DriverManager.getConnection("jdbc:oracle:thin:@172.16.1.52:1521:orcl","scott","test");
}catch (SQLException e){
System.out.println("caught:\n"+e);
System.exit(1);
}
return conn;
}
2.Ç°ÌáÌõ¼þ£º
JDKµÄ°²×°¼°»·¾³±äÁ¿µÄÅäÖô˴¦²»ÔÙ׸Êö£»
import.java.sql.*;
Èý¡¢Ò»µã˵Ã÷
1.Èç¹ûÔÚµÚÒ»ÖÖÇé¿öÏÂÓõڶþÖÖÇé¿öÌṩµÄ·½·¨£¬±àÒë²»ÄÜͨ¹ý¡£
2.Èç¹ûÔÚµÚ¶þÖÖÇé¿öÏÂÓõÚÒ»ÖÖÌṩµÄ·½·¨±àÒëÄܹ»Í¨¹ý£¬µ«ÊÇÔËÐÐʱ»á±¨oracle.jdbc.driver.OracleDriver£¬ÕÒ²»µ½µÄÒì³£¡£
3.½¨Ò鿪·¢²»Í¬µÄģʽ£¬²ÉÓò»Í¬µÄ×¢²áÇý¶¯µÄ·½·¨¡£
4.¼ÓÔØÇý¶¯Ê±¶¼Òª²¶»ñÒì³££¬µ±È»¿ÉÒÔ¶¼ÓÃExceptionÀ࣬Èç¹û¸üÏêϸµÄ»°£¬µÚÒ»ÖÖÇé¿öÏ£¬²¶»ñClassNotFoundException£¬µÚ¶þÖÖÇé¿öϲ¶»ñSQLExceptionÒì³££¬·Ö±ð²ÉÈ¡ÏàÓ¦µÄ´¦Àí·½Ê½¡£
Ïà¹ØÎĵµ£º
ÀàµÄ³õʼ»¯ºÍ¶ÔÏó³õʼ»¯ÊÇ JVM ¹ÜÀíµÄÀàÐÍÉúÃüÖÜÆÚÖзdz£ÖØÒªµÄÁ½¸ö»·½Ú£¬Google ÁËÒ»±éÍøÂ磬ÓйØÀà×°ÔØ»úÖƵÄÎÄÕµ¹ÊDz»ÉÙ£¬È»¶øÀà³õʼ»¯ºÍ¶ÔÏó³õʼ»¯µÄÎÄÕ²¢²»¶à£¬ÌرðÊÇ´Ó×Ö½ÚÂëºÍ JVM ²ã´ÎÀ´·ÖÎöµÄÎÄÕ¸üÊÇÏÊÓÐËù¼û¡£
±¾ÎÄÖ÷Òª¶ÔÀàºÍ¶ÔÏó³õʼ»¯È«¹ý³Ì½øÐзÖÎö£¬Í¨¹ýÒ»¸öʵ¼ÊÎÊÌâÒýÈ룬½«Ô´´úÂëת»»³É JVM ×Ö½ÚÂëºó£¬ ......
ÔÚORACLE 10gµÇ½´´½¨ÐÂÓû§£º
ÔÚORACLE 10gµÇ½´´½¨ÐÂÓû§£º
1¡¢ÓÃsys Óû§µÇ¼
2¡¢create user test1 identified by test123;
3¡¢grant connect,resource to test1;
ÓÃtest1µÇ½£º sqlplus test1/test123
°²×°ÍêÁËOracleÊý¾Ý¿â£¬ÍüÁËÔÚ¿ÚÁî¹ÜÀíÖиøSCOTT½âËøÔõô°ì
ÎÊÌâ²¹³ä ......
Íâ±í(external table)¾ÍÏñÆÕͨµÄ±í¶ÔÏñÒ»Ñù£¬¿ÉÒÔselectµÈ£¬Ö»ÊÇËüÊÇÖ»¶ÁµÄ£¬Êý¾Ý¿âÖÐÖ»±£´æÁ˱í½á¹¹µÄÃèÊö£¬±íÊý¾ÝȴûÓдæ·ÅÔÚÊý¾Ý¿âÄÚ£¬¶øÊÇ´æ·ÅÔÚÁËÎļþϵͳÉÏ¡£µ±Óû§Ï뿶ûʹÓÃÊý¾Ý¿âÍâµÄ½á¹¹»¯Êý¾Ýʱ£¬ÓÃÆðÍâ±íÀ´¾Í·Ç³£·½±ã£¬ÉõÖÁ±Èsqlldr¶¼Òª·½±ãµÄ¶à¡£ÔÚÕâƪÎÄÕÂÀÎÒÃÇΪ´ó¼ÒÑÝʾÁË
¡¡¡¡Èý²½¾ÍÕÆÎÕoracleÍâ±í¹ý ......
Á˽âLDAP
LDAPÊÇLight Directory Access ProtocolÇáÁ¿¼¶Ä¿Â¼·ÃÎÊÐÒéµÄ¼ò³Æ£¬LDAPÓëÊý¾Ý¿âÓкܴóµÄÇø±ð£¬ËüµÄÊý¾ÝÊÇÊ÷×´µÄ£¬¶øÇÒÿ¸ö½ÚµãµÄÊôÐÔÒ²±È½Ï¹Ì¶¨¡£
LDAPÐÒéÖÐÓÃdn±íʾһÌõ¼Ç¼µÄλÖã¬dc±íʾһÌõ¼Ç¼ËùÊôÇøÓò£¬ou±íʾһÌõ¼Ç¼ËùÊô×éÖ¯£¬cn±íʾһÌõ¼Ç¼µÄÃû³Æ£¬uid±íʾһÌõ¼Ç¼µÄID£¬ÆäÖÐdnÊǸù¾ ......
public class Parent
{
//1
static int a = 1;
//2
static
{
a = 10;
System.out.println("parent static c ......