Hello friends, I have a problem, I already did everything to connect my application to oracle, I can't make it work, I'm sure it works on windows 10 with XAMMP, but I can't make it work on ubuntu 18.04, I already installed OCI8, I already configured everything I found on the internet and I couldn't get it to work
The connection of my database to oracle is this.
$tnsname ='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=ip_del_servidor)(PORT=1521)))
(CONNECT_DATA=(SID=puvidb)(SERVER=DEDICATED)))';
$db['oruvi'] = array(
'dsn' => '',
'hostname' => $tnsname,
'username' => 'my_user',
'password' => 'my_pass',
'database' => 'puvidb',
'dbdriver' => 'oci8',
'dbprefix' => '',
'pconnect' => TRUE,
'db_debug' => (ENVIRONMENT !== 'production'),
'cache_on' => FALSE,
'cachedir' => '',
'char_set' => 'WE8ISO8859P1',
'dbcollat' => 'utf8_general_ci',
'swap_pre' => '',
'encrypt' => FALSE,
'compress' => FALSE,
'stricton' => FALSE,
'failover' => array(),
'save_queries' => TRUE
);
I still have another connection in another file where it takes care of all the insert and update query processes that my application does.
public function __construct()
{
parent::__construct();
echo "<h1>On the constructor</h1><br>";
$this->db_oracle = '(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=ip_del_servidor)(PORT=1521)))
(CONNECT_DATA=(SID=puvidb)(SERVER=DEDICATED)))';
$this->conexion = oci_connect("my_user", "my_password", $this->db_oracle,"AL32UTF8");
if (!$this->conexion) {
$m = oci_error();
trigger_error(htmlentities($m['message']), E_USER_ERROR);
}
}
Keep in mind that the DB and my application are on different servers, both are linux (ubuntu18.04)
The error it gives me is this: Keep in mind that the errors indicated by the lines are because the respective queries could not be made to the DB due to the connection problem.
I already solved it, I hope it doesn't happen to anyone, the error is not in the code when it appears that my code was correct. But there is a detail and it is that my application is on a Linux server (Ubuntu18.04) and the DB is on another Linux server (Ubuntu18.04) that is, they are separated; Now I was trying to connect through the ip = (ip_publica) what happened is that the server, having to use the public ip, could not connect since these two servers are connected locally, the solution to this is to connect through the ip=(private_ip).
Now I recommend that you try Install SQLPLus on your Ubuntu servers so that you can connect to Oracle DB and use this command. sqlplus User/Password_Del_Usuario@Here_goes_the_ip_of_the_BD:1521/Here_goes_EL_SID Example: sqlplus system/password@localhost:1521/orcl It is important that you try all possible IPs if you see that it does not connect to you. End of solution: