Search code examples
jdbcweblogicdatasourcewlst

How to get Datasource JDBC Driver Properties with WLST


I have a problem getting some properties of the JDBC Driver of a Datasource in a weblogic server using WLST.

Altough I can get many properties of the DS like this:

allJDBCResources = cmo.getJDBCSystemResources()
    for jdbcResource in allJDBCResources:
            dsname = jdbcResource.getName()
            dsResource = jdbcResource.getJDBCResource()
            dsJNDIname = dsResource.getJDBCDataSourceParams().getJNDINames()[0]
            dsInitialCap = dsResource.getJDBCResource().getJDBCConnectionPoolParams().getInitialCapacity()

I'm still unable to retrieve the values from this (image for better understanding of the problem):

enter image description here

I'm able to get the driver class name but not the propierties in that field. I need to retrieve through WLST:

  • user
  • readtimeout
  • connect_timeout

I've seen lots of pages through google but only to "set" the properties not a way to get that values.

Any help is appreciated.


Solution

  • Well, I achieved what I needed in this way:

         try :
                        user = ls("/JDBCSystemResources/"+ dsname +"/Resource/" + dsname + "/JDBCDriverParams/" + dsname + "/Properties/" + dsname + "/Properties/user")
                        readTimeOut = ls("/JDBCSystemResources/"+ dsname +"/Resource/" + dsname + "/JDBCDriverParams/" + dsname + "/Properties/" + dsname + "/Properties/oracle.jdbc.ReadTimeout")
                        conTimeOut = ls("/JDBCSystemResources/"+ dsname +"/Resource/" + dsname + "/JDBCDriverParams/" + dsname + "/Properties/" + dsname + "/Properties/oracle.net.CONNECT_TIMEOUT")
                        streamAsBlob = ls("/JDBCSystemResources/"+ dsname +"/Resource/" + dsname + "/JDBCDriverParams/" + dsname + "/Properties/" + dsname + "/Properties/SendStreamAsBlob")
         except WLSTException:
                        pass
    

    And after that I had the information I needed, just in an horrible string but I'll parse it with python.