Connecting To Oracle Database: Difference between revisions

From Alpine Linux
m (Also add a note on util-linux requirement)
m (Also add Vim to allow for `ed` editing mode)
Line 6: Line 6:


<pre>
<pre>
docker run -it -e LC_CTYPE=en_US.UTF-8 store/oracle/database-instantclient:12.2.0.1 sh -c "yum install -y python3-pip util-linux && pip3 install okcli && okcli 'myusername/mypassword@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=141.62.75.20)(Port=1521))(CONNECT_DATA=(SID=DB1)))'"
docker run -it -e LC_CTYPE=en_US.UTF-8 store/oracle/database-instantclient:12.2.0.1 sh -c "yum update -y && yum install -y python3-pip util-linux vim && pip3 install okcli && okcli 'myusername/mypassword@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=141.62.75.20)(Port=1521))(CONNECT_DATA=(SID=DB1)))'"
</pre>
</pre>



Revision as of 09:30, 3 November 2020

Connecting to a Oracle database directly does not seem to be possible due to the driver being compiled for GNU libc and it being proprietary. It is possible to connect to a database using Docker however. The image is proprietary as well, so a docker login is required and the "Proceed to Checkout" on https://hub.docker.com/_/oracle-instant-client has to be went through.

Connecting with okli

okcli is a libre CLI to access a Oracle database. You can connect using it with the following command:

docker run -it -e LC_CTYPE=en_US.UTF-8 store/oracle/database-instantclient:12.2.0.1 sh -c "yum update -y && yum install -y python3-pip util-linux vim && pip3 install okcli && okcli 'myusername/mypassword@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=141.62.75.20)(Port=1521))(CONNECT_DATA=(SID=DB1)))'"

Connecting with SQL Plus

SQL Plus is the proprietary CLI to access a Oracle database. You can connect using it with the following command:

docker run -it -e LC_CTYPE=en_US.UTF-8 store/oracle/database-instantclient:12.2.0.1 sqlplus 'myusername/mypassword@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=141.62.75.20)(Port=1521))(CONNECT_DATA=(SID=DB1)))'