Author |
Message
|
jings |
Posted: Thu Jun 07, 2012 4:45 am Post subject: Getting Error 2035 when trying to connect to MQ using VB6.0 |
|
|
Newbie
Joined: 26 Apr 2012 Posts: 4
|
I am trying to connect to MQ using VB 6.0 application as client. But I am getting the error 2035. I don't have access to the MQ Server, but have the related details of server name, channel name port, user name etc.
I am using the MQ client version 7.0 on my machine.
Can anyone help me with the user name configuration in the VB application?
Thanks,
jigna |
|
Back to top |
|
 |
bruce2359 |
Posted: Thu Jun 07, 2012 4:51 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
Does the username have sufficient authority to connect to the qmgr?
Ask the sysadmin at the server exactly to look at the error logs? _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Jun 07, 2012 4:52 am Post subject: Re: Getting Error 2035 when trying to connect to MQ using VB |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
jings wrote: |
Can anyone help me with the user name configuration in the VB application? |
Are you certain that the admin who controls the server has not incorrectly configured the connection against you? It's not common for a client application to be allowed to present a user name to the queue manager (for obvious reasons) but rather for the name to be enforced at a connection level. If this is the case, the user you provide will be irrelevent.
It would help if you mentioned at which point in the WMQ processing you got the 2035, i.e. which operation failed.
Which of the possible client connection methods are you useing? This will affect how you present the credentials (or if you can). Otherwise the user name will be the user name running your application (if the user name running the application is already the correct one, see my comment above re: channel security).
Off topic, but VB6.0? Seriously? In this day and age? Wake up and smell the .NET... _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Jun 07, 2012 5:49 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You can not write code to specify a username for a VB MQ application.
VB MQ applications always use the C APIs under the covers, which always always always always always (and I don't mean sometimes) use the userid that has started the program.
So if you log into your windows box as BOB and run a VB program that says "UserName=Dave", you will always be authenticated to MQ as BOB. And I don't mean sometimes. |
|
Back to top |
|
 |
bruce2359 |
Posted: Thu Jun 07, 2012 9:08 am Post subject: |
|
|
 Poobah
Joined: 05 Jan 2008 Posts: 9469 Location: US: west coast, almost. Otherwise, enroute.
|
mqjeff wrote: |
And I don't mean sometimes. |
So... what's your point? _________________ I like deadlines. I like to wave as they pass by.
ב''ה
Lex Orandi, Lex Credendi, Lex Vivendi. As we Worship, So we Believe, So we Live. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Jun 07, 2012 9:32 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
bruce2359 wrote: |
mqjeff wrote: |
And I don't mean sometimes. |
So... what's your point? |
Well, it's only a theory but I suspect my most worthy associate is attempting to indicate that there are no circumstances in which the presented user id from a VB application is anything other than the user id associated process.
I plan to defer to him on this as in my brief but glorious VB6 career the user id presented was mine (on my local machine against my local queue manager) or the one in the MCAUser (on all other queue managers).
I had this faint memory there was an id in the MQCONNX call that affected this, but research indicates it's not that kind of id...  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Jun 07, 2012 9:47 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Vitor wrote: |
[I plan to defer to him on this as in my brief but glorious VB6 career the user id presented was mine (on my local machine against my local queue manager) or the one in the MCAUser (on all other queue managers). |
The MCAUSER certainly applies, but that's not what the VB App presents to the qmgr, it's what the qmgr overrides what is presented with.
So I guess I was a little unclear. I was referring to the id that the VB app presents, not the ID that is eventually used.
Vitor wrote: |
I had this faint memory there was an id in the MQCONNX call that affected this, but research indicates it's not that kind of id...  |
Well, the MQCONNX userid should in theory apply as well, but I didn't remember that you could reliably call MQCONNX from VB6... maybe I'm wrong there. |
|
Back to top |
|
 |
Vitor |
Posted: Thu Jun 07, 2012 11:20 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mqjeff wrote: |
that's not what the VB App presents to the qmgr, it's what the qmgr overrides what is presented with. |
Quite so.
mqjeff wrote: |
Well, the MQCONNX userid should in theory apply as well, but I didn't remember that you could reliably call MQCONNX from VB6... maybe I'm wrong there. |
I don't think you are.
But if the OP uses VB.NET all these problems go away. Apart from the one where the MCAUser has the wrong authorities.... _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
jings |
Posted: Wed Jun 13, 2012 11:18 pm Post subject: |
|
|
Newbie
Joined: 26 Apr 2012 Posts: 4
|
I am trying to connect using MQCONNXAny call. I tried setting the user id in the UserIdentifier, MCAUserIdentifier attributes of the MQCNOCD structure. But nothing seems to work. I still get the 2035 error. |
|
Back to top |
|
 |
exerk |
Posted: Thu Jun 14, 2012 12:04 am Post subject: |
|
|
 Jedi Council
Joined: 02 Nov 2006 Posts: 6339
|
jings wrote: |
I am trying to connect using MQCONNXAny call. I tried setting the user id in the UserIdentifier, MCAUserIdentifier attributes of the MQCNOCD structure. But nothing seems to work. I still get the 2035 error. |
Ask the Sys Admin or WMQ Admin responsible for the server to trawl the queue manager logs and see if anything is printed in regard to the error. _________________ It's puzzling, I don't think I've ever seen anything quite like this before...and it's hard to soar like an eagle when you're surrounded by turkeys. |
|
Back to top |
|
 |
zpat |
Posted: Thu Jun 14, 2012 1:33 am Post subject: |
|
|
 Jedi Council
Joined: 19 May 2001 Posts: 5866 Location: UK
|
Turn on authorisation event messages (ALTER QMGR)
Try again and see what is in the SYSTEM.ADMIN.QMGR.EVENT queue.
Format the event message with MO71 or MS0P for easier reading.
You won't see much in the QM log unless you have this environment variable set when you started the QM
MQS_REPORT_NOAUTH=TRUE |
|
Back to top |
|
 |
exerk |
Posted: Thu Jun 14, 2012 2:09 am Post subject: |
|
|
 Jedi Council
Joined: 02 Nov 2006 Posts: 6339
|
zpat wrote: |
Turn on authorisation event messages (ALTER QMGR) |
jings wrote: |
...I don't have access to the MQ Server... |
zpat wrote: |
You won't see much in the QM log unless you have this environment variable set when you started the QM
MQS_REPORT_NOAUTH=TRUE |
Depending on platform and WMQ version. _________________ It's puzzling, I don't think I've ever seen anything quite like this before...and it's hard to soar like an eagle when you're surrounded by turkeys. |
|
Back to top |
|
 |
jings |
Posted: Fri Jun 15, 2012 5:51 am Post subject: |
|
|
Newbie
Joined: 26 Apr 2012 Posts: 4
|
I am trying to use the MQCSP structure for setting the User ID and Password. But MQCSP has UserIdPtr attribute which takes MQPTR type value. As per the code given in one document in google, I used StrPtr(string userid) to set the User ID to this field UserIdPtr , but this function returns Long value , and hence I am getting Type mismatch error. Can anybody help me on this ?
Thanks |
|
Back to top |
|
 |
mqjeff |
Posted: Fri Jun 15, 2012 5:54 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
A pointer is a long value.
You're really spending a lot of time writing something the hard way.
You shouldn't be using VB6. You shouldn't be using MQCONNX.
The easy way to do this is to use VB.NET, use the .NET classes instead of the procedural API, and use SSL and an MCAUSER on the appropriate svrconn for authorization.
Then your code is straightforward and maintainable and the security is handled by the administrators rather than a developer. |
|
Back to top |
|
 |
exerk |
Posted: Fri Jun 15, 2012 5:54 am Post subject: |
|
|
 Jedi Council
Joined: 02 Nov 2006 Posts: 6339
|
jings wrote: |
I am trying to use the MQCSP structure for setting the User ID and Password. |
Why? Unless you're using a security exit you achieve nothing by flowing a password.
EDIT: Having just seen mqjeff's post, I concur. _________________ It's puzzling, I don't think I've ever seen anything quite like this before...and it's hard to soar like an eagle when you're surrounded by turkeys. |
|
Back to top |
|
 |
|