Java开发网 Java开发网
注册 | 登录 | 帮助 | 搜索 | 排行榜 | 发帖统计  

您没有登录

» Java开发网 » Java EE 综合讨论区  

按打印兼容模式打印这个话题 打印话题    把这个话题寄给朋友 寄给朋友    该主题的所有更新都将Email到你的邮箱 订阅主题
flat modethreaded modego to previous topicgo to next topicgo to back
作者 Re:谁能提供mq传输文件的方法 [Re:fastray]
microwin





发贴: 18
积分: 10
于 2003-10-27 15:03 user profilesend a private message to usersearch all posts byselect and copy to clipboard. 
ie only, sorry for netscape users:-)add this post to my favorite list
/**
* <p>Title: MQ实例测试程序!</p>
* @author Microwin
* @version 1.0
*/
import com.ibm.mq.*;

public class ConnMQ4 {

private String qManager_name = "QM_P2P_XXXXX";
private String qQueue_name = "Q1";
private MQQueueManager mqQueueManager;
private MQQueue mqQueue;

public ConnMQ4() {
MQEnvironment.properties.put(MQC.TRANSPORT_PROPERTY,MQC.TRANSPORT_MQSERIES);
MQEnvironment.CCSID=1381;
}

public void conn(){
try {
   mqQueueManager =new MQQueueManager(qManager_name);
   System.out.println("成功连接QueueManager");
   //----------------------------------------
   int openOptions = MQC.MQOO_INPUT_AS_Q_DEF|MQC.MQOO_OUTPUT;
   mqQueue = mqQueueManager.accessQueue(qQueue_name,openOptions);
   MQPutMessageOptions mpmo = new MQPutMessageOptions();
   MQMessage mqMessage = new MQMessage();
   mqMessage.writeInt(25);
   mqMessage.writeString("good");
   mqQueue.put(mqMessage,mpmo);
}
catch (MQException ex) {
   System.out.println("Error Code : " + ex.reasonCode);
   ex.printStackTrace();
}
catch(java.io.IOException ex){
   ex.printStackTrace();
}
finally {
   try {
   if(mqQueue!=null){
     mqQueue.close();
     System.out.println("成功关闭Queue");
    }
    if(mqQueueManager!=null){
     mqQueueManager.close();
     mqQueueManager.disconnect();
     System.out.println("成功关闭、断开QueueManager");
    }
   }
   catch (MQException ex) {

   }//end try-catch

}//end try-catch

}

public static void main(String[] args) {
ConnMQ4 connMQ41 = new ConnMQ4();
connMQ41.conn();
}
}




话题树型展开
人气 标题 作者 字数 发贴时间
6576 谁能提供mq传输文件的方法 fastray 42 2003-08-26 08:42
5230 Re:谁能提供mq传输文件的方法 wishmaster 50 2003-09-09 17:22
6096 Re:谁能提供mq传输文件的方法 microwin 1636 2003-10-27 15:03

flat modethreaded modego to previous topicgo to next topicgo to back
  已读帖子
  新的帖子
  被删除的帖子
Jump to the top of page

   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923