> Which are the environment variables? (i.e. ORACLE_SID, ORACLE_HOME, etc)
>I've using this kind of code, but it doesn't connect me to the server.
>putenv("ORACLE_HOME=C:\Program Files\Ora81"); <-- Is this the home
directory?
> putenv("ORACLE_SID=SID");

Look in the windows registry to find what to put here.
oracle_home is the path to the oracle home directory (your oracle client)
oracle_sid is something like ORCL for example.


> $connection = ora_logon ("user", "pass") or die("No Connection");
Ora_logon and other ora* functions com from the "oracle" extension
(php_oracle.dll). You would rather use ocilogon and friends, from the newer
php_oci.dll. Just uncomment php_oci.dll in your php.ini to use them. The
oci* functions can be used against a Oracle7 or an Oracle8 database. ora$
functions are limited to Oracle 7.
So you would rather use :
$connection = OCILogon($user, $pass, $tns) or die("No Connection");
About the third argument ($tns), it is what you find in the tnsnames.ora
file, located in [your_oracle_directory]/Network/Admin.
For example, if your tnsnames.ora looks like this :
sa_tcp32.world =
  (DESCRIPTION =
    (ADDRESS_LIST =
        (ADDRESS =
          (COMMUNITY = tcp.world)
          (PROTOCOL = TCP)
          (Host = 21.1.1.45)
          (Port = 1521)
        )
        (ADDRESS =
          (COMMUNITY = tcp.world)
          (PROTOCOL = TCP)
          (Host = 21.1.1.45)
          (Port = 1526)
        )
    )
    (CONNECT_DATA = (SID = ORCL)
    )
  )

... then your $tns argument will be "sa_tcp32".

If you don't set several variables with putenv, you may encounter some
problems with this third argument. Then you can replace its name by its
entire definition.

Hope it will help you !

Regards,
Philippe




-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to