So I'm trying to connect to an external db in order to access/update information located on a different non-wordpress database (oracle).
I tried constructing a new wpdb object (as suggested by many other posts on stack exchange) like so:
function initialize_rgr_db() {
global $rgr_db;
$rgr_db = new wpdb('usr', 'pw', 'sid', 'host');
}
However, I kept getting the "error connecting to database" when vardumping the $rgr_db object
debug.log displayed the following:
PHP Warning: mysqli_real_connect(): (HY000/2003): Can't connect to MySQL server on 'host' (111) in /home/dowxx543z3a1/public_html/wp-includes/wp-db.php on line 1612
Alternatively, I tried using oci_connect like so:
$conn = oci_connect('usr', 'pw', '(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(Host=host)(Port=1521)))(CONNECT_DATA=(SID=sid)))');
if(!$conn) {
error_log('DB CONNECTION ERROR NOOO');
die();
}
...
But then I got call to undefined function.
Based on what I found, it seems like oci8 is not installed in wordpress. Online I found instructions on how to install oci8 on things like xampp or local environments, but nothing related to wordpress and frankly I'm afraid to mess something up.
So, here's my question. If someone could tell me what I'm doing wrong with wpdb, I'd love to find out. My guess is maybe that the oracle sid != the dbname that wpdb requires as the third argument.
Otherwise, could someone offer some guidance as to how to install oci8 (through cpanel)?
Thank you so much.
host
in the error log. Also, this might be helpful.