Details:

Apache/1.3.33 (Win32) PHP/5.0.2
Windows XP Pro Service Pack 1
Oracle 9i (located remotely on Sun Solaris)

Errors:

Warning: ocilogon() [function.ocilogon]: OCISessionBegin: ORA-12705: invalid or unknown NLS parameter value specified in c:\program files\apache group\Apache\htdocs\eng\class\class.oci8hook.php on line 154

Warning: ocilogon() [function.ocilogon]: _oci_open_server: ORA-12560: TNS:protocol adapter error in c:\program files\apache group\Apache\htdocs\eng\class\class.oci8hook.php on line 154
Unable to connect to database

Question:

How do I set-up the NLS parameters on Windows XP to see a remoted Oracle 9i database?

Summary:

I do have Oracle client loaded on my Windows XP workstation, plus when I run phpinfo() on my local workstation, I do have Oracle support enhabled:

oci8:

OCI8 Support: enabled
Revision: $Revision: 1.257 $
Active Persistent Links: 0
Active Links: -6
Temporary Lob support: enabled
Collections support: enabled

Oracle:

Oracle Support: enabled

Any suggestions or help would be greatly appreciated. Thank you for reading this post.

    You need to set the NLS_LANG environment variable to a valid value ... examples:

    AMERICAN_AMERICA.WE8ISO8859P1
    or
    GERMAN_GERMANY.WE8ISO8859P1

    That should match the character set of the database instance you want to access.

    EDIT: Alternatively, use putenv in the PHP script prior to any oci/oracle function call to set up the environment variables.

    Most important environment variables (with examples):

    ORACLE_BASE=/u01
    ORACLE_HOME=/u01/OraHome1
    NLS_LANG=GERMAN_GERMANY.WE8ISO8859P15
    ORA_NLS33=/u01/OraHome1/ocommon/nls/admin/data

    ORA_NLS33 is very important because the client might have problems finding the language data without that variable.

    You can set the default sid with e.g.
    ORACLE_SID=orcl

    Thomas

      Thank you tsinka.

      I really apologize for the next question...

      Since my Apache 1.3.33 and PHP 5.0.2 set-up is running on a Windows XP development workstation and the Oracle 9i server is on Sun Solaris; where exactly do I set-up these environment variables?

      Thus, from what I understand from your response, I could do the following:

      putenv("NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1");
      

      From that point I could set rest of the recommmended environment variables...

      Thanks again.

        Ok,

        how does the script look like so far ?
        Where's Oracle installed and what's the name of the service you want to connect to ?

        Thomas

          My environment variables are as follows:
          [FONT=courier new]
          ORACLE_BASE=/opt/app/oracle
          ORACLE_HOME=/opt/app/oracle/product/8.1.7
          NLS_LANG=NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1
          ORA_NLS33=/opt/app/oracle/product/8.1.7/ocommon/nls/admin/data
          [/FONT]
          The name of the service is:

          [FONT=courier new]ORACLE_SID=inettest[/FONT]

          So I am assuming I could do the following:

          putenv("ORACLE_BASE=/opt/app/oracle");
          putenv("ORACLE_HOME=/opt/app/oracle/product/8.1.7");
          putenv("NLS_LANG=NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1");
          putenv("ORA_NLS33=/opt/app/oracle/product/8.1.7/ocommon/nls/admin/data");
          

          Thank you for your help with this!

            Ok,

            just to understand:

            Web Server: Windows XP (Oracle client installed)
            Oracle: Sun

            You need to set the environment variables on the Windows server to the installation folder(s) of the Oracle client (not the directories on the Sun server)

            Thomas

              That is correct.

              As I understand, I need to set-up my Windows System ENV Variables for Oracle Client.

              What are the System ENV Variables?

              I will google that, in the meantime, do you have any suggestions for me?

              Thank you for your help.

                Didn't it work with putenv ?

                Example

                putenv("ORACLE_BASE=C:\oracle");

                Thomas

                  My Oracle base directory is:

                  [FONT=courier new]ORACLE_BASE=C:\oracle\ora90[/FONT]

                  From that point, the directory looks like:

                   Directory of C:\oracle\ora90
                  
                  .                              <DIR>      2003-10-24  14:12
                  ..                             <DIR>      2003-10-24  14:12
                  Apache                         <DIR>      2003-10-24  14:07
                  assistants                     <DIR>      2003-10-24  14:12
                  bin                            <DIR>      2004-08-16  17:58
                  classes                        <DIR>      2003-10-24  14:09
                  doc                            <DIR>      2004-07-30  10:09
                  ds                             <DIR>      2003-10-24  14:02
                  install                        <DIR>      2003-10-24  14:00
                  install.platform                       22 2003-10-24  13:57
                  jar                            <DIR>      2003-10-24  14:12
                  javavm                         <DIR>      2003-10-24  14:09
                  jdbc                           <DIR>      2003-10-24  13:59
                  jis                            <DIR>      2003-10-24  14:01
                  jlib                           <DIR>      2003-10-24  14:09
                  ldap                           <DIR>      2003-10-24  14:02
                  lib                            <DIR>      2003-10-24  14:09
                  Mshelp                         <DIR>      2003-10-24  14:12
                  network                        <DIR>      2003-10-24  14:09
                  oci                            <DIR>      2003-10-24  14:12
                  ocommon                        <DIR>      2003-10-24  14:00
                  ODBC                           <DIR>      2003-10-24  14:09
                  olap                           <DIR>      2003-10-24  14:07
                  oledb                          <DIR>      2003-10-24  14:12
                  oo4o                           <DIR>      2003-10-24  14:12
                  oracore                        <DIR>      2003-10-24  14:00
                  ORAINST                        <DIR>      2004-07-30  10:09
                  ord                            <DIR>      2003-10-24  14:03
                  otrace                         <DIR>      2003-10-24  14:03
                  owm                            <DIR>      2003-10-24  14:01
                  plsql                          <DIR>      2003-10-24  14:03
                  precomp                        <DIR>      2003-10-24  14:12
                  rdbms                          <DIR>      2003-10-24  14:03
                  relnotes                       <DIR>      2003-10-24  14:12
                  slax                           <DIR>      2003-10-24  14:00
                  sqlj                           <DIR>      2003-10-24  14:01
                  sqlplus                        <DIR>      2003-10-24  14:01
                  syndication                    <DIR>      2003-10-24  14:03
                  sysman                         <DIR>      2003-10-24  14:12
                  xdk                            <DIR>      2003-10-24  14:09
                  
                  

                  Since this is the Oracle 9i client, do I need to specify the ORACLE_HOME and ORA_NLS33 values?

                  Thank you for your help.

                    That list is ORACLE_HOME. I think the environment in your case is:

                    putenv("ORACLE_BASE=C:\oracle");
                    putenv("ORACLE_HOME=C:\oracle\ora90");
                    putenv("NLS_LANG=AMERICAN_AMERICA.WE8ISO8859P1");
                    putenv("ORA_NLS33=C:\oracle\ora90\ocommon\nls\admin\data");

                    EDIT: the last line -> without space after first double quote and all on one line.

                    You can set that environment variables in Windows with

                    => Control Panel (in category view additionally: Performance and Maintenance)
                    => System
                    => Advanced
                    => Environment Variables

                    There are two regions, one is "User variables for <user>" (only the currently logged in user sees them) and one is "System variables" (system wide variables).

                    Thomas

                      That worked.

                      I added the Windows System Environment Variables as noted specifically for my development workstation and eveything ran.

                      Thanks again for all of your help with this issue.

                        Write a Reply...