Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiple connections with different NLS_LANG #206

Open
pergr opened this issue Nov 26, 2018 · 0 comments
Open

Multiple connections with different NLS_LANG #206

pergr opened this issue Nov 26, 2018 · 0 comments

Comments

@pergr
Copy link

pergr commented Nov 26, 2018

I frequently need to access two databases with different NLS_LANG (e.g. AL32UTF8 and WE8MSWIN1252) at the same time. Oracle permits multiple environments through OCIEnvNlsCreate. However, with just one global environment pointer in OCI8, oci8_global_envhp, this becomes impossible. I have tried out in a simple setup with two basic connections a solution where the default oci8_global_envhp is created as usual through the dummy_env_method_missing in Init_oci8. Then I have added a nlslang parameter to the OCI8 initialize function and create an environment with the proper NLS_LANG when a new instance of OCI8 is created. A pointer to the environment (envhp) is stored in a new instance variable. Because I do not have a complete overview of all the uses of oci8_global_envhp I have chosen a strategy of setting oci8_global_envhp to the instance envhp each time the connection instance is accessed. When a connection is closed the instance envhp is destroyed and the default oci8_global_envhp is restored. I leave this as a suggestion in case other people have the same need and some of the developers would like to implement a solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant