Creating a Connection Pool using ANT in Weblogic

Hi

Managing weblogic through ANT is very easy and handy sometimes, Few days back I was just trying Connection pool creation using Apache ANT, So wants to share with you all.

Steps 1:
On Windows set the weblogic env using setWLSEnv.cmd(bea/wlseerverx.x/servers/bin), if you dont have Weblogic, Try putting weblogic.jar in the classpath

Step 2

Create a ANT Script.

<target name=”createPool”>
<wlconfig url=”t3://localhost:6001″ username=”weblogic” password=”weblogic”>
<query domain=”admin_domain” type=”Server” name=”AdminServer” property=”AdminServer”/>
<create type=”JDBCConnectionPool” name=”OneSourceConnectionPool”>
<set attribute=”DriverName”    value=”oracle.jdbc.OracleDriver”/>
<set attribute=”InitialCapacity” value=”15″/>
<set attribute=”MaxCapacity” value=”50″/>
<set attribute=”StatementTimeout” value=”600″/> OR Leave it to default -1
<set attribute=”Password” value=”PASSWORD”/>
<set attribute=”Properties” value=”user=USER_NAME”/>
<set attribute=”RefreshMinutes” value=”0″/>
<set attribute=”StatementCacheSize” value=”0″/>
<set attribute=”ShrinkPeriodMinutes” value=”15″/>
<set attribute=”ShrinkingEnabled” value=”true”/>
<set attribute=”TestConnectionsOnRelease” value=”true”/>
<set attribute=”TestConnectionsOnReserve” value=”true”/>
<set attribute=”TestConnectionsOnCreate” value=”true”/>
<set attribute=”TestTableName” value=”SQL SELECT 1 FROM DUAL”/>
<set attribute=”URL” value=”DB_URL”/>
<set attribute=”Targets” value=”${AdminServer}”/>
</create>
</wlconfig>
</target>

After running the ANT Task you will see the following output in the console.

If you want to configure some other types of Connection pool, Do check the MBean associated with that type(if you have weblogic access, see the right side info, and click on<> link,  a new pop up will open and see the MBean name for that type.

Note: Always use t3 protocol instead of HTTP while connecting Weblogic using ANT.


Thanks
R Vashi

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s