我确实设置了Apache和PHP,当我尝试通过PDO连接时,我得到了这条消息 我正在使用oracle 10g企业管理。
OCISessionBegin: ORA-12705: Cannot access NLS data files or invalid environment specified (ext\pdo_oci\oci_driver.c:686)
这就是我试图建立oracle连接的方式
$tns = "
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = COD3R-PC)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = opera)
)
)
";
try {
$conn = new PDO("oci:dbname=".$tns, 'customsearch', 'babaji');
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch(PDOException $e) {
echo 'ERROR: ' . $e->getMessage();
}
答案 0 :(得分:0)
putenv("NLS_LANG=.WE8ISO8859P1");
$tns = "
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = COD3R-PC)(PORT = 1521))
)
(CONNECT_DATA =
(SID = I_DONT_KNOW_YOUR_SID)
(SERVER = DEDICATED)
)
)
";
try {
$conn = new PDO("oci:dbname=".$tns, 'customsearch', 'babaji');
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch(PDOException $e) {
echo 'ERROR: ' . $e->getMessage();
}