0

I am using Codeigniter on our PHP project that interacts with the Oracle (10g) Database. I have successfully configured Codeigniter to connect and query from the database. However, when I manually run insert/update/delete scripts on the database using Oracle SQL Developer, then check the changes using Codeigniter, it does not recognize the new data.

ie. Say we have a table TBL_PERSON that has ID and NAME columns. I run an insert statement using Oracle SQL Developer:

insert into TBL_PERSON values(1, 'Name1');

Then I fetch the data in TBL_PERSON through CI:

$this->db->get_where('TBL_PERSON', array('ID'=>1));

It doesn't return the data that has been recently inserted. I have to restart XAMPP, do refreshes on the page a lot of times before the data appears. But if I use CI to insert the data itself, say

$this->db->insert('TBL_PERSON', array('ID'=>1, 'NAME'=>'Name1');

then run the fetch code again, it returns the needed data instantly.

Now, I'm not certain where the inconsistency lies: whether it's in Codeigniter or Oracle SQL Developer. If it is in Codeigniter, what is causing this and what should be the correct set-up to prevent this? Does Codeigniter have result caching for Oracle? I've set the Database Caching of CI to OFF already:

$db['default']['cache_on'] = FALSE;
1
  • Do you cache the output of the pages ? Commented Jul 6, 2012 at 12:12

2 Answers 2

1

Do you have auto commit enabled in SQL Developer? It might be the case the insert statement is not committed immediately.

Sign up to request clarification or add additional context in comments.

1 Comment

You got it! Thanks!!! I didn't bother to look at auto commit of SQL Developer since I'm used to MySQL.
0

I had the same problem once. The other IT guys attempted everything to

INSERT INTO "TABLE" VALUES (1,2,'3'); COMMIT;

The oci_connect executes the COMMIT after the queries. If you are using a tool like SQL developer, you must execute COMMIT after a query.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.