# DCjdbc.ctl:366:Collects Oracle Java DB Connectivity (JDBC) Information # $Id: DCjdbc.ctl,v 1.11 2016/05/18 17:28:32 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/OFM/DCjdbc.ctl,v 1.11 2016/05/18 17:28:32 RDA Exp $ # # Change History # 20151021 KRA Add 'Product Feature Sets' report. =head1 NAME OFM:DCjdbc - Collects Oracle Java DB connectivity (JDBC) Information =head1 DESCRIPTION This module collects Oracle Java DB Connectivity (JDBC)-related diagnostic information. The following reports can be generated and are regrouped under C: =cut echo tput('bold'),'Processing OFM.JDBC module ...',tput('off') # Initialization var $COMMON_HOME = ${D_COMMON_HOME/P:''} var $ORACLE_HOME = ${D_ORACLE_HOME/P:''} var $JDBC_LIB = catDir($ORACLE_HOME,'jdbc','lib') var $TOC = '%TOC%' var $TOP = '[[#Top][Back to top]]' pretoc '1:Oracle JDBC' # Set the symbols call setSymbol('$CH1',$COMMON_HOME) # Get the ps command format var $PS_EF run &{check(getOsName(),'aix', 'OS:OSaix',\ 'darwin', 'OS:OSdarwin',\ 'dec_osf', 'OS:OSosf',\ 'dynixptx', 'OS:OSptx',\ 'hpux', 'OS:OShpux',\ 'linux', 'OS:OSlinux',\ 'solaris', 'OS:OSsunos',\ cond(isCygwin(), 'OS:OSunix',\ isUnix(), 'OS:OSunix'))}('PS') =head2 jdbc_sum - JDBC Summary Displays the JDBC Summary. =cut # Macro to get the JDK version macro get_jdk_version {var ($dir,$ttl) = @arg import $JAVA_CMD,$MOD,$TOP keep $JAVA_CMD,$MOD,$TOP if ?testFile($MOD,catFile($dir,'bin',${AS.EXE:'java'})) {var $cmd = last # call writeCommand(concat($cmd = quote($cmd),' -fullversion 2>&1')) var ($ver) = replace(trim(grepCommand(concat($cmd = quote($cmd),\ ' -fullversion 2>&1'),'java full version','if')),'^java full version') write '|',encode(addSymbol($cmd)),'|',replace($ver,'"','',true),'|' if !?$JAVA_CMD var $JAVA_CMD = $cmd } } var %fil = () loop $fil (grepDir($ORACLE_HOME,\ '^(classes12|classes12_g|classes12dms|classes12dms_g|\ ojdbc5|ojdbc5_g|ojdbc5dms|ojdbc5dms_g|\ ojdbc6|ojdbc6_g|ojdbc6dms|ojdbc6dms_g|\ ojdbc7|ojdbc7_g|ojdbc7dms|ojdbc7dms_g|\ ojdbc14|ojdbc14_g|ojdbc14dms|ojdbc14dms_g|\ ons|orai18n|simplefan|ucp|xdb|xdb6)\.jar$','dir')) var $fil{dirname($fil),basename($fil)} = $fil debug ' Inside JDBC module, constructing JDBC Summary page' report jdbc_sum title '---+!! JDBC Summary' write '%TOC%' # JDBC Drivers if ?findCommand('java') {var $cmd = last debug ' Inside JDBC Summary - JDBC Drivers version info' prefix {write '---+ JDBC Drivers' write '|*Path*|*JAR filename*|*Version*|' } loop $grp (keys(%fil)) { # Gather the JDBC version information associated with the files loop $nam (keys($fil{$grp})) {next !match($nam,'^ojdbc\d+\.jar$',true) var $fil = $fil{$grp,$nam} var ($ver) = trim(grepCommand(concat($cmd,' -jar ',quote($fil),' -version'),\ '^Oracle[\d.\s]+JDBC[\d.\s]+','if')) if last write '|',encode(addSymbol($grp)),'|',encode($nam),'|',(last),'|' else write '|',encode(addSymbol($grp)),'|',encode($nam),\ '|java is unable to retrieve version|' } } if hasOutput(true) write $TOP } debug ' Inside JDBC Summary - DB version info' run DB:DBinfo() if get_db_full_version() { prefix {write '---+ DB Versions' write '|*Path*|*Version*|' } write '|',encode(addSymbol($ORACLE_HOME)),'|',(last),'|' if hasOutput(true) write $TOP } debug ' Inside JDBC Summary - JDK version info' var $JAVA_CMD = undef prefix {write '---+ JDK Versions' write '|*Path*|*Version*|' } call get_jdk_version(first(findDir($ORACLE_HOME,'^jdk','p')),\ 'ORACLE_HOME (jdk)') if hasOutput(true) write $TOP debug ' Inside JDBC Summary - Environment variables' prefix {write '---+ Environment variables' write '|*Variable*|*Value*|' } loop $key ('CLASSPATH','PATH','LIBPATH') write '|',$key,' |',getEnv($key),' |' if hasOutput(true) write $TOP if isCreated(true) toc '2:[[',getFile(),'][rda_report][JDBC Summary]]' =head2 abbr - Abbreviations Displays the RDA abbreviations defined for the Oracle JDBC home collection. =cut debug ' Inside JDBC module, collecting defined abbreviations' report abbr prefix {write '---+ Oracle JDBC Home Abbreviations' write '|*Abbreviation*|*Location*|' } var %hsh = getSymbols() loop $key (keys(%hsh)) write '|',$key,' |',$hsh{$key},' |' if isCreated(true) toc '2:[[',getFile(),'][rda_report][Abbreviations]]' =head2 jdbc_ver - JDBC Driver Details Extracts the Oracle JDBC version of Java archive files from F<$ORACLE_HOME> directory when F is available. =cut if ?findCommand('java') { report jdbc_ver var $cmd = last debug ' Inside JDBC module, gathering JDBC Driver Details' debug ' - Java command ',$cmd loop $grp (keys(%fil)) {debug ' - From the ',$grp,' directory' # Gather the JDBC version information associated with the files loop $nam (keys($fil{$grp})) {next !match($nam,'^ojdbc\d+\.jar$',true) var $fil = $fil{$grp,$nam} prefix {write '---+!! JDBC Version Information from ',encode($grp),' Directory' write '---++ ',encode($nam) } call writeCommand(concat($cmd,' -jar ',quote($fil),' -version')) if hasOutput(true) write $TOP } } # Add relevant report to the table of content if isCreated(true) toc '2:[[',getFile(),'][rda_report][JDBC Driver Details]]' } =head2 jdbc_manifest - Manifest Information Extracts the manifest of Java archive files from F<$ORACLE_HOME> directory when F is available. =cut if ?findCommand('unzip') {var $cmd = last debug ' Inside JDBC module, extracting version from the manifest' report jdbc_manifest title '---+!! Manifest Information' prefix { write '|*Path*|*JAR filename*|*Version*|' } # Generate the reports and related index links loop $grp (keys(%fil)) {debug ' - From the ',$grp,' directory' # Gather the manifest information associated with the files loop $nam (keys($fil{$grp})) {var $fil = $fil{$grp,$nam} var ($ver) = replace(trim(grepCommand(concat($cmd,' -p ',quote($fil),\ ' META-INF/MANIFEST.MF 2>/dev/null'),'Implementation-Version:','if'))\ ,'^Implementation-Version:') write '|',encode(addSymbol($grp)),'|',encode($nam),'|',$ver,'|' } } if hasOutput(true) write $TOP # Add relevant report to the table of content if isCreated(true) toc '2:[[',getFile(),'][rda_report][Manifest Information]]' # Generate manifest detailscvs log report manifest_details loop $grp (keys(%fil)) {debug ' - From the ',$grp,' directory' title '---+!! Manifest Information from ',encode(addSymbol($grp)),' Directory' # Gather the manifest information associated with the files loop $nam (keys($fil{$grp})) {var $fil = $fil{$grp,$nam} prefix write '---++ ',encode($nam) call writeCommand(concat($cmd,' -p ',quote($fil),\ ' META-INF/MANIFEST.MF 2>/dev/null')) if hasOutput(true) write $TOP } } # Add relevant report to the table of content if isCreated(true) toc '3:[[',getFile(),'][rda_report][Manifest details]]' } =head2 lib - lib Directory Contents Lists the contents of F<$ORACLE_HOME/jdbc/lib> directory. =cut debug ' Inside JDBC module, listing the lib directory contents' report lib prefix write '---+ Contents of the lib Directory' call statDir('n',$JDBC_LIB) if isCreated(true) toc '2:[[',getFile(),'][rda_report][lib Directory Contents]]' =head2 jdbc_debug - JDBC Debugging Information Gathers the Oracle Java DB Connectivity debugging information (UNIX only). =cut if isUnix() {debug ' Inside JDBC module, gathering debugging information' if grepCommand($PS_EF,'-Doracle\.jdbc\.Trace=true') {pretoc '2:JDBC Debugging Information' loop $lin (last) {if match($lin,'-Djava\.util\.logging\.config\.file=(.*?)\s+-') {var $nam = basename($fil = first) output F,jdbc_debug write '---+ JDBC Debugging Information' write '---## Information Taken from ',encode($fil) write ' * JDBC debugging is enabled.' call writeFile($fil) write $TOP toc '3:[[',getFile(),'][rda_report][',encode($nam),']]' } } unpretoc } else {output F,jdbc_debug write '---+ JDBC Debugging Information' write ' * JDBC debugging is not enabled.' write ' * ``oracle.jdbc.Trace`` property is set to ``false``.' toc '2:[[',getFile(),'][rda_report][JDBC Debugging Information]]' } } =head2 netperf - Network Performance Performs ping tests when specified in the setup file. Collects connection information and statistics from F. Lists declared ports. =cut debug ' Inside JDBC module, gathering network performance information' loop $id (findShares('NET_PERF','OS.NET')) toc '2:[[',setShare($id),'][rda_report][',getShare($id),']]' =head2 Oracle WebLogic Server Details =head3 product_info - Product Information Gathers the product information. =cut pretoc '2:Oracle WebLogic Server Details' debug ' Inside JDBC module, processing Product Information' loop $id (findShares('WREQ_PRD_INFO','OFM.WREQ')) toc '3:[[',setShare($id),'][rda_report][',getShare($id),']]' =head3 product_set - Product Feature Sets Gathers the product feature sets information. =cut debug ' Inside JDBC module, gathering product feature sets' loop $id (findShares('WREQ_PRD_SETS','OFM.WREQ')) toc '3:[[',setShare($id),'][rda_report][',getShare($id),']]' =head3 wls_version - Oracle WebLogic Server Version Gets the Oracle WebLogic Server version. =cut debug ' Inside JDBC module, gathering Oracle WebLogic Server version' loop $id (findShares('WREQ_WLS_VER','OFM.WREQ')) toc '3:[[',setShare($id),'][rda_report][',getShare($id),']]' =head3 jdk_ver - JDK Version Gets the Java Development Kit version. =cut debug ' Inside JDBC module, gathering JDK version' loop $id (findShares('WREQ_JDK_VER','OFM.WREQ')) toc '3:[[',setShare($id),'][rda_report][',getShare($id),']]' =head3 jdbc_config - JDBC System Resources Configuration Gathers the Oracle WebLogic Server-related JDBC system resources configuration information. =cut debug ' Inside JDBC module, collecting the JDBC system resources config' loop $id (findShares('WREQ_JDBC_CONFIG','OFM.WREQ')) toc '3:[[',setShare($id),'][rda_report][',getShare($id),']]' =head3 Manifest Information Gathers the Common Components home manifest information. =cut pretoc '3:Manifest Information' debug ' Inside JDBC module, getting common components manifest information' loop $id (findShares('IREQ_CH_MANIFEST','OFM.IREQ')) toc '4:[[',setShare($id),'][rda_report][',getShare($id),']]' unpretoc 2 unpretoc =begin credits =over 10 =item RDA 4.17: Anjani Sankar, Miguel Hernandez =item RDA 4.20: Miguel Hernandez =item RDA 8.08: Ian Reid. =item RDA 8.10: Ian Reid, Yogesh Sontakke. =back =end credits =head1 COPYRIGHT NOTICE Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. =head1 TRADEMARK NOTICE Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. =cut