Page 1 of 1

Session login with proxy user

Posted: Wed 17 Nov 2010 14:00
by dados
Hi,

I have ODAC 6.9 VCL

I need to login to oracle as a proxy user. Like this: User[XX]

Does ODAC support this?
If so can anyone give me an example code.

Reg,
Arni Thor

Posted: Wed 17 Nov 2010 15:02
by AlexP
Hello,

ODAC allows to connect to Oracle with the Oracle Proxy session.
Please refer to the ProxySession demo project located in ..\Devart\Odac for XXX\Demos\ODAC Demo\ProxySession .

Posted: Wed 17 Nov 2010 17:18
by dados
var
OraSession1,
OraSession2: TOraSession;
begin
Orasession1 := TOraSession.create(self);
Orasession1.Username := 'myuser';
Orasession1.Password := 'mypassword';
Orasession1.Server := 'myhost';
Orasession1.Connect;

OraSession2 := TOraSession.create(self);
OraSession2.Server := OraSession1.Server;
OraSession2.Username := 'more_priv_user';
OraSession2.Connect;
end;

This does not work....

Can you please help me :)

I have a proxy user on my db. and can connect with username like this MYUSER[MASTER] / Password
with Oracle SQL Developer and SQL Nav 6.2

Posted: Fri 19 Nov 2010 08:13
by AlexP
Hello,

Please specify what error you are getting when trying to connect with the proxy user.
I have tested your example and all works correctly.
Please look at the demo project.

Posted: Fri 19 Nov 2010 09:05
by dados
ORA-28179: client user name not provided by proxy

Posted: Fri 19 Nov 2010 10:53
by AlexP
Hello,

Please check that you created proxy users correctly.
For example, you can create a proxy user like this:

CREATE USER PROXY_USER IDENTIFIED BY PROXY;

GRANT CONNECT,RESOURCE TO PROXY_USER;

ALTER USER PROXY_USER GRANT CONNECT THROUGH SCOTT;

Posted: Fri 19 Nov 2010 13:53
by dados
The user was created correctly.

This works now

Orasession1 := TOraSession.create(self);
Orasession1.Username := 'MyUser';
Orasession1.Password := 'MyPassword';
Orasession1.Server := 'MyServer';
Orasession1.Connect;

OraSession2 := TOraSession.create(self);
OraSession2.Server := OraSession1.Server;
OraSession2.ProxySession := OraSession1;
OraSession2.UserName := 'MasterUser';
OraSession2.Connect;

OraSQL := TOraSQL.Create(self);
OraSQL.Session := Orasession2;
OraSQL.SQL.text := 'select * from table';
OraSQL.Execute;

Case closed, thanks :)

Posted: Fri 19 Nov 2010 14:19
by AlexP
Hello,

It is good to see that this problem was solved. If any other questions come up, please contact us.