Friday, 9 March 2012

Windows 7 to Oracle Query

As explained in my previous post - I wanted to connect our Moodle to an Oracle Database system. Well, its all well and good connecting it on the live and development servers, but, unfortunetly, I code and develop on Windows 7. This therefore means that I will have to develop and test the scripts/code that will query MIS/Oracle on Windows 7.

Connect to Oracle using Windows 7
The following is mainly taken from

Assuming that PHP and Apache are installed on the windows machine, next install the instantclient-basic (32bit) and the SDK for development, make sure it’s the same version as installed on the server. This can be found at http://www.oracle.com/technetwork/topics/winsoft-085727.html .

Extract the basic to C:\instantclient_VERSION

Extract the SDK to the same folder and move the extracted SDK folder up to be in the installclient_VERSION folder.

Edit the Windows PATH environment setting and add C:\instantclient_version (the folder above).

Windows 7: Right click on computer->properties->advanced system setting->environmental  variables. Scroll down to ‘PATH’ click on it and ‘Edit’. Add the folder (each entry is separated by a ;)

Edit the php.ini file (usually in c:\xampp\php\php.ini). Make sure the extension_dir is set to the correct directory. For example:

extension_dir = "\xampp\php\ext"

Also make sure that that folder has the php_oci8.dll library file in it.

Enable the extension with either:

extension=php_oci8_11g.dll
or
extension=php_oci8.dll

This depends on the version in use.

Restart Apache and test using a test connection php file.

If this doesn’t work, it didn’t for me, then copy all of the dll’s from the instantclient folder and put them in xampp/apache/bin

To Query Oracle from a Windows box download sqldeveloper http://download.oracle.com/otn/java/sqldeveloper/sqldeveloper-3.0.04.34.zip. 

This now means I can query and test on my Windows Machine to an Oracle database system. 
 

No comments:

Post a Comment