oracleºÍMysqlÁ¬½ÓÊý¾Ý¿â
Mysql·½Ê½£º
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class MysqlDB {
private String strClass = "com.mysql.jdbc.Driver";
private String strDriver = "jdbc:mysql://localhost:3306/s_smdb";
private String strUser = "root";
private String strPwd = "123";
private Connection conn = null;
private Statement stmt = null;
private ResultSet rs = null;
private static CDBAccess instance = null;
private CDBAccess() throws ClassNotFoundException, SQLException{
Class.forName(strClass);
conn = DriverManager.getConnection(strDriver,strUser,strPwd) ;
}
public static CDBAccess getInstance() throws ClassNotFoundException, SQLException{
if(instance == null){
instance = new CDBAccess();
}
return instance;
}
public ResultSet executeQuery(String strsql) throws SQLException{
stmt = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,ResultSet.CONCUR_UPDATABLE);
rs = stmt.executeQuery(strsql);
return rs;
}
public int executeUpdate(String strsql) throws SQLException{
int i = 0;
stmt = conn.createStatement();
i = stmt.executeUpdate(strsql);
return i;
}
public void close() throws SQLException{
if(rs != null){
rs.close();
}
if(stmt != null){
stmt.close();
}
if(conn != null){
conn.close();
}
if(instance != null){
instance = null;
}
}
}
Oracle·½Ê½£º
package util;
import java.sql.Connection;
import java.sql.
Ïà¹ØÎĵµ£º
Ò»¡¢¸ÅÊö
¡¡¡¡Ê¼þµ÷¶ÈÆ÷ÊÇÔÚ MySQL 5.1 ÖÐÐÂÔöµÄÁíÒ»¸öÌØÉ«¹¦ÄÜ£¬¿ÉÒÔ×÷Ϊ¶¨Ê±ÈÎÎñµ÷¶ÈÆ÷£¬È¡´ú²¿·ÖÔÏÈÖ»ÄÜÓòÙ×÷ϵͳÈÎÎñµ÷¶ÈÆ÷²ÅÄÜÍê³ÉµÄ¶¨Ê±¹¦>ÄÜ¡£ÀýÈ磬Linux ÖÐµÄ crontabe Ö»Äܾ«È·µ½Ã¿·ÖÖÓÖ´ÐÐÒ»´Î£¬¶ø MySQL µÄʼþµ÷¶ÈÆ÷Ôò¿ÉÒÔʵÏÖÿÃëÖÓÖ´ÐÐÒ»¸öÈÎÎñ£¬ÕâÔÚһЩ¶ÔʵʱÐÔÒª>Çó½Ï¸ßµÄ»·¾³Ï¾ͷdz£ÊµÓÃÁ ......
±¾ÎÄͨ¹ý¶ÔOracleÊý¾Ý¿âËø»úÖƵÄÑо¿£¬Ê×ÏȽéÉÜÁËOracleÊý¾Ý¿âËøµÄÖÖÀ࣬²¢ÃèÊöÁËʵ¼ÊÓ¦ÓÃÖÐÓöµ½µÄÓëËøÏà¹ØµÄÒì³£Çé¿ö£¬Ìرð¶Ô¾³£Óöµ½µÄÓÉÓڵȴýËø¶øʹÊÂÎñ±»¹ÒÆðµÄÎÊÌâ½øÐÐÁ˶¨Î»¼°½â¾ö£¬²¢¶ÔËÀËøÕâÒ»±È½ÏÑÏÖصÄÏÖÏó£¬Ìá³öÁËÏàÓ¦µÄ½â¾ö·½·¨ºÍ¾ßÌåµÄ·ÖÎö¹ý³Ì¡£
Êý¾Ý¿âÊÇÒ»¸ö¶àÓû§Ê¹ÓõĹ ......
¹ú¶¼ºÅÂëÊý¾Ý¿âÉè¼Æ˵Ã÷
V1
Îĵµ±ä¸ü¼Ç¼
ÐòºÅ
±ä¸üÄÚÈÝ˵Ã÷
°æ±¾ºÅ
°æ±¾ÈÕÆÚ
Ö´±ÊÈË
1
³õ¸å
V ......
ÖØ×°²Ù×÷ϵͳºó,Èç¹ûÊý¾ÝÎļþ,¿ØÖÆÎļþ,ÈÕÖ¾Îļþ¶¼ÍêºÃµÄ»°(ÔÚitpub¿´¹ýºÜ¶àÈËÌá¹ýÕâ¸ö»°Ìâ,¶àÊýÈ˶¼Êǽ«Õâ3¸öÎļþ·ÅÔÚͬһĿ¼oradata),Ö»ÐèÖØа²×°oracle(¸úÖØ×°²Ù×÷ϵͳǰͬ°æ±¾)µ½ÔĿ¼ºó,Öؽ¨ÊµÀý·þÎñºÍÃÜÂëÎļþ,ÅäÖÃÒ»ÏÂlistenerºÍtns¼´¿ÉÕý³£Æô¶¯Êý¾Ý¿â.
¹ý³ÌÈçÏÂ(¼ÙÉèÔʵÀýÃûΪorcl,°æ±¾Îª9i):
1.½«ÔÀ´µÄor ......