Interesting experiments.. I didn't try it by myself, so I'd say it's one of those "works 95%" solutions ;) Maybe even 99%.

Keep me updated!
Christian


Am 14.11.2016 9:09 nachm. schrieb "Maximilian Gärber" <mgaerber@arcor.de>:
Hi,

I am testing how to change DBPATH dynamically to enable a simple form
of multi tenancy (running one basex instance with separated data
directories, so locking for example does not affect all tenants).

Basically, I just keep/reuse several Context objects which have other
options set [1]

String dbpath =  ctx.soptions.get(StaticOptions.DBPATH);
String userDbPath = dbpath + "\\" + usr;
ctx.soptions.put(StaticOptions.DBPATH, userDbPath);

So far, I did not experience any issues, anything that speaks against
doing this?


Regards,

Max


[1] https://github.com/axxepta/basex-multitenant/blob/master/src/test/java/de/axxepta/basex/AppTest.java