Using PHP to connect Oracle for NT remote databases _php basics
Source: Internet
Author: User
I used to connect remote oracle8.0.5 for NT Enterprise version with PHP, not with Odbc,oracle interface. I'm too desperate! Looking for, and finally found the right way to connect, I use the OCI Interface, ODBC and Oracle or not to find%m epiphyseal? 嶣 5 poured 饩 Margaret 旆 ās Lucky Huan? OCI enough, enough already!
The source code is as follows:
<?php
$dbconn =ocilogon ("ZYPDP", "ZYPDP", "(description= address= (PROTOCOL =tcp) (host=10.65.73.3) (PORT = 1521)) (connect_ DATA = (SID=ORCL)));
if ($dbconn!=false)
{
echo "Connected successfully";
if (Ocilogoff ($dbconn) ==true)
{
echo "Close connection succeeded!"; /=, there's a problem here.
}
}
Else
{
echo "Connection Failed";
}
?>
-----------------Explain------------------------------
-----1. -PHP4 Reference Manual: (Rotten Stuff)
Ocilogon
Open a link with Oracle.
Syntax: int Ocilogon (string username, string password, string [Ocacle_sid]);
return value: Integer
Function Type: Database function
Content Description
This function enables PHP to establish a link with Oracle. Parameter username and password are the connected account number and password respectively. Parameter ocacle_sid is a database name and can be omitted. Returns the code with the connection value.
---2. My explanation:
Username, password Needless to say, I'm going to say ocacle_sid should be called a connection identifier string, "(Description= (address= (PROTOCOL =tcp) (host=10.65.73.3) (PORT = 1521)) (connect_ DATA = (SID=ORCL)) "
Address:oracle Server address Protocol for transport Protocol, generally with TCP; HOST: server IP address; port: port number, default is it.
Connect_data: Here is the name of the database, or Oracle database startup service name, in the "service" can find a specific name, as long as your Oracle is the province to install, it is ocrl.
---3. What are you doing?
(1) Confirm your PHP configuration Oh php_oci8.dll Dynamic Library.
(2) Confirm the installation of the Oracle8i client, or server.
(3) Find the IP of your Oracle server and change it to your IP, with the database name
(4) Don't forget, you need to have access to the remote database username and password
Everything! Go do it!!!
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service