0% found this document useful (0 votes)
16 views

Oracle

1. Check for the "oci8" string in phpinfo() to see if an Oracle connection is available. If not present, follow additional steps to enable the connection. 2. Open the php.ini file and remove the semicolon before the "extension=php_oci8.dll" string to activate the Oracle extension. 3. Restart XAMPP and check phpinfo() again for the "oci8" string to confirm the Oracle connection is now enabled.

Uploaded by

rkanagasabai89
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views

Oracle

1. Check for the "oci8" string in phpinfo() to see if an Oracle connection is available. If not present, follow additional steps to enable the connection. 2. Open the php.ini file and remove the semicolon before the "extension=php_oci8.dll" string to activate the Oracle extension. 3. Restart XAMPP and check phpinfo() again for the "oci8" string to confirm the Oracle connection is now enabled.

Uploaded by

rkanagasabai89
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

1. In your XAMPP Start Page, go to phpinfo, look for string oci8.

If string found it indicate that connection to oracle is available and simply execute Step-3. Otherwise

to activate connection do the following steps:

2. Open the currently used php.ini file by looking at the phpinfo, from the XAMPP folder. 3. Find string ;extension=php_oci8.dll. Remove the semicolon (;) from the begining of the string to activate the oracle extension. 4. Save the php.ini file. 5. Download the Instant Client Package Basic for Windows from the OTN Instant Client page. Unzip it to C:\xampp\php\ext folder 6. Edit the PATH environment setting and add C:\xampp\php\ext before any other Oracle directories. For example, on Windows XP, follow Start -> Control Panel -> System -> Advanced -> Environment Variables and edit PATH in the System variables list. 7. Set desired Oracle globalization language environment variables such as NLS_LANG. If nothing is set, a default local environment will be assumed. See An Overview on Globalizing Oracle PHP Applications for more details. 8. Unset Oracle variables such as ORACLE_HOME and ORACLE_SID, which are unnecessary with Instant Client (if they are set previously). 9. Restart XAMPP (or Start if its not already started). 10. To make sure that connection to oracle database has successfully activated, go to phpinfo. Find string: oci8. If found, then XAMPP can now communicate with Oracle Database.

Step-B
<?php

Now connect to your desired database and execute your query

define('DB_SERVER', 'yourservername'); define('DB_USERNAME', 'yourUserName'); define('DB_PASSWORD', 'yourPassword'); define('DB_DATABASE', 'yourDatabaseName'); $conn= oci_connect(DB_USERNAME, DB_PASSWORD, DB_SERVER) or die(oci_error()); echo "success..."; //$database = oci_select_db(DB_DATABASE) or die(oci_error()); $stid = oci_parse($conn, 'SELECT * FROM employees'); oci_execute($stid); echo "<table border='1'>\n"; while ($row = oci_fetch_array($stid, OCI_ASSOC+OCI_RETURN_NULLS)) { echo "<tr>\n"; foreach ($row as $item) { echo " <td>" . ($item !== null ? htmlentities($item, ENT_QUOTES) : "&nbsp;") . "</td>\n"; } echo "</tr>\n"; } echo "</table>\n"; ?>

You might also like