Discussion:
root_path = configuration
Dick Repasky
2006-03-17 01:06:28 UTC
Permalink
Hi All,

I'm using Mckoi1.0.3 in embedded mode, and I'd like the data directory
to be relative to the configuration file. But, when I create the
database, it is the path is relative to the current working directory
rather than relative to the location of the configuration file. Here is
what I do.

root_path = configuration
database_path = ./mckoidb

I do
File configfile = new File("/absolute/path/of/mckoidb.conf");
DefaultDBConfig config = MckoiUtils.loadConfig(configfile);

System.out.println(config.getValue("root_path");
prints configuration, as is should

But, then,

DBController control = DBController.getDefault();
control.createDatabase(config, "someuser", "somepassword").close();

creates the database in a directory named mckoidb that is relative to
the current working directory rather than in a directory named mckoidb
that is relative to the location of the configuration file.

Is this a bug? I searched the mailing list archives for root_path but
came up with way too many hits on just root or just path and gave up
before finding an entry that really contained root_path. Ditto for
"root_path". Also not useful were root_path configuration.

Thanks,

Dick


---------------------------------------------------------------
Mckoi SQL Database mailing list http://www.mckoi.com/database/
To unsubscribe, send a message to mckoidb-***@mckoi.com
Dick Repasky
2006-03-18 01:19:04 UTC
Permalink
As usual the problem was operator error.

What I had done:

DefaultDBConfig config = new DefaultDBConfig();
config.loadFromFile(configfile);

What I needed to do:

DefaultDBConfig config = new DefaultDBConfig(configfile.getParentFile());
config.loadFromFile(configfile);

Oops,

Dick


---------------------------------------------------------------
Mckoi SQL Database mailing list http://www.mckoi.com/database/
To unsubscribe, send a message to mckoidb-***@mckoi.com
Tobias Downer
2006-03-18 02:06:10 UTC
Permalink
Hi,

The 'root_path' property is only used when starting Mckoi through the
command line interface. When using the control API, DefaultDBConfig
needs to be told the path of the Mckoi configuration file if that's the
location you wish the database to be stored at. For example;

File config_path = new File("/absolute/path/of/config/");
File config_file = new File(config_path, "mckoidb.conf");
DefaultDBConfig config = new DefaultDBConfig(config_path);
config.loadFromFile(config_file);

DBController control = DBController.getDefault();
control.createDatabase(config, "someuser", "somepassword").close();

Toby.
Post by Dick Repasky
Hi All,
I'm using Mckoi1.0.3 in embedded mode, and I'd like the data directory
to be relative to the configuration file. But, when I create the
database, it is the path is relative to the current working directory
rather than relative to the location of the configuration file. Here is
what I do.
root_path = configuration
database_path = ./mckoidb
I do
File configfile = new File("/absolute/path/of/mckoidb.conf");
DefaultDBConfig config = MckoiUtils.loadConfig(configfile);
System.out.println(config.getValue("root_path");
prints configuration, as is should
But, then,
DBController control = DBController.getDefault();
control.createDatabase(config, "someuser", "somepassword").close();
creates the database in a directory named mckoidb that is relative to
the current working directory rather than in a directory named mckoidb
that is relative to the location of the configuration file.
Is this a bug? I searched the mailing list archives for root_path but
came up with way too many hits on just root or just path and gave up
before finding an entry that really contained root_path. Ditto for
"root_path". Also not useful were root_path configuration.
Thanks,
Dick
---------------------------------------------------------------
Mckoi SQL Database mailing list http://www.mckoi.com/database/
To unsubscribe, send a message to mckoidb-***@mckoi.com

Continue reading on narkive:
Loading...