ociplogon

(PHP 3 >= 3.0.8, PHP 4, PHP 5)

ociplogon -- oci_pconnect() 的别名

说明

本函数是该函数的别名:oci_pconnect()


add a note add a note User Contributed Notes
M0no at ethonfusino dot com
22-Nov-2002 02:04
If your oracle database is on a remote system within your local network and you don't want to worry about the tnsnames file you can try this.

$db = "(DESCRIPTION=(ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.XX.XXX)(PORT = 1521)))(CONNECT_DATA=(SID=XXXX)))";

$c1 = ocilogon("name","password",$db);

Hope this helps someone.
kakukkfu at mailbox dot hu
27-Sep-2002 02:09
Better to insert needed variables into apache(!) (or your webserver - respectively) start script.

For example on UNIX systems /etc/init.d/apache would contain following lines before anything else:

#!/bin/bash

if [ -f ~oracle/.profile ]; then
       source ~oracle/.profile
fi

The ~oracle/.profile has the appropiate settings to start an Oracle database so it is always up-to-date for PHP, too. (If settings are changed, don't forget to restart your webserver.) This way you just no need to worry what to include or define for PHP.
e dot v dot wijk at hetnet dot nl
06-Apr-2001 10:26
The solution for not being able to connect to an Oracle database usually is setting the right system variables (ORACLE_HOME, etc...). However, it often happens that you are still not able to connect, even though these settings are correctly set.

If this is the case, try the following:

Instead of refering to the entry in the tnsnames.ora, use the actual string from the tnsnames.ora:

$User = "john"
$Password = "doe"
$Database = "(DESCRIPTION = ADDRESS_LIST (ADDRESS = (PROTOCOL= TCP (Host= yourhost) (Port= 1526)))(CONNECT_DATA = (SID = YourTnsSID )))";

OCIPLogon($User, $Password, $Database)

I hope this is helpfull for those strugling to connect to an Oracle database.

Edwin van Wijk
steve at stevedix dot de
07-Feb-2001 11:17
IF you're wondering exactly what you are dealing with, here's a brief explanation:  Oracle is NOT like mysql, which makes it very easy to connect between databases.  Oracle uses a product called sql*net to control connection between remote machines, clients and databases.  It is capable of operating on multiple different network protocols, and requires listeners to be configured for the network protocol you plan to use (usually tcp). This system has its own domain name system which rationalises database names with machines (which is why you don't have a host variable in the OCIPlogin). Configuring these listeners is not easy and requires the editing of two files tnsnames.ora and sqlnet.ora.  Even more important is to make sure that the oracle environment variable TNS_ADMIN points to the place where you put tnsnames.ora and sqlnet.ora

A good place to start reading about this is

http://www.atr.net/faq/software/FRONT_END/faqnet.htm

A more detailed version can be found at :

http://www.orafaq.net/faqnet.htm

Bear in mind that this is an incredibly complex product and not something that you should really be playing with if you don't know what you're doing.  I've seen (otherwise) experienced oracle admins baulk at configuring sql*net.  Pat solutions (like the one above) cannot be used verbatim - you will need to know and substitute several symbolic names.

HTH
mnamdeo at yahoo dot com
15-Aug-2000 05:48
<b>Connect to multiple oracle databases</b>
<p>Easy solution<br>
If you are using phplib, change local.inc $this->$database = <REMOTE_DATABASE_IN_TNSNAMES.ORA>;
<p>That's it.
michel at diefirma dot de
02-Aug-2000 03:03
After hours of weird searching and "try an error"-games with oracle and php Ive got my working system with connection to a remote oracle server. Yeah! Documentation is very bad for this topic and the posts in all the mailing lists are very confusing. But now...

cheers. it works!

here my working sample code (php4 on debian, oracle 8.1.5.0.2 client, oracle 8i enterprise server on win2k)

michel

<pre>
$user = "scott";
$pass = "tiger";
$tns_name = "my_service_name_in_tnsnames.ora";

// set ORACLE Dir to get the NET8 name resolver working
// tnsnames.ora has to be in $ORACLE_HOME/networking/admin/
putenv("ORACLE_HOME=/home/oracle01/app/oracle/product/8.1.5");

// log on to oracle server using data above
$db_id = OCILogon ($user, $pass, $tns_name);
</pre>