[zt] JDBC連線Oracle RAC的連線串配置
jdbc連線oracle的連線串如下:
String url="jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = host2)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = host1)(PORT = 1521))(LOAD_BALANCE = yes)(FAILOVER = ON)(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = db.domain)(FAILOVER_MODE=(TYPE = SELECT)(METHOD = BASIC)(RETIRES = 20)(DELAY = 15))))";
java測試程式如下:
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;public class Test {
public static void main(String arg[]) {
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
String url="jdbc:oracle:thin:@(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = host1)(PORT = 1521))(ADDRESS = (PROTOCOL = TCP)(HOST = host2)(PORT = 1521))(LOAD_BALANCE = yes)(FAILOVER = ON)(CONNECT_DATA =(SERVER = DEDICATED)(SERVICE_NAME = db.domain)(FAILOVER_MODE=(TYPE = SELECT)(METHOD = BASIC)(RETIRES = 20)(DELAY = 15))))";
Connection c = DriverManager.getConnection(url,"aa","aa");
Statement s = c.createStatement();
ResultSet r = s.executeQuery("select 1 from dual");
while(r.next()) {
System.out.println(r.getString(1));
}
}catch(Exception e) {
System.out.println(e.toString());
}
}}
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/35489/viewspace-480154/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle 11gR2 RAC的JDBC連線串OracleJDBC
- jdbc 連線 oracle racJDBCOracle
- Oracle 11g RAC通過SCAN IP連線資料庫 - JDBC連線串問題Oracle資料庫JDBC
- jdbc連線oracleJDBCOracle
- jdbc連線oracle rac資料庫的寫法JDBCOracle資料庫
- 在JDBC連線池中啟動Oracle RAC的TAFJDBCOracle
- derby 的配置及jdbc連線JDBC
- JDBC連線資料庫時,Oracle9i的連線引數配置JDBC資料庫Oracle
- powerdesigner jdbc 連線 oracleJDBCOracle
- JDBC連線ORACLE問題JDBCOracle
- 【JDBC】java連線池模擬測試 連線oracleJDBCJavaOracle
- 【JDBC】使用OracleDataSource建立連線池用於連線OracleJDBCOracle
- java Jdbc連線oracle資料庫連線測試JavaJDBCOracle資料庫
- tomcat 配置JDBC連線池TomcatJDBC
- JDBC 連線oracle三種方法JDBCOracle
- oracle連線串的一種寫法Oracle
- JDBC連線mysqlJDBCMySql
- JDBC連線大全JDBC
- weblogic 連線oracle racWebOracle
- PostgreSQL連線串URI配置(libpq相容配置)SQL
- Oracle 連線池配置Oracle
- java 連線oracle (jdbc-odbc橋)JavaOracleJDBC
- JDBC 連線詳解JDBC
- Java JDBC連線MYsqlJavaJDBCMySql
- JDBC連線引數JDBC
- 連線zk 報錯連線不上hbase jdbcJDBC
- 轉:ORACLE的JDBC連線方式:OCI和THINOracleJDBC
- 資料庫的連線串資料庫
- Oracle RAC 環境下的連線管理Oracle
- Tomcat 的 JDBC 連線池TomcatJDBC
- Oracle(+)連線與Join連線Oracle
- Oracle左連線,右連線Oracle
- Python連線Redis連線配置PythonRedis
- Oracle的左連線和右連線Oracle
- java應用通過jdbc連線資料庫jdbc的串的3種寫法:JavaJDBC資料庫
- JDBC連線資料庫JDBC資料庫
- 應用JDBC連線SQLiteJDBCSQLite
- JDBC Driver連線方法列表JDBC