java jdbc Á¬½ÓOracle9i
×Ô¼ºÔÚ×öÕâ¸ö³ÌÐòµÄʱºò¿´¹ýºÜ¶àµÄ×ÊÁÏ£¬ÉÏÍøÒ²²éÁ˲»ÉÙµÄ×ÊÁÏ£¬¿ÉÊǶà°ë˵µÄÊdzöÉñÈ뻯£¬ÔÆÀïÎíÀï...²»¹â¿´Á˲»Ã÷°×£¬¶øÇÒÊÇÓÐÃ÷°×Ò»µãµÄÈË£¬¿´ÁËÒ²±äµÄÓÐЩģºýÁË¡£
ÕâÀïÎÒÑÚÊÎÒ»Ì×ÍêÕûµÄjava jdbc Á¬½ÓOracle9iµÄ·¶Àý¡£
package com.lxh.dbcon;//´ò°ü
import java.sql.*;//µ¼Èësql°ü
public class DbCon {//¶¨ÒåÁ¬½ÓÀà
private final String DRIVER="oracle.jdbc.driver.OracleDriver";//OracleµÄÇý¶¯
private final String URL="jdbc:oracle:thin:@localhost:1521:Oracle9i";//Oracle9iΪOracleµÄÖ÷»ú´®Ãû£¨Ò²¾ÍÊÇOracleµÄSID£©ÔÚ×°OracleµÄʱºòÌîдµÄSID
private final String DBUSER="scott";//ÕâÀï¾ÍÒÔscott/tigerΪÓû§µÇ¼
private final String DBPASSWORD="tiger";
private Connection con=null;//Ô¤Ïȶ¨ÒåÒ»¸öÁ¬½Ó½Ó¿Ú
public DbCon() {//ÔÚ¹¹Ôì·½·¨ÖмÓÔØÊý¾Ý¿âÇý¶¯
try{
Class.forName(DRIVER).newInstance();
}catch(Exception e){
e.printStackTrace();
}
}
public Connection getConnection(){ //Á¬½ÓÊý¾Ý¿âµÄ·½·¨
try{
con=DriverManager.getConnection(URL,DBUSER,DBPASSWORD);
}catch(Exception ew){
ew.printStackTrace();
}
return con;
}
}
ÕâÊÇÒ»¸öÍêÕûµÄÁ¬½ÓÀ࣬²âÊÔÒѾͨ¹ý¡£
Ïà¹ØÎĵµ£º
ÉùÃ÷£º
ÒÔϵÄÀý×Ó²»Ò»¶¨ÕýÈ·£¬Ö»ÊÇΪÁËÑÝʾ´ó¸ÅµÄÁ÷³Ì¡£
Ò»£ºÎÞ·µ»ØÖµµÄ´æ´¢¹ý³Ì
´æ´¢¹ý³ÌΪ£º
CREATE OR REPLACE PROCEDURE TESTA(PARA1 IN VARCHAR2,PARA2 IN VARCHAR2) AS
BEGIN
INSERT INTO HYQ.B_ID (I_ID,I_NAME) VALUES (PARA1, PARA2);
END TESTA;
È»ºóÄØ£¬ÔÚjavaÀïµ÷ÓÃʱ¾ÍÓÃÏÂÃæµÄ´ ......
´úÂëÈçÏ£º
¡¡¡¡ÒÔÏÂΪÒýÓõÄÄÚÈÝ£º
¡¡¡¡package com.example.pinyin.demo2;
¡¡¡¡import net.sourceforge.pinyin4j.PinyinHelper;
¡¡¡¡import net.sourceforge.pinyin4j.format.HanyuPinyinCaseType;
¡¡¡¡import net.sourceforge.pinyin4j.format.HanyuPinyinOutputFormat;
¡¡¡¡import net.sourceforge.pinyin4j.form ......
¹ØÓÚjavaµÄ¼¯ºÏÀà,ÒÔ¼°HashMapÖÐSetµÄÓ÷¨!
2005-10-22 14:47:43 Sat | ÔĶÁ£¨547£©´Î
package com.tiantian;
import java.util.*;
public class JAVAContainer {
public static void main(String[] args) throws Exception {
//&nbs ......
File f=new File("DerectoryName");
String []results=f.list();
import java.io.*;
¡¡¡¡public class listFile
¡¡¡¡{ &nb ......
Observer
Intent
Define a one-to-many dependency between objects so that when one object changes state, all its dependents are notified and updated automatically.
How to
Subject
knows its observers. Any number of Observer objects may observe a subject.
provides an in ......