... until the collector arrives ...

This "blog" is really just a scratchpad of mine. There is not much of general interest here. Most of the content is scribbled down "live" as I discover things I want to remember. I rarely go back to correct mistakes in older entries. You have been warned :)


Ant, WebLogic 8.x, JDBC Connection Pools

WebLogic provides an Ant task called wlconfig that can be used to change lots of settings in the WLS configuration.  For example, you can create a JDBC connection pool and data source like this:

    <wlconfig url="t3://localhost:7001" username="weblogic" password="weblogic">

      <query domain="mydomain81" type="Server" name="myserver81" property="server-jmx-name"/>

      <query type="JDBCConnectionPool" name="ZotPool">
        <delete/>  <!-- does nothing if the pool does not exist -->
      <create type="JDBCConnectionPool" name="ZotPool">
        <set attribute="DriverName" value="weblogic.jdbcx.oracle.OracleDataSource"/>
        <set attribute="URL" value="jdbc:bea:oracle://mm1:1521"/>
        <set attribute="Properties" value="serverName=mm1;SID=dev1;portNumber=1521;user=myuserid"/>
        <set attribute="Password" value="mypassword"/>
        <set attribute="ShrinkingEnabled" value="true"/>
        <set attribute="InitialCapacity" value="0"/>
        <set attribute="TestConnectionsOnReserve" value="true"/>
        <set attribute="TestTableName" value="SQL SELECT 1 FROM DUAL"/>
        <set attribute="Targets" value="${server-jmx-name}"/> <!-- must be the last attribute -->

      <query type="JDBCTxDataSource" name="ZotDataSource">
        <delete/>  <!-- does nothing if the data source does not exist -->
      <create type="JDBCTxDataSource" name="ZotDataSource">
        <set attribute="JNDIName" value="ZotDataSource"/>
        <set attribute="PoolName" value="ZotPool"/>
        <set attribute="Targets" value="${server-jmx-name}"/>


Blog Archive