Author |
Message
|
PatrickBlais |
Posted: Wed Apr 07, 2004 10:32 am Post subject: Need an example of connecting Client to server |
|
|
 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 |
|
 |
jefflowrey |
Posted: Wed Apr 07, 2004 12:09 pm Post subject: |
|
|
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 |
|
 |
vennela |
Posted: Wed Apr 07, 2004 12:28 pm Post subject: |
|
|
 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 |
|
 |
PatrickBlais |
Posted: Thu Apr 08, 2004 4:30 am Post subject: Client Connection versus Bindings Connection |
|
|
 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 |
|
 |
jefflowrey |
Posted: Thu Apr 08, 2004 4:39 am Post subject: |
|
|
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 |
|
 |
PatrickBlais |
Posted: Thu Apr 08, 2004 4:51 am Post subject: jefflowrey, Thanks for your answer. |
|
|
 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 |
|
 |
|