Setting OS User with Oracle Call Interface (OCI)

2019-08-27 21:32发布

问题:

I'm trying to change the OS User that is passed to Oracle during database connection set up in golang oracle oci-8 driver. This is in a similar way to setting the v$session.osuser in the Java JDBC drivers. I'm trying to modify mattn's go-oci8 oracle driver so I can change the os user value on the fly. I've tried adding conn.attrs.Set("os_user", "test_os_user") in the open method.

I've trawled through the oci docs and I think I might need to set OCI_ATTR_CLIENT_IDENTIFIER but I can work out if this is correct or how to do it. Any ideas if it is possible (and how) to change the osuser value using OCI?

Cheers

回答1:

It appears that it is not possible to set the OS User with the OCI driver. The Oracle documentation for Java highlights that setting the OS User is only possible when the oracle Java Thin driver is used.



标签: oracle go oci oci8