Hi all,

I need to put some messages into MQ Queue using DB2 Java Stored Procedure. I wrote the following code. But it is not putting them in MQ. Please advise.

/**
* JDBC Stored Procedure James.PROCEDURE1
*/

import java.sql.*; // JDBC classes
import com.ibm.mq.*; // Include the WebSphere MQ classes for Java package
import java.util.Hashtable;

public class PROCEDURE1 {

private static String qManager = "ITSOTestQM"; // define name of queue

// manager to connect to.
private static MQQueueManager qMgr; // define a queue manager

public static void pROCEDURE1(ResultSet[] rs1)
throws SQLException, Exception {

// Get connection to the database
Connection con = DriverManager.getConnection("jdbc:default:connecti on");
PreparedStatement stmt = null;
boolean bFlag;
String sql;

Hashtable properties;
String transport = "MQSeries";
String host = "9.182.88.173";
String channel = "java.channel";
String port = "1420";

properties = new Hashtable();
properties.put("hostname", host);
properties.put("transport", transport);
properties.put("channel", channel);
properties.put("port", new Integer(Integer.parseInt(port)));

qMgr = new MQQueueManager(qManager);

MQQueue queue = qMgr.accessQueue("ITSOTestQ", 17);

MQMessage mqmessage = new MQMessage();
mqmessage.characterSet = 1208;

mqmessage.writeUTF("Hello World!");

queue.put(mqmessage, new MQPutMessageOptions());

sql = "SELECT PROCSCHEMA, PROCNAME FROM SYSCAT.PROCEDURES";
stmt = con.prepareStatement(sql);
bFlag = stmt.execute();

rs1[0] = stmt.getResultSet();
}
}

Please advise. I added com.ibm.mq.jar, connector.jar and jta.jar in the classpath of the Stored Procedure. Do I need to any dlls into its path??

Please advise.

Thanks and Regards,
James