Hello,
I am using basex version 8.3-SNAPSHOT in a java stand alone application. After i set the property org.basex.path with the path of my DB (ex. /mnt/test/db_1) I call a new Context and then CreateDB. It creates the folder /mnt/test/db_1/data/db_1 After that (in the same execution enviroment) I change the property to another DB (ex. /mnt/test/db_2). It creates the folder /mnt/test/db_1/data/db_2
I would like to create the db_2 in the path /mnt/test/db_2/data/db_2.
Follow the code I wrote, where inputFolder is a folder with inside some xml files
Thanks in advance.
System.setProperty("org.basex.path", "/mnt/test/db_1"); Context context = new Context(false); new CreateDB("db_1", inputFolder).execute(context); context.close();
System.setProperty("org.basex.path", "/mnt/test/db_2"); context = new Context(false); new CreateDB("db_2", inputFolder).execute(context); context.close();
Hi Antonio
The BaseX home directory is static and will only be assigned once (see [1] for more information). You should have more success by assigning a directory to "org.basex.dbpath", but it's better to directly assign a new path to the context:
Context context = new Context(false); context.soptions.set(StaticOptions.DBPATH, "/mnt/test/db_1"); ...
Hope this helps, Christian
[1] https://github.com/BaseXdb/basex/blob/master/basex-core/src/main/java/org/ba...
On Tue, Oct 27, 2015 at 12:00 PM, Antonio Mele amele@altereos.com wrote:
Hello,
I am using basex version 8.3-SNAPSHOT in a java stand alone application. After i set the property org.basex.path with the path of my DB (ex. /mnt/test/db_1) I call a new Context and then CreateDB. It creates the folder /mnt/test/db_1/data/db_1 After that (in the same execution enviroment) I change the property to another DB (ex. /mnt/test/db_2). It creates the folder /mnt/test/db_1/data/db_2
I would like to create the db_2 in the path /mnt/test/db_2/data/db_2.
Follow the code I wrote, where inputFolder is a folder with inside some xml files
Thanks in advance.
System.setProperty("org.basex.path", "/mnt/test/db_1"); Context context = new Context(false); new CreateDB("db_1", inputFolder).execute(context); context.close();
System.setProperty("org.basex.path", "/mnt/test/db_2"); context = new Context(false); new CreateDB("db_2", inputFolder).execute(context); context.close();
Yes thank you very much. It works. But I have to add it to every call even when I make a query, I saw that it doesn't create the folder data (usually it creates /mnt/test/db_1/data/db_1), so now my queries fail if I don't add context.soptions.set(StaticOptions.DBPATH, "/mnt/test/db_1");
Thank you.
Antonio
2015-10-28 8:52 GMT+01:00 Christian Grün christian.gruen@gmail.com:
Hi Antonio
The BaseX home directory is static and will only be assigned once (see [1] for more information). You should have more success by assigning a directory to "org.basex.dbpath", but it's better to directly assign a new path to the context:
Context context = new Context(false); context.soptions.set(StaticOptions.DBPATH, "/mnt/test/db_1"); ...
Hope this helps, Christian
[1] https://github.com/BaseXdb/basex/blob/master/basex-core/src/main/java/org/ba...
On Tue, Oct 27, 2015 at 12:00 PM, Antonio Mele amele@altereos.com wrote:
Hello,
I am using basex version 8.3-SNAPSHOT in a java stand alone application. After i set the property org.basex.path with the path of my DB (ex. /mnt/test/db_1) I call a new Context and then CreateDB. It creates the folder /mnt/test/db_1/data/db_1 After that (in the same execution enviroment) I change the property to another DB (ex. /mnt/test/db_2). It creates the folder /mnt/test/db_1/data/db_2
I would like to create the db_2 in the path /mnt/test/db_2/data/db_2.
Follow the code I wrote, where inputFolder is a folder with inside some
xml
files
Thanks in advance.
System.setProperty("org.basex.path", "/mnt/test/db_1"); Context context = new Context(false); new CreateDB("db_1", inputFolder).execute(context); context.close();
System.setProperty("org.basex.path", "/mnt/test/db_2"); context = new Context(false); new CreateDB("db_2", inputFolder).execute(context); context.close();
A little warning: The current rationale in BaseX is that there is only one Context instance and, thus, only one database directory. Moving away from that might give you more freedom, but it might also lead to unexpected behavior.
On Wed, Oct 28, 2015 at 11:51 AM, Antonio Mele amele@altereos.com wrote:
Yes thank you very much. It works. But I have to add it to every call even when I make a query, I saw that it doesn't create the folder data (usually it creates /mnt/test/db_1/data/db_1), so now my queries fail if I don't add context.soptions.set(StaticOptions.DBPATH, "/mnt/test/db_1");
Thank you.
Antonio
2015-10-28 8:52 GMT+01:00 Christian Grün christian.gruen@gmail.com:
Hi Antonio
The BaseX home directory is static and will only be assigned once (see [1] for more information). You should have more success by assigning a directory to "org.basex.dbpath", but it's better to directly assign a new path to the context:
Context context = new Context(false); context.soptions.set(StaticOptions.DBPATH, "/mnt/test/db_1"); ...
Hope this helps, Christian
[1] https://github.com/BaseXdb/basex/blob/master/basex-core/src/main/java/org/ba...
On Tue, Oct 27, 2015 at 12:00 PM, Antonio Mele amele@altereos.com wrote:
Hello,
I am using basex version 8.3-SNAPSHOT in a java stand alone application. After i set the property org.basex.path with the path of my DB (ex. /mnt/test/db_1) I call a new Context and then CreateDB. It creates the folder /mnt/test/db_1/data/db_1 After that (in the same execution enviroment) I change the property to another DB (ex. /mnt/test/db_2). It creates the folder /mnt/test/db_1/data/db_2
I would like to create the db_2 in the path /mnt/test/db_2/data/db_2.
Follow the code I wrote, where inputFolder is a folder with inside some xml files
Thanks in advance.
System.setProperty("org.basex.path", "/mnt/test/db_1"); Context context = new Context(false); new CreateDB("db_1", inputFolder).execute(context); context.close();
System.setProperty("org.basex.path", "/mnt/test/db_2"); context = new Context(false); new CreateDB("db_2", inputFolder).execute(context); context.close();
basex-talk@mailman.uni-konstanz.de