docker-images
docker-images copied to clipboard
oracle/instantclient:19 OCCI no connection
I have a Oracle 19 DB running on a physical server in my environment. My goal is to run an application in a docker container that connects to the DB via Oracle OCCI.
I am using oracle/instantclient:19 and can build my application in this container successfully.
Additionally, it is also possible to connect to the database via sqlplus within the container after specifying the tnsnames.ora
DW = (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = host.docker.internal)(PORT = 1526)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = dw.world) ) )
However, after running my application I cannot connect to the database and get an NLS territory error (ORA-12705: Cannot access NLS data).
Has anyone any experience with OCCI in a container? Is it work?
I am very thankful for any answer since I do not know any solution...
Running in an appropriately configured container shouldn't be a problem.
You'll need to share your Dockerfile and a sample app that shows the problem.
Thanks for the prompt reply.
Here are my steps to build my test container after pulling the image oracle/instantclient:19: ` Run container docker run -d -it -v /d/Temp/mount_dir:/home oracle/instantclient:19
update yum yum update
copy sources to mounted directory
copy tnsnames
install gcc and cmake dnf install cmake gcc-c++ make -y
ensure link of recent occi for linking (Need to do this) cd /usr/lib/oracle/19.18/client64/lib ln -s libocci.so.19.1 libocci.so
build cd /home/sample mkdir build cd build cmake .. make `
My tnsnames you can see in the opening post. It is working, because I can connect to the database.
my sample.cpp in the attachment my CMakeLists.txt in the attachment
One thing to mention here: If I do not manually link to clntsh I get a lot of undefined references error. I found on stackoverflow, that there might be some kind of loop dependencies and I have to manually link it after OCCI, since it is automatically linked also before. This took me several hours to figure out, but anyhow - at least it is compiling without warnings/errors.
Then executing the test_occi executable:
sh-4.4# ./test_occi Opening Database Error: ORA-12705: Cannot access NLS data files or invalid environment specified free(): invalid pointer Aborted
Note, that in our mani application we use the NLS settings AMERICA and it is working. If I simply comment these two lines out and execute I get:
sh-4.4# ./test_occi Opening Database Error: ORA-24960: the attribute OCI_ATTR_USERNAME is greater than the maximum allowable length of 255 free(): invalid pointer Aborted
Thank you for your help!
Can you share the Dockerfile that does the above steps? Can you do a quick check with Instant Client 21c? (The 21c RPMs create the libocci symlink(s)).
@DominikPutz did you solve the problem?
Not in the way I expected. It was with oracle not possible. We are now in the transition phase to postgres and I tried it already with a postgres container and it worked fine for me...
Apps in containers can connect to Oracle DB without a problem. With more information about the specific container configuration we would be able to help.
It's now almost a year but all steps are mentioned above, as well as the docker file and the sample program. As far as I remember I could connect without problems via sqlplus from the container to an oracle db outside. But not with an OCCI application. Error message is above.