mensah putting oracle database 11g to work for java oracle database 11g to work for java kuassi...
TRANSCRIPT
Putting Oracle Database 11g to Work for JavaKuassi MensahGroup Product Manager, Java Platform Groupdb360.blogspot.com
The following is intended to outline our general product direction. It is intended for information purposes only, and may not be incorporated into any contract. It is not a commitment to deliver any material, code, or functionality, and should not be relied upon in making purchasing decisions.The development, release, and timing of any features or functionality described for Oracle’s products remains at the sole discretion of Oracle.
Agenda
• Putting Oracle JDBC 11g Drivers to Work • Putting Universal Connection Pool to Work• Putting the Java Runtime in Oracle Database 11g to
Work
All Java Roads Lead to JDBC
“Transparent” Persistence “Do It YourSelf” Persistence
Object Relational Mapping
POJO
SQLJ
JDBC
EJB
What Oracle JDBC 11g Brings to Java
• JavaStandards: JDBC 4.0, RowSet APIs• Built-in Advanced Security
• Encryption: AES, 3DES• Checksumming: SHA1• Strong Authentication: Kerberos, Radius,SSL
• New Performance Capabilities• Prefetch in First Roundtrip • Faster Native AQ protocol• Query Change Notification• Client Query Result Cache
• Connection Services • Fast Connection Failover (RAC)• Runtime Connection Load Balancing (RAC)• New Universal Connection Pool (RAC, Data Guard, XA)
Client Query Result Cache
• Database Server Configuration (init.ora)client_result_cache_size=200M
client_result_cache_lag=5000
• Client Configuration (sqlnet.ora) OCI_QUERY_CACHE_SIZE=200M
OCI_QUERY_CACHE_MAXROWS=20
• Hints for Caching the Result Setselect /*+ result_cache */ * from employees
• Alternatively without code change alter table emp result_cache (mode force);
• The Cache is proactively invalidated upon changes to the Result Set on the server side
• Available with OCI, PHP, Ruby, ODP.Net, JDBC-OCI, ODBC
Application Server
Database
Fast Connection Fail-Over –What The Application Sees
Failed Database Connections New Database Connections
Fast Connection Failover
Inst x Inst y
Fast Connection Fail-Over –Connection Retry
try {conn = getConnection();// do some work
} catch (SQLException e) {handleSQLException(e)
}...handleSQLException (SQLException e){
if (OracleConnectionCacheManager.isFatalConnectionError(e))
ConnRetry = true; // Fatal Connection error detected,
}
Runtime Connection Load Balancing –How Does It Work?
ApplicationApplication
RAC Database
Instance1
Instance2
Instance3
poolI’m busy
I’m very busy
I’m idle
30% Work
60% Work
10% Work
Oracle
Connection Labeling
JMX-based Management
Statistics
High Availability
Load Balancing
Work Load ManagementWeb, XA, & Connection Affinity
Advanced Timeouts
Diagnostics and Tracing DataGuard Support
JDBC Adapter
Universal
Connection
Pool
Driver / Resource
Pool Users
Database
ERP ADFJava EE TopLink POJOBPEL
LDAP JDBC JCA
SQL Server CICS
JCA Adapter JNDI Adapter LDAP
© 2006 Oracle Corporation – Proprietary and Confidential
Feature Matrix 1/3
Rich set of pool Statistics
Enhanced logging and Diagnostics
Improved Pool Timeouts
JDBC Standard pool properties
JMX-based Pool Management
Dynamic Pool Reconfiguration
Firewall timeout support
Multiple Pools per JVM
Java EE ComponentsStandalone Applications (JDBC, Tomcat, etc)
UCP Feature
Connection Labeling
Connection Harvesting
Application Callbacks
Oracle Data Guard Support
RAC Runtime Connection Load Balancing
RAC UP-event Load Balancing of Connections
RAC Fast Connection Fail-over with Abort Support
Java EE ComponentsStandalone Applications (JDBC, Tomcat, etc)
UCP Feature
Feature Matrix 2/3
Pooling of Proxy Connections
End-to-End Workload Management Metrics
XA Connection Affinity to RAC Instance
Web Session Based Affinity to RAC instance
Refresh, Recycle, Purge, Start, Stop etc. Support
Pooling of XA Connections
Java EE ComponentsStandalone Applications (JDBC, Tomcat, etc)
UCP Feature
Feature Matrix 3/3
Conversational, Web Session, and XA Affinity
Conversational Affinity• Determines if a Connection Request is Serviced by the same
Pool• The first connection request uses RCLB to select a connection. • Subsequent requests enforce Affinity
• Pool resorts to RCLB whenever a desired connection is not found
• Affinity is only a hint • Each RAC instance evaluates performance metrics and sends
affinity hints per Service to UCP
Web Session Affinity• Built into OC4J Web Container – Based on HTTP Session • Determined by either the HTTP Session life cycle or RAC hint• UCP enforces Affinity across AS / OC4J instances
XA Affinity• Enables XA and RAC to work together with optimal
performance – Eliminates current single DTP service limitation for XA/RAC
• XA affinity is the ability to automatically localize a global transaction to a single RAC instance
• XA Affinity scope is the life of a global transaction• first connection request for a global transaction uses RCLB• subsequent requests uses affinity and are routed to the same
RAC instance when XA first started
Conversational, Web Session, and XA Affinity
Java Runtime in the Database
• Java in Mid-Tier versus Java in the Database• Java in the Database: Pros, Cons, What For• Java Standards: Java SE 5, RowSet, JMX• Performance: JIT• Ease of Use & Manageability• Database as Web Services Consumer
JavaJDBCCalls
SQL
Java in Mid-Tier vs Java in the Database
Java
JDBCCalls
Java SE/EE
SQL
Java in the Database
Typically 10+ times Faster!
Any Language
Stored ProcedureCall
Java in the Database
Pros• Business Logic Runs Directly in the Database and
Process Data In Situ, • Eliminates Network Roundtrip• Code Shipping in Cheap• Less Moving Parts• Perfect for Data-Intensive Problems• Good for Data-and-Compute intensiveCons• Databases can scale up to 100s nodes, only!
Java in the Database: What For
• Trigger-based Notification System using RMI
• Secure Credit-Card Processing using JSSE
• Custom Alert applications that monitor business data
• Sending emails with attachment from within the database
• Produce PDF files from Result Set
• Execute external OS commands and external procedures
• Implement Md5 CRC• Publish Repository Content to
Portal• Portable Logistic Applications
• Implement Parsers for various File Formats (txt, zip, xml, binary)
• Implement Image Transformation and Format Conversion (GIF, PNG, JPEG, etc)
• Implement database-resident Content Management System
• HTTP Call-Out• JDBC Call-Out• RMI Call-Out to SAP• Web Services Call-Out• Messaging across Tiers• Database Resident Lucene*• RESTful Database Web Services*
* http://marceloochoa.blogspot.com/
JIT
• Faster and Transparent Native Compilation• 10X Speed up out of the box
• No dependency on C compiler• Automatic Compilation (enabled out of the box)• Compiles also dynamically generated Java code• Uses a Feedback Mechanism for Detecting Hot
Spots• Persist Compiled Java in the database• Bottom Line: Faster Java Execution
Database as Web Services Consumer
Java WSStack
Oracle Database
JavaWS Proxy
TableFunction
SQL, PL/SQL
PL/SQLWrapper
JavaDynamicInterface
UTL_DBWS
Web Service
SOAP Request
Resources …
• Oracle JDBC and UCPhttp://www.oracle.com/technology/tech/java/sqlj_jdbc/
• Java Runtime in the Databasehttp://www.oracle.com/technology/tech/java/jsp/index.html
• Oracle Database Programming using Java and Web Services by Kuassi Mensah
http://db360.blogspot.com/2006/08/oracle-database-programming-using-java_01.html