Skip to Main Content
  • Questions
  • Pro*C: How to set USERID precompiler option for proxy connection

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Rena.

Asked: September 12, 2017 - 5:44 pm UTC

Last updated: September 15, 2017 - 2:54 am UTC

Version: 11.2.0.4.0

Viewed 1000+ times

You Asked

Hi,

Is there a way to set the Pro*C USERID precompiler option for a proxy connection?

For example, I have an OS authenticated user GEORGE who as been granted "CONNECT THROUGH" to user GEORGE_P and can perform a proxy connect to GEORGE_P in SQL*Plus:

> whoami
george
> sqlplus /
SQL> show user
USER is "GEORGE"
SQL> connect[GEORGE_P]/
Connected.
SQL> show user
USER is "GEORGE_P"

User george also needs to run the Pro*C precompiler against the database objects (tables, etc.) that GEORGE_P owns, but must not know GEORGE_P's password. Is there a way to set the USERID Pro*C precompiler option in order to achieve this?

> whoami
george
> proc INAME=sample1.pc ERRORS=yes USERID=????? SQLCHECK=full

Thank you!

and Connor said...

You just use the same syntax, eg

SQL> alter user scott grant connect through "XPS13\CONNOR";

User altered.


C:\temp>sqlplus [scott]/

SQL*Plus: Release 12.2.0.1.0 Production on Fri Sep 15 10:51:13 2017

Copyright (c) 1982, 2016, Oracle.  All rights reserved.

Last Successful login time: Fri Sep 15 2017 10:11:57 +08:00

Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production


SQL> show user
USER is "SCOTT"
SQL> exit
Disconnected from Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production


C:\temp>touch x.pc

C:\temp>proc userid=[scott]/ sqlcheck=full iname=x.pc oname=x.c

Pro*C/C++: Release 12.2.0.1.0 - Production on Fri Sep 15 10:52:12 2017

Copyright (c) 1982, 2017, Oracle and/or its affiliates.  All rights reserved.

System default option values taken from: C:\oracle\product\12.2.0.1\precomp\admin\pcscfg.cfg


C:\temp>proc userid=[blah]/ sqlcheck=full iname=x.pc oname=x.c

Pro*C/C++: Release 12.2.0.1.0 - Production on Fri Sep 15 10:52:20 2017

Copyright (c) 1982, 2017, Oracle and/or its affiliates.  All rights reserved.

System default option values taken from: C:\oracle\product\12.2.0.1\precomp\admin\pcscfg.cfg

PCC-F-02104, Unable to connect to Oracle



Is this answer out of date? If it is, please let us know via a Comment

More to Explore

Administration

Need more information on Administration? Check out the Administrators guide for the Oracle Database