I have tried with below code, but it did not work. Is it correct to way to set this option?? Is there any other way to set DEFAULTDB?
XQDataSource xqs = new BaseXXQDataSource(); ... System.setProperty("DEFAULTDB", "true");
The property key needs to be prefixed with 'org.basex.', and I would recommend you to set this property as early as possible (i.e., before the BaseXXQDataSource instance is created). See [1] for more information on how to set options with BaseX.
I remember there also was a way to set options via XQJ, but I can’t tell you off-hand how the corresponding method was called.