I am using a C++ shell extension DLL which used to read, write data into the SQLite database tables. There another application ( exe) which used to access all the tables.
Sometimes, my dll displaying an exception "The database file is locked" when I try to Delete/Insert/Update to the SQLite Database tables. This is because the other application was accessing the tables at this time.
Is there any way to resolve this issue from my DLL? Can I use the solution as mentioned in the link : "http://stackoverflow.com/questions/6455290/implementing-sqlite3-busy-timeout-in-an-ios-app"
In the current code, I am using CppSQLite3.cpp method execQuery(const char* szSQL) to execute the SQL query.
Please advice.
First of all you should know that SQLite does a Database level locking. When you start a transaction and the other application tries to write something to the same database, then you get Database is locked and SQLite automatically tries executing that same query after sqlite3_busy_timeout interval.
So the trick is to make sure you keep your transactions are as short as possible i.e
1. Do a begin transaction
2. Update/Delete/Insert
3. Commit
and not have anything else between these 3 steps.
And also increase your sqlite3_busy_timeout interval to suite your application depending on how large your transactions are.
You can try WAL mode, where reading and writing to SQLite can be done at the same time. But it comes with its own set of disadvantages. You can refer SQLite documentation.
SQLite has some restrictions regarding multiple users and multiple transactions. That means you can't read/write on a resource from different transactions. The database will be locked when the database is being updated.
Here are some links that might help you
http://sqlite.org/c3ref/busy_timeout.html
http://www.sqlite.org/c3ref/busy_handler.html
Good Luck
Related
I'm migrating from SQL Server to Azure SQL and I'd like to ask you who have more experience in Azure(I have basically none) some questions just to understand what I need to do to have the best migration.
Today I do a lot of cross database queries in some of my tasks that runs once a week. I execute SPs, run selects, inserts and updates cross the dbs. I solved the executions of SPs by using external data sources and sp_execute_remote. But as far as I can see it's only possible to select from an external database, meaning I won't be able to do any inserts or updates cross the dbs. Is that correct? If so, what's the best way to solve this problem?
I also read about cross db calls are slow. Does this mean it's slower that in SQL Server? I want to know if I'll face a slower process comparing to what I have today.
What I really need is some good guidelines on how to do the best migration without spending loads of time with trial and error. I appreciate any help in this matter.
Cross database transactions are not supported in Azure SQL DB. You connect to a specific database, and can't use 3 part names or use the USE syntax.
You could open up two different connections from your program, one to each database. It doesn't allow any kind of transactional consistency, but would allow you to retrieve data from one Azure SQL DB and insert it in another.
So, at least now, if you want your database in Azure and you can't avoid cross-database transactions, you'll be using an Azure VM to host SQL Server.
below is architecture of my applications.
sensor↔parser app↔database↔application1↔ethernet↔server
application2 and application3 are same level of application1.
database = sqlite3
problem is that too many transaction occured on database system.
parser app and applications are queries whole range of database for checking any differences every second.
so i would like to change architecture or database.
is there any database which has better performance than sqlite3?
or which part do i have to change?
I would switch out sqlite3 in favor of MySQL or PostgreSQL, those database systems are meant to handle multiple clients where as sqlite3 won't be able to do this because everything is stored in a single file. Each (write) access therefore has to block the entire database instead of only a single row of the table in question.
I would greatly appreciate if someone could share if it is possible to do a near real time oracle database sync application using spring integration. Its a lightweight requirement where only certain data fields across couple of tables to be copied over as soon as they change in source database. Any thoughts around what architecture can be used would greatly help. Also if any Oracle utility that can be leveraged along with SI?
I'd say that the Oracle Trigger is for you. When the main data is changed you should use a trigger to move those changes to another table at the same DB.
From SI you should use <int-jdbc:inbound-channel-adapter> to read and remove data from that sync table. Within the same transaction you have to use <int-jdbc:outboud-channel-adapter> to move the data to another DB.
The main feature here should be a XA transaction, because you use two DBs and what is good they both are Oracle.
Of course you can try to use the 1PC effort, but there will be need more work to do.
I'm planing on having my database stored in Cloudant.
We do not plan to have replication into Cloudant, only outside for backup purposes.
Is it safe to assume that there should not be any conflict in documents from the inner-working of BigCouch?
It is safe to assume that the clustered "big-couch inspired" code we run at Cloudant does not normally create additional conflicts in your documents. If you want to become a power user you can read up on 'quorum' in docs.cloudant.com, but you can safely ignore that to first order.
I have developed a system in which a group of users (appr 50 people right now) registers data and view registered data continously. The system stores data in an Access database, and I currently use the connection mode adModeShareDenyNone for all users in order for the database to never lock up the access to the database.
However it has been requested that I develop a simple Excel worksheet acting as an interface where a user can write an sql select statement and then retrieve data to the sheet according to this (via VBA). This is very simple and I have created such, however I want it to prevent the execution of manipulative statements (insert, update, delete), that is, act as a read-only system.
However I can't seem to find a way to do this without locking up the database for other user too, which is a no go, since the database is in constant use by multiple users. Is there a way to do what I want? I thought of other connection modes, but they all (besides adModeShareDenyNone) seem to apply some sort of locking.
What about adModeRead? That indicates read-only permissions and no share.