ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » Need an example of connecting Client to server

Post new topic  Reply to topic
 Need an example of connecting Client to server « View previous topic :: View next topic » 
Author Message
PatrickBlais
PostPosted: Wed Apr 07, 2004 10:32 am    Post subject: Need an example of connecting Client to server Reply with quote

Novice

Joined: 07 Apr 2004
Posts: 12
Location: Montreal

I have had the following message :
no mqjbnd05 in java.library.path error on XP

I assume it is related to the fact that I was trying to access a bindings connection outside the server.

OK so now whqt do I do if I want to connect my client on a queue on the server?

Any help will be greatly appreciated.
_________________
Patrick Blais , Expertus Technologies Inc.
Analyste Programmeur
Courriel/Email: patrick.blais@expertus.ca
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jefflowrey
PostPosted: Wed Apr 07, 2004 12:09 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

This is specifically laid out in the Using Java manual.

You need to fill in the correct information in the MQEnvironment to identify how to make a connection to your MQ server.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
vennela
PostPosted: Wed Apr 07, 2004 12:28 pm    Post subject: Reply with quote

Jedi Knight

Joined: 11 Aug 2002
Posts: 4055
Location: Hyderabad, India

Her's a sample
Code:
import com.ibm.mq.*;
public class MQClientPut extends Object {

    /** Creates new MQPut */
    public MQClientPut() {
    }

    /**
     * @param args the command line arguments
     */
    public static void main (String args[]) {

        try {

            String QM1 = "SSPQM";
            String QUEUE1 = "SYSTEM.DEFAULT.LOCAL.QUEUE";

            System.out.println("Starting MQClientPut Program: ");
            MQEnvironment.hostname = "svinjamurlpt";
            MQEnvironment.channel  = "SYSTEM.DEF.SVRCONN";
            MQEnvironment.port     = 1414;
            MQQueueManager qmgr = new MQQueueManager(QM1 ) ;
           
            System.out.println("Connected to QMGR " + QM1);

            int openOptions = MQC.MQOO_OUTPUT;
            MQQueue InQueue = qmgr.accessQueue(QUEUE1 , openOptions, null, null, null);
            MQMessage inMessage = new MQMessage();
            inMessage.writeString("What is your name");
            InQueue.put(inMessage);
            System.out.println("Message Id is :" + inMessage.messageId);
            InQueue.close();
            qmgr.disconnect() ;

        }
        catch(MQException ex){
            System.out.println("MQ Error - Reason code :" + ex.reasonCode);
        }
        catch (Exception e){
            System.out.println("Error : " + e);
        }

    }

}
Back to top
View user's profile Send private message Send e-mail Visit poster's website
PatrickBlais
PostPosted: Thu Apr 08, 2004 4:30 am    Post subject: Client Connection versus Bindings Connection Reply with quote

Novice

Joined: 07 Apr 2004
Posts: 12
Location: Montreal

In the MQ documentation, these two types of connections are described. I think the example you gave me seems to be the bindings connection.

What I would like is the Client connection for a stand alone application where my client resides on the same machine as my server.

But does anyone know which type of connection is best to use for this type of application?

Thanks In advance. I greatly appreciate it.

Patrick
_________________
Patrick Blais , Expertus Technologies Inc.
Analyste Programmeur
Courriel/Email: patrick.blais@expertus.ca
Back to top
View user's profile Send private message Send e-mail Visit poster's website
jefflowrey
PostPosted: Thu Apr 08, 2004 4:39 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

To create a bindings connection, you only need to supply a queue manager name.

To create a client connection (as the code supplied shows), you have to also specify a hostname, channel, and port #.

Quote:
stand alone application where my client resides on the same machine as my server.

If you're running the program on the same machine as the server, you're probably better off using a bindings connection.

Also, the error you're getting - "no mqjbnd05 in java.library.path" - is a classpath or PATH problem.
_________________
I am *not* the model of the modern major general.


Last edited by jefflowrey on Thu Apr 08, 2004 4:59 am; edited 1 time in total
Back to top
View user's profile Send private message
PatrickBlais
PostPosted: Thu Apr 08, 2004 4:51 am    Post subject: jefflowrey, Thanks for your answer. Reply with quote

Novice

Joined: 07 Apr 2004
Posts: 12
Location: Montreal

I understand that it was a classpath issue. It has been resolved but my limited knowledge was pushing my curiosity into getting the whys of a client connection versus bindings and which one one was preferrable.

I have the client connection working now and I think I will be going with the bindings connection since my application resides on the same machine as me MQ server.

Thanks a lot.

I appreciate the professionalism of the members here.

Patrick
_________________
Patrick Blais , Expertus Technologies Inc.
Analyste Programmeur
Courriel/Email: patrick.blais@expertus.ca
Back to top
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Need an example of connecting Client to server
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.