IBM MQ create .binding file
The IBM JMSAdmin tool can be used to create the .binding file that can be used to connect to the IBM MQ Server.
Following are the steps to create the binding file:
- Download and install the IBM MQ or atleast following jar files are required to use the JMSAdmin tool. Basically all of the following needs to be in your CLASSPATH enviornment variable.
C:\Dev\sw\IBM\WebSphere MQ\Java\lib;;C:\Dev\sw\IBM\WebSphere MQ\Java\lib\com.ibm.mqjms.jar;;C:\Dev\sw\IBM\WebSphere MQ\Java\lib\com.ibm.mqjms.jar;C:\Dev\sw\IBM\WebSphere MQ\Java\lib\jms.jar;C:\Dev\sw\IBM\WebSphere MQ\Java\lib\jndi.jar;;C:\Dev\sw\IBM\WebSphere MQ\Java\lib\com.ibm.mq.jar;;C:\Dev\sw\IBM\WebSphere MQ\Java\lib\com.ibm.mqbind.jar;;C:\Dev\sw\IBM\WebSphere MQ\Java\lib\jndi.jar;;C:\Dev\sw\IBM\WebSphere MQ\Java\lib\providerutil.jar;;C:\Dev\sw\IBM\WebSphere MQ\Java\lib\connector.jar;;C:\Dev\sw\IBM\WebSphere MQ\Java\lib\fscontext.jar;;C:\Dev\sw\IBM\WebSphere MQ\Java\lib\ldap.jar;
If you dont have rights to modify the PATH variable set it in command prompt for the current session 🙂
echo %CLASSPATH% set CLASSPATH=%CLASSPATH%;C:\Dev\sw\IBM\WebSphere MQ\Java\lib\providerutil.jar; Following in PATH varaible ;C:\Dev\sw\IBM\WebSphere MQ\Java\lib; C:\Dev\sw\IBM\WebSphere MQ\Java\lib\com.ibm.mqjms.jar;;C:\Dev\sw\IBM\WebSphere MQ\Java\bin
- Create a JMSAdmin.config file and following should be added to it
INITIAL_CONTEXT_FACTORY=com.sun.jndi.fscontext.RefFSContextFactory #Directory where binding is created PROVIDER_URL=file:/C:/Dev/sw/IBM/WebSphere MQ/Java/binding SECURITY_AUTHENTICATION=simple
- Cretae intsetup file and add following contents basically define the IBM MQ connection
def qcf(ivtQCF) qmgr(QMGR) transport(CLIENT) host(192.168.0.1) channel(QMGRChannel) port(2222) DEFINE Q(OUTQ) QUEUE(OUTQ) TC(MQ) end
- Run the admin tool
java com.ibm.mq.jms.admin.JMSAdmin < intsetup.scp
- The binding file is created
- In case you change any configuations always delete the .binding file and run the above command again