Posts PHP Connect to Oracle
Post
Cancel

PHP Connect to Oracle

enable php_pdo_oci.dll in php.ini

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function connect_oracle() {
	//enable ext - php_pdo_oci.dll
	//src - http://stackoverflow.com/a/36639484 -- https://www.devside.net/wamp-server/connect-wamp-server-to-oracle-with-php-php_oci8_11g-dll
	$server         = "127.0.0.1";
	$db_username    = "SYSTEM";
	$db_password    = "Oracle_1";
	$sid            = "ORCL";
	$port           = 1521;
	$dbtns          = "(DESCRIPTION=(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = {$server})(PORT = {$port})))(CONNECT_DATA=(SID={$sid})))";
	$dbh = new PDO("oci:dbname=" . $dbtns . ";charset=utf8", $db_username, $db_password, array(
		PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION,
		PDO::ATTR_EMULATE_PREPARES => false,
		PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC));

	 return $dbh;
}

origin - http://www.pipiscrew.com/?p=6639 php-connect-to-oracle

This post is licensed under CC BY 4.0 by the author.
Contents

Trending Tags