Connecting To Oracle Database: Difference between revisions

From Alpine Linux
(Clarify libc issue)
m (Use correct tags for commands)
Line 6: Line 6:


<pre>
<pre>
<source lang="bash">
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 && 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 install -y python3-pip && pip3 install okcli && okcli 'myusername/mypassword@(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(Host=141.62.75.20)(Port=1521))(CONNECT_DATA=(SID=DB1)))'"
</source>
</pre>
</pre>


Line 16: Line 14:


<pre>
<pre>
<source lang="bash">
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)))'
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)))'
</source>
</pre>
</pre>

Revision as of 12:11, 20 October 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 install -y python3-pip && 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)))'