rac的配置如下:
rac服務名為oratest
我的應用伺服器為apache+tomcat
配置過程如下
1、搜尋了一下,發現提供的連線rac方法很多,拷貝了如下的jdbcurl:
jdbc:oracle:thin:@(description=(address_list= (address=(host=192.168.60.132) (protocol=tcp)(port=1521))(address=(host=192.168.60.144)(protocol=tcp) (port=1521)) (load_balance=yes)(failover=yes))(connect_data=(service_name= oratest)))
但是tomcat報出如下錯誤:
io異常: nl exception was generated;
2、又從網上google、baidu一番,雖然找到n方法,但就是連不上,總是提示這個錯誤;
3、無奈之中,開啟資料庫tnsname.ora,發現其中的配置如下:
oratest=
(description =
(address_list =
(address = (protocol = tcp)(host = rac1)(port = 1521))
(address = (protocol = tcp)(host = rac2)(port = 1521))
(load_balance = yes)
(connect_data =
(server = dedicated)
(service_name = oratest)
於是將jdbcur修改成:
jdbc:oracle:thin:@(description=(address_list= (address=(host=rac1) (protocol=tcp)(port=1521))(address=(host=rac2)(protocol=tcp) (port=1521)) (load_balance=yes)(failover=yes))(connect_data=(service_name= oratest)))
測試一下,結果竟然成功了;
建議:對於連線rac有問題的情況,最好使用tnsnames.ora中連線字串進行連線;
JDBC連線出錯
在連線資料庫來運算元據時,出現如下錯誤資訊 org.springframework.beans.factory.xml.xmlbeandefinitionreader loading xml bean definitions from class path resource org springfr...
JDBC連線屬性
hibernate 需要進行資料庫訪問,因此必須設定連線資料庫的相關屬性。所有 hibernate 屬性的名字和語義都在 org.hibernate.cfg.environment 中定義。下面是關於 jdbc 連線配置中最重要的設定。hibernate.connection.driver clas...
JDBC連線屬性
hibernate 需要進行資料庫訪問,因此必須設定連線資料庫的相關屬性。所有 hibernate 屬性的名字和語義都在 org.hibernate.cfg.environment 中定義。下面是關於 jdbc 連線配置中最重要的設定。hibernate.connection.driver clas...