Focus On Oracle

Installing, Backup & Recovery, Performance Tuning,
Troubleshooting, Upgrading, Patching

Oracle Engineered System


当前位置: 首页 » 技术文章 » Oracle

Oracle JDBC/UCP FAQ

无论是在云上还是在本地,开发Oracle数据库的Java应用程序都是快速而简单的。Java开发人员可以利用最新的特性,比如Oracle Autonomous Database, performance self-tuning, high availability, in-memory processing, and pluggable databases来设计和开发高性能、可伸缩和高可用性的应用程序。


Oracle JDBC和UCP(Universal Connection Pool[通用连接池])与所有Java EE containers and ORMs都能很好地工作,比如像Java EE containers的WebLogic Server、Tomcat、WebSphere等,以及Spring、Hibernate框架等Java ORMs。下面是12.2 JDBC driver & Universal Connection Pool (UCP)的新特性。

    Java Standards: Java SE 8 and JDBC 4.2 are supported by JDBC driver (ojdbc8.jar) and Universal Connection Pool (ucp.jar)
    Performance features: UCP redesign of thread handling using Multi-dimension Search Tree, Network compression over WAN (JDBC),  Configurable connection health check frequency (UCP)
    Scalability features: Shared Pool for Multitenant Database (UCP), Shared Pool for Sharded database (UCP), Sharding APIs (JDBC, UCP)
    High Availability features:  FAN and ONS are auto-enabled in UCP, FAN events support in the driver (JDBC), Application Continuity for XA Datasources, Transaction Guard for XA Datasource, and Java APIs for FAN events (JDBC)
    Security features: Support for TLSv1.1 and TLSv1.2
    Manageability features: UCP XML configuration file
    Ease of use: Wider System Change Numbers (SCNs)

Java Programming with Oracle Database 12c RAC and Active Data Guard该书册介绍了如果在RAC和DG环境中如何启用FAN、ONS、FCF、TG、AC以及Load-balance等,对开发高可用的Java程序非常使用。建议多学习和了解。
Universal Connection Pool (UCP)
Fast Application Notification (FAN) 
Oracle Notification Service (ONS)
Fast Connection Failover (FCF)
Logical Transaction ID (LTXID)
Database Request
Recoverable Errors
Mutable Functions
Transaction Guard (TG)
Application Continuity (AC)


下面的链接介绍了如何在Weblogic、Tomcat、websphere、Spring Framework、Hibernate使用JDBC的的例子

Configure a DataSource in WebLogic Server (WLS) with UCP

https://blogs.oracle.com/dev2dev/create-and-deploy-a-java-servlet-using-weblogic-server-wls
    
Zero downtime with Tomcat
http://www.oracle.com/technetwork/database/application-development/planned-unplanned-rlb-ucp-tomcat-2265175.pdf
   
Zero downtime with WebSphere
http://www.oracle.com/technetwork/database/application-development/planned-unplanned-rlb-ucp-websphere-2409214.pdf
   
Configure UCP DataSource with JBOSS
https://blogs.oracle.com/dev2dev/using-universal-connection-pool-ucp-as-a-pool-datasource-in-jboss-70-eap
    
Configure UCP with Spring Framework
https://blogs.oracle.com/dev2dev/ucp-with-spring-framework
    
Configure UCP with Hibernate
https://blogs.oracle.com/dev2dev/use-ucp-with-hibernate

JDBC FAQ
http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-faq-090281.html

UCP FAQ
http://www.oracle.com/technetwork/database/application-development/default-2248812.html

Java JDBC, UCP ,OJVM样例
https://github.com/oracle/oracle-db-examples/tree/master/java


如何正确的连接Oracle数据库

连接数据库用实例名(ORACLE_SID),Oracle不推荐使用,也不要使用
 jdbc:oracle:thin:[<user>/<password>]@<host>[:<port>]:<SID>
 String url = "jdbc:oracle:thin:@myhost:1521:orcl";

下面是如果用服务名(Service name)连接Oracle数据库,建议也推荐一定要用这个
 jdbc:oracle:thin:[<user>/<password>]@//<host>[:<port>]/<service>
 String url = "jdbc:oracle:thin:@//myhost:1521/orcl";

还可以用jdbc:oracle:thin:@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCPS)(HOST=<host>)(PORT=<port>))(CONNECT_DATA=(SERVICE_NAME=<service>)))


Reference
https://blogs.oracle.com/dev2dev/
http://www.oracle.com/technetwork/database/application-development/jdbc/overview/index.html
http://www.oracle.com/technetwork/database/application-development/jdbc/JDBC-News/index.html
http://www.oracle.com/technetwork/database/application-development/jdbc/downloads/index.html
http://www.oracle.com/technetwork/database/application-development/jdbc/overview/javaee-4310131.html
http://www.oracle.com/technetwork/database/application-development/jdbc/learnmore/index.html
http://www.oracle.com/technetwork/database/enterprise-edition/jdbc-faq-090281.html
https://docs.oracle.com/en/database/oracle/oracle-database/12.2/jjuar/index.html
https://community.oracle.com/community/java/database_connectivity/java_database_connectivity/

http://www.oracle.com/technetwork/database/application-development/jdbc/learnmore/index.html

http://db360.blogspot.com


关键词:ucp jdbc 

相关文章

Oracle Database 19c with UCP(Universal Connection Pool)
Oracle JDBC/UCP FAQ
Getting started with Oracle JDBC
Top