|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
Extended Stored Procedure C - Error 2058 |
« View previous topic :: View next topic » |
Author |
Message
|
msantos007 |
Posted: Fri Sep 02, 2005 9:25 am Post subject: Extended Stored Procedure C - Error 2058 |
|
|
Voyager
Joined: 20 Dec 2004 Posts: 78
|
My Code
#include <stdafx.h>
#include <stdlib.h>
#include <stdio.h>
#include <cmqc.h>
#ifdef __cplusplus
extern "C" {
#endif
RETCODE __declspec(dllexport) xp_putmsg(SRV_PROC *srvproc);
#ifdef __cplusplus
}
#endif
RETCODE __declspec(dllexport) xp_putmsg(SRV_PROC *srvproc)
{
MQHCONN hConn;
MQLONG CompCode;
MQLONG Reason;
MQCONN("QM1", &hConn, &CompCode, &Reason);
if( CompCode != MQCC_OK )
{
if( (Reason == MQRC_Q_MGR_NOT_AVAILABLE) || (Reason == MQRC_Q_MGR_QUIESCING) || (Reason == MQRC_Q_MGR_STOPPING) )
{
return Reason;
}
return Reason;
}
return XP_NOERROR ;
}
I'am using mqic32.lib
My MQSERVER env variable is set to the right place (amqsputc is working)
Problem:
I get 2058 when i try to execute this extended stored procedure
and I have no new ideas how to solve it _________________ Maximiliano R. A. Santos
IBM Websphere MQ V6.0 Certified System Administrator
IBM Websphere MQ V5.3 Certified Solution Developer |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Sep 02, 2005 9:28 am Post subject: Re: Extended Stored Procedure C - Error 2058 |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
msantos007 wrote: |
and I have no new ideas how to solve it |
No new ideas? What have you tried?
It's not likely a code problem.
I would expect that a
Quote: |
IBM Websphere MQ Certified System Administrator |
would know how to find out what a 2058 is. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
msantos007 |
Posted: Fri Sep 02, 2005 9:36 am Post subject: |
|
|
Voyager
Joined: 20 Dec 2004 Posts: 78
|
2058 means MQRC_Q_MGR_NAME_ERROR
i guess that in my previous post, sounds pretty obivous what i´ve tried _________________ Maximiliano R. A. Santos
IBM Websphere MQ V6.0 Certified System Administrator
IBM Websphere MQ V5.3 Certified Solution Developer |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Sep 02, 2005 9:43 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
I guess all that you said you tried was verifying your MQServer variable.
That was a little hard to see. Putting your code in a code block would have helped.
You confirmed that QM1 is at the place that your MQServer variable points to, and is listening on the correct port?
You confirmed - and I know you said it - that you are linking against mqic32 and not mqm?
You confirmed that the MQSERVER environment variable is in scope when you run this as an "extended stored procedure"? (What database? DB2? Oracle? SQLServer?)? And that it knows to link against the client libs instead of the server libs? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
msantos007 |
Posted: Fri Sep 02, 2005 9:58 am Post subject: |
|
|
Voyager
Joined: 20 Dec 2004 Posts: 78
|
Extendes Stored Procedures are SQL SERVER objects .. ONLY
in my first post
I AM USING MQIC32.LIB ...(client lib)
and another gift....
i wrote the same code as an executable
and guess what... it works! _________________ Maximiliano R. A. Santos
IBM Websphere MQ V6.0 Certified System Administrator
IBM Websphere MQ V5.3 Certified Solution Developer |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Sep 02, 2005 10:00 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
Then I'd say that the enviroment variable is not in scope for the SQLServer. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
msantos007 |
Posted: Fri Sep 02, 2005 12:46 pm Post subject: SOLVED |
|
|
Voyager
Joined: 20 Dec 2004 Posts: 78
|
Thanks jefflowrey
I used the MQCONNX verb now My XP is working fine
The New Code:
RETCODE __declspec(dllexport) xp_putmsg(SRV_PROC *srvproc)
{
MQHCONN hConn; // Handler de Conexão
MQCNO ConOpts = {MQCNO_DEFAULT}; // Connection Options
MQCD ClientDef = {MQCD_CLIENT_CONN_DEFAULT}; // Client Definitions
MQLONG CompCode; // Completion Code
MQLONG Reason; // Reason Code
MQCHAR48 QMgr; // Nome do Queue Manager
MQOD ObjDesc = {MQOD_DEFAULT}; // Object Descriptor
MQMD MsgDesc = {MQMD_DEFAULT}; // Message Descriptor da Mensagem
MQOD ObjDescLog = {MQOD_DEFAULT}; // Object Descriptor
MQMD MsgDescLog = {MQMD_DEFAULT}; // Message Descriptor da Mensagem
MQPMO PutMsgOpts = {MQPMO_DEFAULT}; // Put Message Options
MQHOBJ hObj; // Handler de Objeto
MQHOBJ hObjLog; // Handler de Objeto
// O número de parâmetros deve ser 3
if(srv_rpcparams(srvproc) != 3)
{
return XP_PARAMERROR;
}
// Copa 1o parâmetro como nome da Fila
strcpy(ObjDesc.ObjectName, (char *)srv_paramdata(srvproc, 1));
// Define Nome da Fila de Log
strcpy(ObjDescLog.ObjectName, "QL.LOG");
// Copia 2o parâmetro como nome de Queue Manager
strcpy(QMgr, (char *)srv_paramdata(srvproc, 2));
// Define Estrutura de Conexão Client
ConOpts.Version = MQCNO_VERSION_2;
ConOpts.ClientConnPtr = &ClientDef;
strcpy(ClientDef.ConnectionName, "nb-max(1414)");
strcpy(ClientDef.ChannelName, "CHL.SQL");
// Tenta Conectar ao Queue Manager
MQCONNX(QMgr, &ConOpts, &hConn, &CompCode, &Reason);
if( CompCode != MQCC_OK )
{
return Reason;
}
// Abre Fila de Envio
MQOPEN( hConn, &ObjDesc, MQOO_OUTPUT,&hObj, &CompCode, &Reason);
if( CompCode != MQCC_OK )
{
return Reason;
}
// Abre Fila de Log
MQOPEN( hConn, &ObjDescLog, MQOO_OUTPUT,&hObjLog, &CompCode, &Reason);
if( CompCode != MQCC_OK )
{
return Reason;
}
// Posta Mensagem de Envio
MQPUT(hConn, hObj, &MsgDesc, &PutMsgOpts, srv_paramlen(srvproc, 3), (char *)srv_paramdata(srvproc, 3), &CompCode, &Reason);
if( CompCode != MQCC_OK )
{
return Reason;
}
// Copia Message Id de Postagem no Correlation Id de Log
memcpy(MsgDescLog.CorrelId, MsgDesc.MsgId, sizeof(MsgDesc.MsgId));
// Posta Mensagem de Log
MQPUT(hConn, hObjLog, &MsgDescLog, &PutMsgOpts, srv_paramlen(srvproc, 3), (char *)srv_paramdata(srvproc, 3), &CompCode, &Reason);
if( CompCode != MQCC_OK )
{
return Reason;
}
MQCLOSE(hConn, &hObj, MQCO_NONE, &CompCode, &Reason);
MQCLOSE(hConn, &hObjLog, MQCO_NONE, &CompCode, &Reason);
MQDISC(&hConn, &CompCode, &Reason);
return XP_NOERROR ;
} _________________ Maximiliano R. A. Santos
IBM Websphere MQ V6.0 Certified System Administrator
IBM Websphere MQ V5.3 Certified Solution Developer |
|
Back to top |
|
 |
