[英]Php Oracle connection: oci_connect(): ORA-24315: illegal attribute type error
I am trying to connect to Oracle database using php in windows. 我试图在Windows中使用php连接到Oracle数据库。
$db = "BLM = (DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = host)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = blm)
)
)";
$conn = oci_connect('blmuser', 'blmuser', $db);
if (!$conn) {
$e = oci_error();
trigger_error(htmlentities($e['message'], ENT_QUOTES), E_USER_ERROR);
}
I am getting the error oci_connect(): ORA-24315: illegal attribute type
我收到错误oci_connect(): ORA-24315: illegal attribute type
I have tried setting the instant client path but to no avail. 我尝试设置即时客户端路径,但无济于事。
phpinfo() phpinfo()函数
Solved the issue. 解决了问题。 I was trying with only php_oci8_11g.dll enabled in php.ini. 我正在尝试仅在php.ini中启用php_oci8_11g.dll。 Enabled php_oci8.dll extension and everything is working fine. 启用php_oci8.dll扩展名,一切正常。
Just remove the BLM=
as you need to give the description only as connection identifier. 只需删除BLM=
,只需将描述作为连接标识符即可。 The former is needed, when you want to refer the alias name (BLM) as in tnsnames.ora
instead of the full description. 当您要引用tnsnames.ora
的别名而不是完整描述时,则需要前者。
$db = "(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = host)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = blm)
)
)";
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.