SQLite Forum

PRAGMA temp_store_directory
Login
I have java application with 10 threads, each thread works on different DB (each thread on one db). When I create connection to the DB, I pass to it `PRAGMA temp_store_directory` with folder where db is located , so temp file will be placed there. Recently reading on that PRAGMA I found :

>When the temp_store_directory setting is changed, all existing temporary tables, indices, triggers, and viewers in the database connection that issued the pragma are immediately deleted. In practice, temp_store_directory should be set immediately after the first database connection for a process is opened. If the temp_store_directory is changed for one database connection while other database connections are open in the same process, then the behavior is undefined and probably undesirable.

But I don't really understand if this connection to the same DB or any connection within same process will be broken ? Also found that

>Changing the temp_store_directory setting is not threadsafe. Never change the temp_store_directory setting if another thread within the application is running any SQLite interface at the same time. Doing so results in undefined behavior. Changing the temp_store_directory setting writes to the sqlite3_temp_directory global variable and that global variable is not protected by a mutex.

So, here it's confuses even more. And last is that deprecated in SQLite

>This pragma is deprecated and exists for backwards compatibility only. New applications should avoid using this pragma. Older applications should discontinue use of this pragma at the earliest opportunity.

So, not sure how to work if that is deprecated, as I have 10 connections to 10 different DB and how I set temp folder for each connection separately ?

Thanks