php pdo oracle

 

 

<?php
/**
* Created by mestars.
* User: mestars
* Date: 6/13/16
* Time: 10:52 PM
*/
header('Access-Control-Allow-Origin: *');
$tns = "
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.182.190.111)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = sd)
)
)
";
try {
$conn = new PDO("oci:dbname=".$tns, 'sd', 'sd');
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch(PDOException $e) {
echo 'ERROR: ' . $e->getMessage();
}
echo '<br>';
foreach(PDO::getAvailableDrivers() as $driver)
echo $driver, '<br>';
?>

posted @ 2017-04-20 17:14  feiyun8616  阅读(183)  评论(0编辑  收藏  举报