370 likes | 494 Views
What’s New for Java in Oracle Database 12c. Kuassi Mensah Director Product Management.
E N D
What’s New for Java in Oracle Database 12c KuassiMensahDirector Product Management
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.
My Next Sessions • Oracle In-Database MapReduce (Hands-on lab) • 7/24/13, 17:15 – 18:15, Room 411/412 • Maximun Application Availability with Oracle database 12c • 7/25/13, 09:00 – 10:00, Room 429 • Oracle In-Database MapReduce: When Hadoop Meets Exadata • 7/25/13, 12:00 – 13:00, Room 431
Agenda • Support for Java Standards • Multitenant architecture& New SQL Data Types • Java Performance & Scalability • Java Availability • Global Data Services for Java • Security& Deprecated/Desupported Features
JDBC/UCP Support for JDK 7 and JDBC 4.1 Support for JDBC 4.1 • Java SE 7, ojdbc7.jar, ucp.jar • setClientInfo(), and getClientInfo() • getObject() • try with resources • New methods in java.sql.Connection
Java in the Database • Multiple Java SE: JDK 6 & JDK 7; JNDI, Logging • Performance: Stored procedures & functions • Reuse skills and libraries • Integrate Lucene, Solr, Hadoop with the database • Image Transformation and Conversion (GIF, PNG, JPEG) • Parsers for various File Formats (txt, zip, xml, binary) • Calling-Out External Systems • HTTP Call-Out, JDBC Call-Out, Web Services Call-Out
Java in the DatabaseInstall JDK 7 at Database Creation Time • Run the following Perl script perl $ORACLE_HOME/javavm/install/update_javavm_binaries.pl 7 • Relink Oracle on Non-Windows platforms cd $ORACLE_HOME/rdbms/lib make -f ins_rdbms.mk ioracle • Proceed with database creation steps
Agenda • Java Standards • Multitenant architecture and New SQL Data Types • Java Performance & Scalability • Java Availability • Global Data Services for Java • Security& Deprecated/Desupported Features
JDBC/UCP Support for Multitenant architecture • Transparent through Net Service • SET CONTAINER <container> • Common pool across containers thru UCP connection labeling and callback
JDBC Support for New SQL Data Types • 32K VARCHAR, NVARCHAR, and RAW • Invisible or Hidden Columns • Implicit Result Set • Auto-Increment Columns (IDENTITY columns) • PL/SQL Package Types as Parameter
32K VARCHAR NVARCHAR and RAW • VARCHAR2, NVARCHAR2, and RAW increased from 4,000 to 32,767 bytes • Java applications no longer need to switch to large objects (LOBs) for data inferior to 32K in size • Indexes may be built on top of these columns • Pre-Requisites (DBA) • Set the COMPATIBLE initialization parameter to 12.0.0.0. • Set the MAX_STRING_SIZE initialization parameter to EXTENDED. • Run the rdbms/admin/utl32k.sql script.
Invisible or Hidden ColumnsEase of Upgrade • Columns created with INVISIBLE SQL keyword • Invisible columns are not displayed during generic access such as a “SELECT * FROM table” or “DESCRIBE table” • JDBC furnishes isColumnInvisible() to check whether a column is invisible/hidden or not. OracleResultSetMetaDatarsmd = (OracleResultSetMetaData)rset.getMetaData(); System.out.println("Visibility:" + rsmd.isColumnInvisible(2));
Implicit Result Set • Problem to solve: migrate Java applications from third-party RDBMS that do not use RefCursor. • Implicit Results: retrieve the return of stored procedures (PL/SQL, Java) directly, using DBMS_SQL.RETURN_RESULT. • Example of Stored Procedure using dbms_sql.return_result() create or replace procedure p_imres asresult sys_refcursor; begin open result for select * from tab;dbms_sql.return_result(result);end;
Implicit Result Set • New Oracle JDBC methods getMoreResults() orgetMoreResults(int)The int parameter that can have one of the following values:KEEP_CURRENT_RESULT, CLOSE_ALL_RESULTS, CLOSE_CURRENT_RESULT getResultSet():iteratively retrieves each implicit result • The following foreign Java code will just work with Oracle CallableStatementcstmt = null;ResultSetrs = null;cstmt = conn.prepareCall(“{call p_imres()}”);cstmt.execute();booleanresultsAvailable = cstmt.getMoreResults();
JDBC Support for Auto-Increment Columns • Problem to Solve: Reuse applications, built on foreign RDBMS, that use auto-increment columns • The Oracle database 12c implements ANSI compliant automatically incrementing columns using the SQL keyword IDENTITY. CREATE TABLE t1 (c1 NUMBER GENERATED BY DEFAULT ON NULL AS IDENTITY, c2 VARCHAR2(10)); • No new JDBC API needed
PL/SQL Package Types as Parameter • Problem to Solve: Access PL/SQL types as Java arrays without creating PLSQL wrappers • Usage type name specified as <package name>.<type name> or <schema name>.<package name>.<type name> 1) Create PLSQL types using %ROWTYPE CREATE OR REPLACE PACKAGE pack1 AS TYPE employee_rowtype_array IS A TABLE OF Employee%ROWTYPE; END; /
PL/SQL Package Types as Parameter 2) Obtain the rows as ajava.sql.Array of java.sql.Struct CallableStatementcstmt = connection.prepareCall( “BEGIN SELECT * INTO :1 FROM EMPLOYEE; END;”); cstmt.registerOutParameter(1, OracleTypes.ARRAY, “PACK1.EMPLOYEE_ROWTYPE_ARRAY”); cstmt.execute(); Array employeeArray = cstmt.getArray(1); This feature makes easier to fetch query results as Java Array or Struct, therebysimplifying Object-Relational mapping.
Row Count per Array DML with JDBC Long Awaited • Java applications using Oracle JDBC drivers can now retrieve the number of rows affected by each iteration of an array DML statement (i.e., array INSERT, UPDATE, DELETE). … intrcount[] = stmt.executeBatch();
Agenda • Support for Java Standards • Multitetant architectureand New SQL Data Types • Java Performance & Scalability • Java Availability • Global Data Services for Java • Security& Deprecated/Desupported Features
Java Applications Performance & Scalability New Performance and Scalability Features • New Memory Management • JDBC/UCP Support for Database Resident Connection Pool • Very Large Network Buffers (SDU)
Extreme Scalability with DRCPSupport Tens of Thousands of Concurrent Users POC: 5000 users; DRCP pool size of 100
Configuring DRCP on RDBMS-Side • DRCP pools must be explicitly created, started and stopped by the DBA using the DBMS_CONNECTION_POOL package. sqlplus /nolog connect / as sysdba execute dbms_connection_pool.start_pool(); ... execute DBMS_CONNECTION_POOL.CONFIGURE_POOL (session_cached_cursors=>50); ... execute dbms_connection_pool.stop_pool();
Very Large Network Buffers (SDU) Controls SQL*Net packet size Default: 8K Max: 2MB (12c), 64K (11.2), 32K (pre-11.2) Set in sqlnet.ora: DEFAULT_SDU_SIZE tnsnames.ora: SDU in address Connect String Larger SDU gives Better Network throughput Fewer system calls to send and receive data Less CPU usage – system and user Side-effect of larger SDU: Network buffers take up more memory Where to configure? Client : URL sqlnet.ora and/or tnsnames.ora or LDAP Server: sqlnet.ora
Agenda • Support for Java Standards & New SQL types • Java Support for Multitenant Pluggable Databases • Java Performance & Scalability • Java Availability • Global Data Services for Java • Security& Deprecated/Desupported Features
Application Continuity for Java Problems to Solve Upon Database Outage Four Problems Confront Applications • Hang • Errors & Connection Handling • Outcome of In-Flight Work • Resubmission of In-Flight Work More details in session “Maximum Application Availability”7/25/13, 09:00 –10:00, Room 429
RAC Database Instance1 Instance2 Instance3 Proxy 1 Proxy 2 Connection Replay Context Application Continuity In Action Oracle JDBC Driver Call 1 Call 2 Application
Agenda • Support for Java Standards • Multitenant architectureand New SQL Data Types • Java Performance & Scalability • Java Availability • Global Data Services for Java • Security & Deprecated & Desupported Features
Databases in Replicated EnvironmentsChallenges/ Requirements • No seamless way to efficiently use all the databases • No automated load balancing and fault tolerance Primary Active Standby Active Standby GoldenGate
Global Data Services Load Balancing and Service Failover for Replicated Databases • Extends RAC-style service failover,load balancing and manageability to a set of replicated databases • Takes into account network latency, replication lag, and service placement policies • Achieve higher availability, improved manageability and maximize performance Global Data Services
UCP Support for Global Data Services • Transparently supports existing Fast Connection Failover (FCF), Runtime Load Balancing (RLB), Database Affinity • Specify global service name and region in connect URL (DESCRIPTION= (ADDRESS_LIST= (LOAD_BALANCE=ON) (FAILOVER=ON) (ADDRESS=(GDS_protocol_address_information)) (ADDRESS=(GDS_protocol_address_information)) ) (CONNECT_DATA= (SERVICE_NAME=global_service_name) (REGION=region_name)))
Agenda • Support for Java Standards • Multitenant architecture and New SQL Data Types • Java Performance & Scalability • Java Availability • Global Data Services for Java • Security & Deprecated/DesupportedFeatures
Advanced Security Enhancements • JDBC now supports SHA-2 hashing algorithms: SHA-256, SHA-384, and SHA-512 prop.setProperty(OracleConnection.CONNECTION_PROPERTY_THIN_NET_CHECKSUM_TYPES, "( MD5, SHA1, SHA256, SHA384 or SHA512 )"); prop.setProperty(OracleConnection.CONNECTION_PROPERTY_THIN_NET_CHECKSUM_LEVEL, "REQUIRED");
Deprecated and de-supported features • Deprecated Features • Concrete types oracle.sql.CLOB, oracle.sql.BLOB, oracle.sql.BFILEoracle.sql.STRUCT, oracle.sql.ARRAY,oracle.sql.OPAQUE: use Java and Oracle interfaces • Oracle style batching: use Java Standard batching pstmt.setInt(1, 1234);pstmt.setString(2, “Product #1”); pstmt.addBatch(); int [] batchCount = pstmt.executeBatch(); • End to End metrics API: use Java standard setClientInfo() • Desupported Feature • JDK 5 is not supported in 12.1: JDK 6 and JDK 7 supported • Implicit Connection Cache: use UCP instead