May 12, 2019

Bootstrap your JDBC Data Source XML

Design on the WLS JDBC Data Source XML files.


 


The Story 

Have you ever wondered  how is to see all the JDBC info in 1  table only  that provides a "360°" overview around all the data sources your WLS-FMW domain has ?

Of course you can use the WLS Admin Console to check for such details  but  the details are spread on more tabs and per each data source.

Hello the  jdbc xml files. All the files are in the same 1 single folder: DOMAIN_HOME/config/jdbc.

For this script we will use the same  pattern as we did on the previous script for the config.xml:  Bootstrap your config.xml.

Note: Since we covered all the details in the previous post there is no need to add them here again. The same tools, resources and links were used  for this scrips also.

The first steps

Before  going to run the script we will need to do some extra steps since we now have more xml files  and all of them have some  common details that will raise some issues.

Note: Copy-paste all the DOMAIN_HOME/config/jdbc xml files into a new location.

1. First we need to merge all the jdbc xml files into 1 single big file:

e.g. $ cat *.xml > all_first_jdbc.xml


2. Then we need to remove all the xml header rows (<?xml version='1.0' encoding='UTF-8'?>) from the entire file - no worries we will add it again but this time it will be 1 single row per the entire file:

e.g. $ sed "/<?xml version='1.0' encoding='UTF-8'?>/d" all_first_jdbc.xml > all_jdbc.xml


3. The last step is now to add the xml header row as 1 row only and to define the new root element (jdbc_list) for this file:

<?xml version='1.0' encoding='UTF-8'?>

<jdbc_list>
... [here are all the <jdbc-data-source> elements]
</jdbc_list>


That is all.

Note: Implement the above steps based on your tools and your specific OS.

Since we don't want to end up with a very long table and scroll (even) to much to the right side, the  output file follows the same structure as the JDBC xml file and defines the 5 main sections:

  • jdbc-driver-params
  • jdbc-connection-pool-params
  • jdbc-data-source-params
  • jdbc-xa-params
  • jdbc-oracle-params


Note: If you check the MBeans you will notice the same grouping pattern is used.


The script 

You will find the script as xsl here, on GitHub: wls-jdbc-xml-xsl-Bootstrap.


How to use it

Even if the "import" option could be used - as the previous option #1- we will use only the Saxon tool to generate the HTML. So, yes, we will focus only on the previous option #2.

Now, just run the below: 


java -jar saxon9he.jar -s:all_jdbc.xml -xsl:jdbc_list.xsl -o:all_jdbc.html

 
  • all_jdbc.xml is the source (-s) xml file that covers all the data sources.
  • jdbc_list.xsl is the XSLT template used (-xsl).
  • all_jdbc.html  is the HTML output  (-o).
  • Of course, you can rename your files; but use the same pattern. 



Other details 


First of all the rule is: if a parameter is not in the xml file then it has the default value.  If you want to know the value then you can check the WLS Admin Console for  it or -even better- you can check the specific MBean.

Since the idea was now to highlight  that a default value is in use,  you will see that a pattern like "default parameter_name" is found in the table. This is also to make you aware you need to check for the default value but, more important, is to keep track on the specific parameter and to link the table header with the details found. This is more to confirm that whatever the scripts prints in some cells it is relevant based on the table's header.

Note: The only exception is with the "properties"; here the details are tricky and such no "default parameter_name" message was printed. Still, there is a default value and you should check for it.


The next main idea is that for some of the groups there are no details in some of the data sources xml files.  The main such  groups are the  jdbc-xa-params  and the jdbc-oracle-params. Here we first need to make sure that such details are only covered per the relevant data sources; this is why you will see we first count how many such relevant data sources are found  and only for those  we provide details and  also we add that a "default value" is in use.  For some other data sources such details are not relevant and it could be wrong to say that a default value is in use just because the parameter is not part of the data source xml file.

The script was tested mostly on a 12c WLS domain.




Possible Issues 


Please note that some JDBC files include some passwords with the bellow pattern:

<password-encrypted><password></password-encrypted>

Please change  the "<password>"  value to "****" or other basic string and the script will work.