PHP
  Home arrow PHP arrow Page 6 - Abstracting Oracle Connectivity with PHP/O...
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Moblin 
JMSL Numerical Library 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
PHP

Abstracting Oracle Connectivity with PHP/OCI8
By: Dante Lorenso
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 14
    2003-01-08

    Table of Contents:
  • Abstracting Oracle Connectivity with PHP/OCI8
  • Oracle How-To — The Hard Way
  • Wrapping it up into a PHP Class
  • How Do I Use This?
  • Those Pretty OCIBindByName Arguments
  • Switching Between Development, QA and Production Environments
  • Conclusion

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Abstracting Oracle Connectivity with PHP/OCI8 - Switching Between Development, QA and Production Environments


    (Page 6 of 7 )

    We created that OCI8Hook class with database login and password abstraction for a reason.

    In many corporations, you'll have multiple environments. You'll want to build your code against the development environment, test it on a QA environment and finally if all goes well, send it out to a production environment. Well, that's one more advantage to having your connection strings abstracted into the function getDBAuth($sid) { ... } function.

    To toggle between environments, simple change the connect string for your DBNAME. Say I'm running all my queries against 'DBXYZ' with the following $stmt = $this->query("DBXYZ", $sql, $bargs);. Well, by simply changing the connect string from this:

    case "DBXYZ": return (array("usernam1", "secret1", "DBXYZ"));
    To something like this:

    case "DBXYZ": return (array("usernam1", "secret1", "TESTDB"));


    Or if you wanted to be really fancy, you might consider sticking an IF statement in there like this:

    case "DBXYZ":
    if (--I'm on the DEV environment--)
    {
    return (array("usernam1", "secret1", "DEVDB"));
    else if (--I'm on the QA environment--)
    {
    return (array("usernam1", "secret1", "TESTDB"));
    }
    else
    {
    return (array("usernam1", "secret1", "PRODDB"));
    }
    ...

    More PHP Articles
    More By Dante Lorenso


     

    PHP ARTICLES

    - Making Usage Statistics in PHP
    - Installing PHP under Windows: Further Config...
    - File Version Management in PHP
    - Statistical View of Data in a Clustered Bar ...
    - Creating a Multi-File Upload Script in PHP
    - Executing Microsoft SQL Server Stored Proced...
    - Code 10x More Efficiently Using Data Access ...
    - A Few Tips for Speeding Up PHP Code
    - The Modular Web Page
    - Quick E-Commerce with PHP and PayPal
    - Regression Testing With JMeter
    - Building an Iterator with PHP
    - PHP Frontend to ImageMagick
    - Using PEAR's mimeDecode Module
    - Incoming Mail and PHP






    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
    Stay green...Green IT