import java.awt.*;
import java.sql.*;
/** Load some drivers. */
public class LoadDriver {
public static void main(String[] av) {
try {
// Try to load the jdbc-odbc bridge driver
// Should be present on Sun JDK implementations.
Class c = Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
System.out.println("Loaded " + c);
// Try to load an Oracle driver.
Class d = Class.forName("oracle.jdbc.driver.OracleDriver");
System.out.println("Loaded " + d);
} catch (ClassNotFoundException ex) {
System.err.println(ex);
}
}
}
羅伯特 發表在 痞客邦 留言(0) 人氣(500)
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
public class ConnPOP {
java.util.Properties prop = new java.util.Properties();
/*TaiWan Operation Server*/
String DbSID = "TEST";
String HostName = "192.168.1.20";
String username = "TEST";
String userpwd = "TEST";
//REMOTE ORACLE 8i THIN
String url = "jdbc:oracle:thin:@"+ HostName + ":1521:" + DbSID;
Connection conDB = null;
public Connection getConn(){
try{
prop.put("user", username);
prop.put("password", userpwd);
prop.put("CHARSET", "eucksc");
// Oracle 8i not pooling connection
Class.forName("oracle.jdbc.driver.OracleDriver");
//取得連線
conDB = DriverManager.getConnection(url, username, userpwd);
//System.out.println("DataBase connected : " + conDB.toString());
System.out.println("DataBase connected ");
conDB.setAutoCommit(false);
}
catch(ClassNotFoundException cnfe){
System.out.println("Driver didn't be load : " + cnfe.toString());
}
catch(SQLException sqle){
System.out.println("DataBase didn't connected : " + sqle.toString());
}
finally{
if(conDB == null){
try{
conDB.close(); //關閉資料庫連結
}
catch(SQLException sqle){ }
}
}
return conDB;
}
//==KOREA POP
public Connection getConnKor(){
try{
prop.put("user", "TEST");
prop.put("password", "TEST");
prop.put("CHARSET", "eucksc");
// Oracle 8i not pooling connection
Class.forName("oracle.jdbc.driver.OracleDriver");
//取得連線
conDB = DriverManager.getConnection("jdbc:oracle:thin:@192.168.2.20:1521:TEST", "TEST", "TEST");
//System.out.println("KOREA DataBase connected : " + conDB.toString());
System.out.println("KOREA DataBase connected ");
conDB.setAutoCommit(false);
}
catch(ClassNotFoundException cnfe){
System.out.println("Driver didn't be load : " + cnfe.toString());
}
catch(SQLException sqle){
System.out.println("Kor DataBase didn't connected : " + sqle.toString());
}
finally{
if(conDB == null){
try{
conDB.close(); //關閉資料庫連結
}
catch(SQLException sqle){ }
}
}
return conDB;
}
}
羅伯特 發表在 痞客邦 留言(1) 人氣(15,607)
在找尋 Windows 免費的備份機制軟體時
看到了這個, 感覺上全用上了
先記起來, 有時間再測測看
PS: /S & /E 好像有點衝突哩
羅伯特 發表在 痞客邦 留言(0) 人氣(372)
From http://www.interfacebus.com/ASCII_Table.html
羅伯特 發表在 痞客邦 留言(0) 人氣(1,047)
有時候,在 IE下載 EXCEL檔案的時候,
不小心點掉了這個選項, 【開啟這類檔案之前 , 一定要先問我】
羅伯特 發表在 痞客邦 留言(0) 人氣(8,217)