i am getting different value in different device after running same sql statment - android-sqlite

I am developing data driven android application and i am getting different value in different Devices after running the same the SQL statement
SQL:
select sum(quantity_on_hand-issued_quantity) as Quantity_On_Hand, a.vaccine_name
from vaccine a, vaccine_detail b
where a.vaccine_id=b.vaccine_id and strftime("%m", b.date) < '11' and a.vaccine_id= 4
To elaborate : When it runs on the Emulator it returns a value, however when I run it on real Android device it returns null.

Try to increase the RAM of emulator and try it .. U should rely more on the value returned by device.

Related

I want to develop a adf fusion web application project with postgresql

I am having a problem with update mapping in query based view object. When I use NULLIF function in where clause the application gives the builder error(An unexpected severe error has occurred in JDeveloper, The program may be unstable, which could result in data loss).
Example of my code:
select table1.column1,table1.column2,table2.column3
from table1 left join table2
on table1.column1 = table2.column1
where
table1.column1 = nullif(table1.column1,?)
When you are creating your business components - which flavor of SQL/JDBC are you using? Make sure it is the generic one and not the Oracle specific.

SQL connection timeout error with single query only in Azure webapp

I'm working on an Azure web app. Using the entity framework to fetch the result.
Everything is working fine. All queries are working as expected.
But the following one throwing the SQL connection timeout error. Most of the time it works fine but doesn't know when it starts giving the error and keep this error for more than 24 hours.
var logsCount = context.Logs.Where(l => l.StartDate >= startDate && l.StartDate <= endDate)
.GroupBy(l => l.KeywordID)
.ToDictionary(l => l.Key, l => l.Count());
I believe it's not an issue with the query because it keeps running fine for many days and starts giving problem suddenly.
It starts working fine itself. Not sure, why it's happening?
Can it be anything related to database or server only?
Please try creating an index like the following using a tool like SQL Server Management Studio:
CREATE INDEX IX ON [YourTable] (StartDate, KeywordID) INCLUDE
( list all columns returned separated by comma )

How to check the status of long running DB2 query?

I am running a db2 query that unions two very large tables. I started the query 10 hours ago, and it doesn't seem to finish yet.
However, when I check the status of the process by using top, it shows the status is 'S'. Does this mean that my query stopped running? But I couldn't find any error message.
How can I check what is happening to the query?
In DB2 for LUW 11.1 there is a text-based dsmtop utility that allows you to monitor the DB2 instance, down to individual executing statements, in real time. It's pre-11.1 equivalent is called db2top.
There is also a Web-based application, IBM Data Server Manager, which has a free edition with basic monitoring features.
Finally, you can query one of the supplied SQL monitor interfaces, for example, the SYSIBMADM.MON_CURRENT_SQL view:
SELECT session_auth_id,
application_handle,
elapsed_time_sec,
activity_state,
rows_read,
SUBSTR(stmt_text,1,200)
FROM sysibmadm.mon_current_sql
ORDER BY elapsed_time_sec DESC
FETCH FIRST 5 ROWS ONLY
You can try this command as well
db2 "SELECT agent_id,
Substr(appl_name, 1, 20) AS APPLNAME,
elapsed_time_min,
Substr(authid, 1, 10) AS AUTH_ID,
agent_id,
appl_status,
Substr(stmt_text, 1, 30) AS STATEMENT
FROM sysibmadm.long_running_sql
WHERE elapsed_time_min > 0
ORDER BY elapsed_time_min desc
FETCH first 5 ROWS only"

Warning message on Insert or update

I keep getting a message whenever I insert or update any record in any table in my database:
[34931.406] SQL_Statement 1 4 -1 999999999 01S02 -5 -- cursor updatability changed
I was wondering exactly what this message means and why I am getting it. Is it safe to ignore?
Am I supposed to react to it / do something different?
Thanks for reading
Just in case its necessary -
I'm running PostgreSQL 9.1.2 on Ubuntu LTE
I'm using 32bit ODBC psqlodbc_09_01_0100 on Windows 7 x64
I'm also using a third party odbc library "SQLTools" by PerfectSync - but I don't think thats making the message because I also use it with MySQL with no problems
Are u updating cursor's elements directly?
in this case warning message is informing u that u are changin' cursor's elements while it's open.
Something similar happens, in java language when tryng to change list's elements number (adding or removing elements) while iterating it.

Cocoa error 256 core data

I have error "Cocoa error 256" when I try to save data. How to fix it? And what problem?
According to the help reference in Xcode:
NSFileReadUnknownError
Read error, reason unknown
Available in Mac OS X v10.4 and later.
Declared in FoundationErrors.h.
Sadly, that's probably not too helpful, though it is an unknown -read- error.
If its a core data error there is probably an actual error object somewhere near where the error occurs. If you dump the error objects userInfo dictionary, you can usually get a lot more detail than just the error code itself.
This is what it boils down to (as Tegeril said)
NSFileReadUnknownError Read error,
reason unknown
Available in Mac OS X v10.4 and later.
Declared in FoundationErrors.h.
A file can also be a resource located at a URL/URI, if the URL has unencoded characters it can cause this type of error.
Check the path to the resource/file.
I ran into exactly this error when populating an SQLite database for an iOS app using a custom script (ie not using Core Data). It turns out that there is some metadata which you have to update yourself, after adding new rows. Find the row in Z_PRIMARYKEY where Z_NAME equals the name of the table you've just inserted into. Make sure that Z_MAX in this row is equal to the highest value of Z_PK in the table you've inserted the rows into. In my case, as soon as I updated Z_MAX with the correct number, the error went away.
So, for the "ZAUTHOR" table:
SELECT z_pk FROM ZAUTHOR ORDER BY z_pk DESC LIMIT 1; /* Returns 1234 */
UPDATE Z_PRIMARYKEY SET z_max = 1234 WHERE z_name = 'Author';
This is the article which helped me track down the error.
I get this error on Xcode 6 (& 7) when switching a network connection while the Simulator is open. For example moving from one wireless network to another. The solution for me is to Quit Simulator and restart.