At "http://www.php.net/manual/en/function.oci-connect.php"; I
created a comment and screw up the email address. I put in @google.com
instead of @gmail.com. I guess I was thinking "use my google mail
instead of work mail" and then typed google instead of gmail.
    I would really like to edit the comment. I have more information to add.
    The comment has "blake dot lewis at google dot com" as the email.
Comment body is below.
Blake


Using ldap for Oracle name resolution:

  The web server needs the environmental variable TNS_ADMIN='Directory
of tnsname.ora'. I use '/etc/tns_admin'. Confirm using the phpinfo()
function.

  There are three files needed in the TNS_ADMIN location:
tnsnames.ora, sqlnet.ora and ldap.ora. If you are only using ldap,
tnsnames.ora is not needed.

  To sqlnet.ora add:
     NAMES.DIRECTORY_PATH=(TNSNAMES,LDAP)

  To ldap.ora add:
     DIRECTORY_SERVERS=(ldap_fqdn_hostname:1575)
     DEFAULT_ADMIN_CONTEXT=""
     DIRECTORY_SERVER_TYPE=OID

  For a quick and dirty ldap tnsnames server use tnsManager by Dave
Berry. Oracle OID or Openldap can used, but are complicated to setup.
tnsManager is a no brainer. The default port is 1575.

  The order of values in NAMES.DIRECTORY_PATH from sqlnet.ora
determines which look up 'adapter' is used first, in this case it is
tnsnames.ora file and then ldap. I use ldap for general consumption
and tnsnames.ora file to override ldap or entries that are not for
general consumption.

  If you have the full Oracle client you have tnsping. 'tnsping
ORACLE_SID' will tell you what adapter you are using: 'Used LDAP
adapter to resolve the alias'.

<?php
  echo system("/PATH/tnsping ".$ORACLE_SID." 2>&1")."<br />";
  echo 'TNS_ADMIN='.getenv('TNS_ADMIN');
?>

ISSUE:
  For some reason PHP tries the HOSTNAME adapter first, and if the
database name resolves in DNS, it will try connecting using the
database name as the hostname with no SID or SERVICE_NAME defined. All
other Oracle clients I have used will not try the HOSTNAME adapter
unless it is listed in NAMES.DIRECTORY_PATH.
  I have heard that LDAP look up does not work with older instantclients.

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

Reply via email to