Home >Backend Development >PHP Tutorial >A brief discussion on the connection settings between PHP4.0 and oracle 8 under Windows_PHP Tutorial

A brief discussion on the connection settings between PHP4.0 and oracle 8 under Windows_PHP Tutorial

WBOY
WBOYOriginal
2016-07-21 16:10:441412browse


It is very easy for PHP to connect to oracle8 under Linux/Unix, but it is really not easy under the windows platform. I have found a reliable method after a long period of exploration, and I dare not keep it to myself.
I will publish it now for everyone. The development environment I use: windows 98 second edition php4.04pl1 apache 1.3.14 window version oracle 8.05 client After PHP is installed in CGI mode and tested successfully. Test with the following code
$conn = OCILogon("cinmsiii","cinmsiii","(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.3.202)(PORT = 1521 ))(CONNECT_DATA = (SID = unicom)))");
//$conn=OCILogon("cinmsiii","cinmsiii","cinms"); If the oracle client is 8.1.6i, you can use it like this , the parameters are as shown above if($conn!=false)
{
echo "ok";
OCILogoff($conn);
}
else
echo "false";
?> ; Regarding the connection parameter issue:
The connection string is set to the following:
(DESCRIPTION =(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.3.202)(PORT = 1521))(CONNECT_DATA = (SID = unicom)) ) PROTOCOL: the network protocol used HOST: is the host name of the database server SID: is the instance number of the database There are usually no problems after doing this. If your Oracle 8 client is 8.1.6i Enterprise Edition, you can set these parameters in the connection string and use Oracle8's net easy config utility to set them.
Pass in the set connection string name as the connection string. It is speculated that Oracle 7.x can also use this method. Since there is no environment, it has not been tested. If you are interested, you can try it. (Source: Viphot)

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/314164.htmlTechArticleIt is very easy for PHP to connect to oracle8 under Linux/Unix, but it is really not easy under the windows platform. I have experienced it It took a long time of exploration to find a reliable method. I don’t dare to keep it to myself, so I am publishing it now for everyone’s enjoyment. ...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn