A Strange Behaviour with my ORACLE Database
Hi; i am working on Qt application which uses ORACLE database and i meet a strange problem.
First part i compile the OCI driver like recommended in documentation and i finish without errors.I got the useful (.dll) and copied to
Second part i have tested if my OCI plugin is available with “QSqlDatabase::drivers()” and that is OK!
Now i have connected to ORACLE with the following code
After i have really connected to database and database have opened!!.
Now I started SQL Plus and i have executed the following queries:
i created a table nammed “Student” with 2 fields(id and name),
I inserted into table 3 rows and everything is fine
Now i come back in my Qt application and i executed this code
Normally i must to see the names of my 3 rows but nothing appears……
Thereafter when i tried to execute the insertions’s queries in my Qt application ,the code works fine and with the SELECT Statement i retrieved rows of my table successfully. What can cause this? When i execute queries(create,delete,insert ,update) from my Qt application,that works fine and i retrieve data successfully,but when i execute this queries from ORACLE database that also works fine but i can’t to retrieve the data in my Qt application. Thanks for advance
Are you sure you have committed your oracle sqlplus transaction? If not you will not be able to see the results from your qt application, and this is a normal behaviour for Oracle (and other RDBMS).
And yes, pasting credentials into public code snippet is a bad idea, but at least you pointed to localhost, which is not so easy to find….
SYSTEM” for the regular Oracle work is really a bad idea. Create a dedicated user for your schema!Using user “
Also, make sure that all involved users can read your data.
And last: do you connect as the same user on sqlplus?
Thanks Volker,i think that i solve my problem.
In fact ,when i was working on Qt application, i had also connected in the same time on sqlplus.
therefore,when i disconnected on sqlpus before to retrieving my data from Qt application,that works fine.
Do you think that it was this the problem?
Probably the problem is a commit not done. When acting in parallel on the data, independently from the users you are connect as, the database does not make all the data immediately visible until you commit. This is a behavior required to avoid dirty reads, phantom reads, and so on. Moreover, if a user is performing a locking operation (e.g., select for update) the other user (in the other transaction) is locked. When the first user ends (commit/abort) his work, the other user is unlocked and can access the data. So you problem could be either data uncommitted or a lock on the data you are trying to get from the database.