Your programming language is obviously PHP, so it has nothing to do with Java, JDK, JDBC or whatsoever.
I am going to summarize two sources, because IMHO they are good enough so that it is not necessary to replicate everything here.
For PHP, the easiest way to go is to use Oracle Instant Client and PHP Database Object (PDO).
Summary from the Ubuntu Wiki:
Install the following packages, which are available als RPM packages on Oracle's website:
oracle-instantclient-basiclite
oracle-instantclient-devel
oracle-instantclient-sqlplus
Next, install PHP OCI8: See here, beginning from step 7. To summarize: The core command to be issued is to install it via PHP PECL:
pecl install oci8 # PHP 8
pecl install oci8-2.2.0 # PHP 7.x
Last but not least, make sure that the php.ini
(depending on if you are using PHP-CLI or PHP-FPM it may be /etc/php/VERSION/php-cli
or /etc/php/VERSION/php-fpm
, where VERSION
may be something like 7.4
or 8.0
) loads the OCI driver:
extension=oci8
extension=pdo_oci
That should be everything. If there are any other troubles, please refer to the Ubuntu Wiki I linked above. For me, these steps were enough.
$dbconn = new PDO('oci:dbname=MY_CONNENCTION', 'username', 'pa55w0rd');
MY_CONNECTION
can be either the name as provided in the file tnsnames.org
, or the entire long connection string which is provided on the right hand side of the equals (=
) sign in the file tnsnames.ora
, usually beginning with (DESCRIPTION=
or (DESCRIPTION_LIST=
.