Thanks Mike and David, found out the problem only happens when I call from
RedBack. 

Oracle is running on Unix and I have the connection user name and password
embedded in my Unidata code. Not sure why it doesn't work from RedBack
responder, but got around problem by have a batch file which runs the
routine.

Thanks for your help,

Graham



Graham Forbes
Trading Systems
BT Consulting & Systems Integration


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of HENDERSON MIKE, MR
Sent: 25 January 2005 22:41
To: u2-users@listserver.u2ug.org
Subject: Unclassified RE: [U2] [UV] Run phantom as another user

Graham,

For David's very good idea to work, you must not be using "NT
Authentication" for the ODBC Connection that the BCI is using.  [You did
not say what O/S the Oracle host is running].

If the Oracle host is a Windows box, and the ODBC connection is using NT
Authentication, it will ignore whatever UID & Password you pass in, and
use the credentials of the user issuing the request.
If you are not using NT Authentication, I suggest you should use the
UniBasic encryption / decryption functions to store the password
encrypted on disk, not in plain text in the code of the program
[apologies if 'teaching Grandma to suck eggs'].

Note that you can run a SQL Stored Procedure [via SQLExecuteDirect
rather than SQLExecute], which might enable you to do all you want.


HTH


Mike

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of David Jordan
Sent: Wednesday, 26 January 2005 10:44
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] [UV] Run phantom as another user

You can make an SQL call to a subroutine on a remote server.  You can
set
the SQL Connect statement with a different user name and password.  Bind
the
Parameters for the Subroutine and then Call it.  The code below may give
you
some idea.

Regards

David Jordan


0019:       UID = USERNAME
0020:       PWD = PASSWORD
0021:       SOURCE = "FCSHOST"
0022:       PRINT "Connecting to Computer: ":
0023:       Fn = "SQLConnect"
...
0027:       STATUS = SQLSetConnectOption(CONENV, SQL.OS.UID, UID)
0028:       STATUS = SQLSetConnectOption(CONENV, SQL.OS.PWD, PWD)
0029:       PRINT "Connecting to data source: ": SOURCE
0030:       STATUS = SQLConnect(CONENV,SOURCE,PATHNAME,"")
....
0042:       Fn = "SQLBindParameter"
0043: *status = SQLBindParameter (statement.env, mrk#, data.type,
sql.type,
prec, scale,param [,param.type])
0044:       STATUS =
SQLBindParameter(STMTENV,1,SQL.B.BASIC,SQL.CHAR,0,0,CLIENT.NO,SQL.PARAM.
INPU
T)
0045:       GOSUB CKSTMTENV
......
0055:      STATUS = SQLExecute(STMTENV)
0056:        IF STATUS <> SQL.SUCCESS THEN RETURN 0

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Wednesday, 26 January 2005 5:10 AM
To: u2-users@listserver.u2ug.org
Subject: RE: [U2] [UV] Run phantom as another user

Anyone know how to run a Unidata subroutine as someone else? I cannot
find
the article in u2ug.

Thanks

Graham
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

The information contained in this Internet Email message is intended
for the addressee only and may contain privileged information, but not
necessarily the official views or opinions of the New Zealand Defence Force.
If you are not the intended recipient you must not use, disclose, copy ord
 istribute this message or the information in it.

If you have received this message in error, please Email or telephone
the sender immediately.
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/


********************************************************************

This email may contain information which is privileged or confidential. If you 
are not the intended recipient of this email, please notify the sender 
immediately and delete it without reading, copying, storing, forwarding or 
disclosing its contents to any other person
Thank you

Check us out at http://www.bt.com/consulting

********************************************************************
-------
u2-users mailing list
u2-users@listserver.u2ug.org
To unsubscribe please visit http://listserver.u2ug.org/

Reply via email to