Skip to content

Instantly share code, notes, and snippets.

@maclochlainn
Last active January 9, 2016 05:40
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save maclochlainn/6415857 to your computer and use it in GitHub Desktop.
Save maclochlainn/6415857 to your computer and use it in GitHub Desktop.
PHP Test Connection to an Oracle 12c Pluggable Database (PDB). The user is video, the TNS alias is video, and the service name is videodb. The service name is listed in the tnsnames.ora file as the SID_NAME.
<?php
// Attempt to connect to your database.
$c = @oci_connect("video", "video", "localhost/videodb");
if (!$c) {
print "Sorry! The connection to the database failed. Please try again later.";
die();
}
else {
print "Congrats! You've connected to an Oracle database!";
oci_close($c);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment