1

I have information about the connection like username, password, host, port, SID and i know that is an oracle database but i don't know how to connect. I am on lubuntu 18.04.

Caius Jard
  • 72,509
  • 5
  • 49
  • 80
  • 2
    [Depends](https://www.connectionstrings.com/oracle/) – GolezTrol Nov 14 '18 at 19:53
  • 1
    Possible duplicate of [Oracle 11g ado connection strings for ODBC (not OLEDB) using excel VBA 64 bit (DSN Less and tnsnames)](https://stackoverflow.com/questions/35340455/oracle-11g-ado-connection-strings-for-odbc-not-oledb-using-excel-vba-64-bit-d) – GolezTrol Nov 14 '18 at 19:54
  • There are many possibilities, here are some examples (however, for Windows .NET): https://stackoverflow.com/questions/34803106/how-to-connect-to-oracle-11-database-from-net/34805999#34805999 – Wernfried Domscheit Nov 14 '18 at 20:53

1 Answers1

2

You can use sqlplus to connect to remote Oracle db server and execute queries. For this purpose, firstly install sqlplus by the information written in https://help.ubuntu.com/community/Oracle%20Instant%20Client page. You will basically execute below commands.

First of all download the .rpm files from here: https://www.oracle.com/technetwork/database/database-technologies/instant-client/overview/index.html

For x64 version

https://www.oracle.com/technetwork/topics/linuxx86-64soft-092277.html

For x86 version

https://www.oracle.com/technetwork/topics/linuxsoft-082809.html

Then install alien to convert .rpm files into .deb package and install the package automatically.

sudo apt update

sudo apt install alien

After downloading into a directory, execute below commands; Currently last version that is available for Linux is 18.3. So for example, rpm files can be as below.

Assuming that you are in your home directory and downloaded files into that location.

sudo alien -i /home/yourusername/oracle-instantclient18.3-basic-18.3.0.0.0-1.x86_64.rpm
sudo alien -i /home/yourusername/oracle-instantclient18.3-sqlplus-18.3.0.0.0-1.x86_64.rpm
sudo alien -i /home/yourusername/oracle-instantclient18.3-devel-18.3.0.0.0-1.x86_64.rpm

(Mostly 3 of them are installed)

Then test your connection as below

sqlplus username/password@//dbhostname:port/SID
sqlplus64 username/password@//dbhostname:port/SID (If you installed sqlplus x64 version)

Also the given above Ubuntu documentation page tells about solutions of problems if you encounter any of them like below part.

If you execute sqlplus and get "sqlplus: command not found", see the section below about adding the ORACLE_HOME variable.

If sqlplus complains of a missing libsqlplus.so file, follow the steps in the section "Integrate Oracle Libraries" below.

If sqlplus complains of a missing libaio.so.1 file, run

sudo apt install libaio1

or, if you're installing the 32 bit instant client on 64 bit,

sudo apt install libaio1:i386

After all these operations, you can also install "rlwrap" and integrate with sqlplus to bring the auto-completion and decent input history.

sudo apt install rlwrap

rlwrap sqlplus username/password@//dbhostname:port/SID

Or you can define an alias.

alias sqlpl='rlwrap sqlplus username/password@//dbhostname:port/SID'

sqlpl

Lastly, don't forget to replace sqlplus with sqlplus64 if you have installed x64 version.

Erdem Savasci
  • 697
  • 5
  • 12