JAVA³£ÓòÙ×÷Óï¾ä ÏîÄ¿ÖеÄ×ܽáÈý
»ñµÃmysqlºÍoracleÁ´½ÓµÄÀà
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class ConnectDB {
private static final String MYSQL = "jdbc:mysql://";
private static final String ORACLE = "jdbc:oracle:thin:@";
private ConnectDB() {
}
public static Connection getInstance(String DBType, String url)
throws NoSuchDBException, SQLException
{
if ("mysql".equalsIgnoreCase(DBType))
return getMySqlConn(url);
if ("oracle".equalsIgnoreCase(DBType))
return getOracleConn(url);
return null;
}
public static void closeConn(Connection conn) {
if (conn != null) {
try {
conn.close();
} catch (SQLException e) {
e.printStackTrace();
}
}
}
private static Connection getMySqlConn(String url) throws SQLException {
Connection conn = null;
try {
Class.forName("com.mysql.jdbc.Driver");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
conn = DriverManager.getConnection(MYSQL + url, "root", "root");
return conn;
}
private static Connection getOracleConn(String url) throws SQLException {
Connection conn = null;
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
conn = DriverManager.getConnection(ORACLE + url, "scott", "tiger");
return conn;
}
}
Êý¾Ý¿âÁ´½ÓÀà——Í¨¹ýÅäÖÃÎļþ
/*
* Db.java
Created on 2007Äê8ÔÂ20ÈÕ, ÉÏÎç 8:37
*/
import
java.io.
*
;
import
java.sql.
*
;
import
java.util.Properties;
public
class
Db {
private
String driver;
private
String url;
private
String user;
private
String password;
private
Connection conn;
private
Statement stm;
private
ResultSet rs;
public
Db(){
this
(
"
DBConf.properties
"
);
}
Ïà¹ØÎĵµ£º
ת javaÉú³ÉexeÎļþ
ÎÄÕ·ÖÀà:Java±à³Ì
¶ÔÓÚ×÷Java×ÀÃæÓ¦ÓÃÀ´Ëµ£¬±È½Ï·³È˵ľÍÊÇ°²×°²¿ÊðÎÊÌ⣬¿Í»§¶ËÊÇ·ñ°²×°ÓÐjre¡¢jre°æ±¾ÎÊÌâ¡¢jreÈ¥ÄÄÏÂÔØ¡¢ÈçºÎÓÃjreÆô¶¯ÄãµÄJavaÓ¦Ó㿲»ÒªËµ¸Õ½Ó´¥µçÄÔµÄÈË£¬¾ÍËãÊDZȽÏÊìϤµçÄÔ£¬Èç¹ûûÓнӴ¥¹ýJava,Ãæ¶ÔÒ»¸öJavaÓ¦Óã¬ÈçºÎÔÚWindowsÏÂÆô¶¯Ëü£¬¹À¼Æ¶¼»áÕÛÌÚ°ëÌì¡£Èç¹û²»ÊÇÒòΪÕ⸠......
¹ØÓÚ Java Concurrency
×Ô´ÓJavaµ®Éú֮ʱ£¬Java ¾ÍÖ§³Ö²¢ÐеĸÅÄ±ÈÈçÏ̺߳ÍËø»úÖÆ¡£Õâ¸ö½Ì³Ì°ïÖú¿ª·¢¶àÏß³ÌJava³ÌÐòÔ±Äܹ»Àí½âºËÐĵÄJava²¢ÐÐÀíÄîÒÔ¼°ÈçºÎʹÓÃËûÃÇ¡£ ÄÚÈÝÉæ¼°µ½JavaÓïÑÔÖеÄỊ̈߳¬ ÖØÁ·¼¶ÒÔ¼°ÇáÁ¿¼¶Í¬²½»úÖÆ ÒÔ¼°JavaSE 5 ÖеÄËø£¬Ô×ÓÁ¿ ²¢ÐÐÈÝÆ÷£¬Ï̵߳÷¶È ÒÔ¼°Ïß³ÌÖ´ÐÐÕß ......
var ProjectName = document.getElementById("<%=ProjectName.ClientID%>").innerText;
ProjectName = ProjectName.replace(/(^\s*)|(\s*$)/g, ""); // Ï൱ÓÚTrim()º¯Êý ......
Ò»¸öÈí¼þÉè¼ÆµÄºÃ»µ£¬ÎÒÏëºÜ´ó³Ì¶ÈÉÏÈ¡¾öÓÚËüµÄÕûÌå¼Ü¹¹£¬¶øÕâ¸öÕûÌå¼Ü¹¹Æäʵ¾ÍÊÇÄã¶ÔÕû¸öºê¹ÛÉÌÒµÒµÎñµÄ³éÏó¿ò¼Ü£¬µ±´ú±íÒµÎñÂß¼µÄ¸ß²ã³éÏó²ã½á¹¹ ºÏÀíʱ£¬Äãµ×²ãµÄ¾ßÌåʵÏÖÐèÒª¿¼Âǵľͽö½öÊÇһЩËã·¨ºÍһЩ¾ßÌåµÄÒµÎñʵÏÖÁË¡£µ±ÄãÐèÒªÔÙ¿ª·¢ÁíÒ»¸öÏà½üµÄÏîĿʱ£¬ÄãÒÔÇ°µÄ³éÏó²ã˵²»¶¨»¹¿ÉÒÔÔÙ´ÎÀûÓà ÄØ£¬Ãæ¶Ô¶ÔÏóµÄÉè¼Æ ......
¹Ø¼ü×Ö: µ×²ãÊý¾Ý Ãû´Ê½âÊÍ£º ²¹Â룺1 ÔÚ¼ÆËã»úϵͳÖУ¬ÊýÖµÒ»ÂÉÓв¹ÂëÀ´±íʾ(´æ´¢). ʹÓò¹Âë,¿ÉÒÔ½«·ûºÅλºÍÆäËûλͳһ´¦Àí;ͬʱ,¼õ·¨Ò²¿É°´¼Ó·¨À´´¦Àí.ÁíÍâ,Á½¸öÓò¹Âë±íʾµÄÊý¾ÝÏà¼Óʱºò,Èç¹û×î¸ßλ(·ûºÅλ)Óнøλ,Ôò½øÎ¥±»ÉáÆú. 2 ²¹ÂëÓëÔÂëµÄת»»¹ý³Ì¼¸ºõÊÇÏàͬµÄ ÊýÖµµÄ²¹Âë±íʾҲ·ÖÁ½ÖÖÇé¿ö£º £¨1£©ÕýÊýµÄ²¹Âë:ÓëÔ ......