Saltar al contenido

~ / archivo / stackoverflow / 46609377

How to get Datasource JDBC Driver Properties with WLST

StackOverflow · jdbc, weblogic, datasource, wlst · pregunté respuesta aceptada
  1. Miguel Ortiz yo pregunta 2017-10-06 15:42

    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):

    [imagen]

    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.

    • Ravi 2017-10-06 16:06 so, you are trying to get username ?
    • Miguel Ortiz yo 2017-10-06 16:28 I'm trying to get all the values in Properties: user, readtimeout and connect_timeout
  2. Miguel Ortiz yo respuesta aceptada 2017-10-06 19:00

    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.

← todos los hilos de StackOverflow