hopsala |
Posted: Fri Sep 02, 2005 1:42 pm Post subject: |
|
|
 Guardian
Joined: 24 Sep 2004 Posts: 960
|
msantos007 wrote: |
strcpy(ClientDef.ConnectionName, "nb-max(1414)");
strcpy(ClientDef.ChannelName, "CHL.SQL");
// Tenta Conectar ao Queue Manager
MQCONNX(QMgr, &ConOpts, &hConn, &CompCode, &Reason);
if( CompCode != MQCC_OK ) |
You do realise this is merely patchwork, and is not quite what one calls a "robust" solution... If you are unwilling to set the environment variable on the SQLServer, or work with a channel table, at Least put these in a parameters file!
I remember, my mama said: do not hardcode! (from an old MQAdmin gospel) |
|
Back to top |
|
 |
csmith28 |
Posted: Fri Sep 02, 2005 2:56 pm Post subject: |
|
|
 Grand Master
Joined: 15 Jul 2003 Posts: 1196 Location: Arizona
|
hopsala wrote: |
msantos007 wrote: |
strcpy(ClientDef.ConnectionName, "nb-max(1414)");
strcpy(ClientDef.ChannelName, "CHL.SQL");
// Tenta Conectar ao Queue Manager
MQCONNX(QMgr, &ConOpts, &hConn, &CompCode, &Reason);
if( CompCode != MQCC_OK ) |
You do realise this is merely patchwork, and is not quite what one calls a "robust" solution... If you are unwilling to set the environment variable on the SQLServer, or work with a channel table, at Least put these in a parameters file!
I remember, my mama said: do not hardcode! (from an old MQAdmin gospel) |
Hush now hopsala, didn't you see he's "CERTIFIED". Apparently you don't know the power of certification........
I find your lack of faith disturbing. _________________ Yes, I am an agent of Satan but my duties are largely ceremonial. |
|
Back to top |
|
 |
hopsala |
Posted: Fri Sep 02, 2005 3:08 pm Post subject: |
|
|
 Guardian
