Showing posts with label Web design. Show all posts
Showing posts with label Web design. Show all posts

How web servers work with the Oracle database

I write this based on my personal experience when trying to make a connection to an Oracle database through php .. but it always appear error messages etc. ..

Assuming I use the appserver for windows

intrigued with this ,finally I'am try to find a solution in the following way

   
1. Download Oracle Instant Client in this link, if done extract the file search and select multiple files that oraociei10.dll, orannzsbb10.dll, oci.dll. Copy the file to c: \ windows \ system32 \
   
2. Change Registry NLS_LANG in a way go to Start -> Run -> Regedit -> HKEY_LOCAL_MACHINE -> SOFTWARE -> ORACLE -> NLS_LANG, input or Delete Null value .. like the picture below

   
3. On his php_oci8.dll extension on a web server php.ini settings file, by Start -> Run -> php.ini, find and remove (;) to activate the file extension, such as the following picture:
 
   
4. Restart your web server
   
5. Then check php_info (); you, through the following picture you see the following description
 


ok you are ready to work with Oracle database ...^_^

    Codeigniter with oracle

    Now let me show how to make..CI connect with oracle database..
    there are some things we need to prepare

    •   make sure our web server already supports connections to Oracle databases by checking through browser.with create a some *.php file with the contents
    <?;
    phpinfo();
    ?>
     and you will see a description like in the picture below


    if the information is there then there is ready to work with Oracle database.or if not then you need to set up your web server settings .. see how web servers work with the Oracle database this link


    Connection Parameters

    Not all of the parameters in application/config/database.php are used as one might expect.  Namely, $db[‘default’][‘database’] isn’t used at all.  The value used for $db[‘default’][‘hostname’] depends on whether the Oracle client’s tnsnames.ora file exists and contains information about the database to be used.  If the file exists and is configured for the intended database, this parameter should be set to the symbolic name.  Otherwise, it should be set to a single string of the connection parameters that tnsmames.ora would normally contain.
    An example of connection parameters for the latter case:

    $db['default']['hostname''(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dbhost.example.com)(PORT=1521))(CONNECT_DATA=(SID=dbsid)))';
    $db['default']['username''dbuser';
    $db['default']['password''dbpassword';
    $db['default']['database'''// not used by this Oracle driver
    $db['default']['dbdriver''oci8'


    In this case, the appropriate values need to be set for the HOST, PORT, and SID keywords in the hostname parameter.

    Different queries return the same results

    If you run two different queries in the same script you can run into the problem, that both queries return the same result.

    Example

    $this->load->database();
    $query1 $this->db->query("SELECT * FROM table1");
    $result1 $query1->result(); // Returns Value of table 1
    $query1->free_result();

    $query2 $this->db->query("SELECT * FROM table2");
    $result2 $query2->result(); // Also returns Value of table 1 

    Solution

    In file codeigniter/database/driver/oci8/oci8_driver.php you should change the lines

    function _set_stmt_id($sql)
        
    {
            
    if ( ! is_resource($this->stmt_id))
            
    {
                $this
    ->stmt_id ociparse($this->conn_id$this->_prep_query($sql));
            
    }
        } 
     
    to


    function _set_stmt_id($sql)
        
    {
            $this
    ->stmt_id ociparse($this->conn_id$this->_prep_query($sql));
        



    happy CI..^_^

      Internal Service Error karena .htaccess, edit aja httpd.conf

      Buka file httpd.conf (ada di folder AppServ\Apache2.2\conf) kemudian cari ”#LoadModule rewrite_module modules/mod_rewrite.so“ hilangkan tanda komentar (“#”) sehingga menjadi LoadModule rewrite_module modules/mod_rewrite.so. Simpan dan restart apachenya. Insya Allah .htaccess akan berjalan dan berfungsi dengan normal. asumsi file .htacces RewriteEngine On RewriteBase / #Removes access to the system folder by users. #Additionally this will allow you to create a System.php controller, #previously this would not have been possible. #'system' can be replaced if you have renamed your system folder. RewriteCond %{REQUEST_URI} ^system.* RewriteRule ^(.*)$ /index.php?/$1 [L] #Checks to see if the user is attempting to access a valid file, #such as an image or css document, if this isn't true it sends the #request to index.php RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ index.php?/$1 [L] # If we don't have mod_rewrite installed, all 404's # can be sent to index.php, and everything works as normal. # Submitted by: ElliotHaughin ErrorDocument 404 /index.php

      Membuat file. Htaccess.

      Kita perlu membuat sebuah file bernama. Htaccess kemudian simpan ke direktori root instalasi kita. The. Htacces file kita harus menciptakan akan berisi petunjuk yang memungkinkan file dan folder tertentu untuk dapat dilihat pada situs web. Ini juga akan menghapus index.php di URL tujuan apapun. Contoh jika Anda mengakses menyambut Anda tanpa pengendali. Htaccess url harus terlihat seperti ini http://localhost/tutorial/index.php/welcome. Jika file. Htaccess hadir berisi baris kode berikut di bawah ini, Anda sekarang dapat mengakses controller menyambut Anda dengan url ini http://localhost/tutorial/welcome RewriteEngine on RewriteCond $1 !^(index\.php|images|css|js|robots\.txt|favicon\.ico) RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule ^(.*)$ ./index.php/$1 [L,QSA]