Welcome Guest, Not a member yet? Register   Sign In
CodeIgniter and Oracle XE connection help me with a small working example please..
#1

[eluser]manton[/eluser]
Hi..
Please anybody can shed me some light how to have a connection between CI 1.7 and oracle XE. At least to print_r the employees table in HR schema. I have tried many times following the CI database manipulation, doesn't work.

At least you can help me with the following:

1st
the database config.

I already have like this one:
$db['default']['hostname'] = "//127.0.0.1/XE";
$db['default']['username'] = "HR";
$db['default']['password'] = "HR";
$db['default']['database'] = "";
$db['default']['dbdriver'] = "oci8";
is that correct for a localhost?

2nd
example of a model

3rd
example of a controller

that shows print_r the employees table HR database in oracle XE

Thanks in adnvace
#2

[eluser]manton[/eluser]
I already got it.

First the database config is correct for a localhost.

2nd the model is here:
Code:
<?php
class Ocimod  extends Model {
    function Ocimod()
    {  
        parent::Model();
    }

    function getEmployees()
  {
    return $this->db->query("SELECT * FROM EMPLOYEES");
  }}
?>

3rd the controller
Code:
<?php
class Welcome extends Controller {

    function Welcome()
    {
        parent::Controller();
        
    }
    
    function index()
  {
    $query = $this->Ocimod->getEmployees();
    $data['que'] = $query->result();
    $data['numrows'] = $query->num_rows;
    $this->load->view('ociview',$data);
  }
}

Why mine was not working for all this time coz I dit not use uppercase for the first letter of the ocimodel. I put it like this
$query = $this->ocimod->getEmployees();

I did not realize that then I assumed the problem is in the connection, since in this forum not so many said succes about CI and codeigniter. Now I know CI is case sensitive and I have to be careful.

Cheers...
#3

[eluser]jcavard[/eluser]
Hey manton,

did this actually work for you? I tried it on OracleXE as well, and it gives me that same exhausting error
Code:
A PHP Error was encountered

Severity: Warning

Message: ocifetchinto() [function.ocifetchinto]: ORA-24374: définition non exécutée après extraction ou exécution et extraction

Filename: oci8/oci8_result.php

Line Number: 155




Theme © iAndrew 2016 - Forum software by © MyBB