Joined: 24 Sep 2004 Posts: 960
|
csmith28 wrote: |
Hush now hopsala, didn't you see he's "CERTIFIED". Apparently you don't know the power of certification........ |
Poor un-certified me, walking about with only real-world experience in my pocket in the cruel cruel MQ world
Noted, the combo
csmith28 wrote: |
I find your lack of faith disturbing.
_________________
Yes, I am an agent of Satan but my duties are largely ceremonial. |
Is extremely amusing, and if I may add - somewhat disturbing  |
|
Back to top |
|
 |
fjb_saper |
Posted: Fri Sep 02, 2005 6:23 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
hopsala wrote: |
csmith28 wrote: |
Hush now hopsala, didn't you see he's "CERTIFIED". Apparently you don't know the power of certification........ |
Poor un-certified me, walking about with only real-world experience in my pocket in the cruel cruel MQ world
Noted, the combo
csmith28 wrote: |
I find your lack of faith disturbing.
_________________
Yes, I am an agent of Satan but my duties are largely ceremonial. |
Is extremely amusing, and if I may add - somewhat disturbing  |
Slow down guys... He is certified for MQ Admin.... not for MQ Solution Engineer. So give him a little slack. He is stumbling in programer shoes trying to fix a problems he is being made responsible for where he has little to no control over. Patchwork to get out of hell's kitchen when it wasn't his fault in the first place....
Sorry didn't mean to get worked up...  |
|
Back to top |
|
 |
hopsala |
Posted: Fri Sep 02, 2005 6:49 pm Post subject: |
|
|
 Guardian
Joined: 24 Sep 2004 Posts: 960
|
Sorry if it seemed I was making fun of him or anyone - I was just playing along; I send formal apologies to anyone who was potentially hurt, with hopes to restore the peace.
I cannot seem to find a :apologetic: emoticon so i'll settle for an innocent  |
|
Back to top |
|
 |
csmith28 |
Posted: Fri Sep 02, 2005 8:10 pm Post subject: |
|
|
 Grand Master
Joined: 15 Jul 2003 Posts: 1196 Location: Arizona
|
fjb_saper wrote: |
hopsala wrote: |
csmith28 wrote: |
Hush now hopsala, didn't you see he's "CERTIFIED". Apparently you don't know the power of certification........ |
Poor un-certified me, walking about with only real-world experience in my pocket in the cruel cruel MQ world
Noted, the combo
csmith28 wrote: |
I find your lack of faith disturbing.
_________________
Yes, I am an agent of Satan but my duties are largely ceremonial. |
Is extremely amusing, and if I may add - somewhat disturbing  |
Slow down guys... He is certified for MQ Admin.... not for MQ Solution Engineer. So give him a little slack. He is stumbling in programer shoes trying to fix a problems he is being made responsible for where he has little to no control over. Patchwork to get out of hell's kitchen when it wasn't his fault in the first place....
Sorry didn't mean to get worked up...  |
Well if he is a WMQ admin then he should know when to hand a problem of this nature off.
If the MQManager is up, the listener is running then MQ is not his problem.
I've lost count of how many times an application developer has told me that that my MQManager is not responding or down because he's to stupid to do his/her job.
@msantos007 if this is the case, direct said developer to the WMQ Application Programmers Guide or the plethora of other documentation that exists.
You know there just comes a time when as an MQAdmin you just have to say, the MQManager is up, the listener is running. If the Application is local there is nothing preventing the application from connecting. If it is a Client application well, and the appropriate SVRCONN channel has been created and your Queue's have been created.
The plumming is there now you make it work.
If you want to pay for me to attend an IBM WMQ Application Programming Class then I'll be happy to do my best to help after the class. If not hire a someone who has some or even any experience at WMQ Application Programming and have them figure it out.
The MQManager is running and listening if you can't connect, as an WMQ Admin this is not my problem. _________________ Yes, I am an agent of Satan but my duties are largely ceremonial. |
|
Back to top |
|
 |
jefflowrey |
Posted: Sat Sep 03, 2005 10:42 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
It'd really be a lot easier to just make sure that MQSERVER was set as a System environment variable, and then restart the whole machine, so that it would be in scope when the SQLServer started up, and went to run the stored procedure. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
msantos007 |
Posted: Tue Sep 06, 2005 2:58 am Post subject: |
|
|
Voyager
Joined: 20 Dec 2004 Posts: 78
|
PEOPLE YOU GUYS AMAZE ME... OF COURSE THIS IS JUST AN EXAMPLE, I'M USING IT IN MY BOX FOR TESTS, IT WILL RECEIEVE THESE AS PARAMETERS, I'M USING THESE PARAMS HARDCODED BECAUSE THE DEVELOPMENT MQ SERVER IS ON MY BOX AND THE SQL SERVER ON ANOTHER BOX  _________________ Maximiliano R. A. Santos
IBM Websphere MQ V6.0 Certified System Administrator
IBM Websphere MQ V5.3 Certified Solution Developer |
|
Back to top |
|
 |
|
|
 |
Goto page 1, 2 Next |
Page 1 of 2 |
|
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
|
|
|
|