travis-oracle icon indicating copy to clipboard operation
travis-oracle copied to clipboard

Unicode test

Open jayvdb opened this issue 8 years ago • 2 comments

It would be good to include a unicode test

In order to get unicode to work properly with an nvarchar2 using pythons cx_Oracle, I needed to set NLS_LANG=American_America.UTF8. I dont know for sure that it is a cx_Oracle specific problem, but I suspect it may also be a problem for other clients, in which case the documentation should mention this.

Also it would be good to note in the documentation that LD_LIBRARY_PATH may need to be set for some clients to work. (again, this was needed to get it to work with cx_Oracle).

If it is of interest, my successful use of cx_Oracle is at https://github.com/jayvdb/era_data . If it is useful, I'd be happy to create a set of sample cx_Oracle python files for this repo .

jayvdb avatar May 05 '16 12:05 jayvdb

In order to get unicode to work properly with an nvarchar2 using pythons cx_Oracle, I needed to set NLS_LANG=American_America.UTF8. I dont know for sure that it is a cx_Oracle specific problem, but I suspect it may also be a problem for other clients, in which case the documentation should mention this.

This is how OCI works and is mentioned in the docs a few times. It looks like it should be possible to configure a client without setting this environment variable, but that depends on how your particular language binding is implemented. Please check the docs for cx_Oracle.

Also it would be good to note in the documentation that LD_LIBRARY_PATH may need to be set for some clients to work. (again, this was needed to get it to work with cx_Oracle).

Interesting. The Ruby bindings used in the current tests seem to find the libraries without this. OTOH, it looks like that gem searches extensively for shared objects during install. Its docs also have a section about setting this variable.

If it is useful, I'd be happy to create a set of sample cx_Oracle python files for this repo .

I've been considering changing this repo to language: generic and separating out the one Ruby-client test. Maybe it does make sense to have some quick/basic tests for popular clients...

I don't have any experience with Python. Hopefully, it's only a handful of commands to install cx_Oracle and run a few tests? Would you be willing to write tests that connect and fetch some data?

cbandy avatar May 07 '16 06:05 cbandy

re NLS_LANG, yea, cx_oracle currently isnt doing this. https://bitbucket.org/anthony_tuininga/cx_oracle/issues/21

I am going to re-check LD_LIBRARY_PATH; if it is needed, it is because something is wrong with the rpm installation process, as ldconfig should have made it available without needing to set LD_LIBRARY_PATH. Or maybe cx_oracle is doing something a bit strange.

Re Python, we only need to do pip install cx_oracle, and then run some unit tests (happy to write them), preferably using py.test which is pre-installed.

How should be structure the test files for multiple languages . (I dont know much about ruby. ;-) ) Can we have tests/ruby/... and tests/python/... ?

Another language I have a use case for is php, so I can add a client library and tests for that also if you dont mind.

jayvdb avatar May 07 '16 08:05 jayvdb