How do I create a database in marklogic from a script
marklogic
Solution
As long as you are using MarkLogic 5.x, the easiest thing to do would be to use the Configuration Manager. This web based tool allows you to export the entire DB and app server configuration to a single xml file which can be version controlled. It can also then be imported to completely setup or reconfigure your MarkLogic instance.
In order to use this as part of continuous integration, you would have to script the import of the configuration. You could create an http server that has one endpoint which invokes the configuration API to do the loading, as documente here: http://community.marklogic.com/pubs/5.0/apidocs/package-api.html. This https based service could easily be invoked via ANT or any other CI tool.
Alternatively, especially if you are not yet running on 5.x, you could script the entire process instead of using a configuration package. All of the admin tasks are documented here: http://community.marklogic.com/pubs/5.0/books/adminAPI.pdf. You would then have to write all of the code necessary to configure your database, app servers, etc. and then expose it via an http server as described above.
Problem
We have started a new project that uses marklogic to store documents. To get the app running, we need to create a database, a forest, new users and setup an XDBC server. It is quite easy to do it from the web admin tool provided by Marklogic, but to run it from a continuous integration server we need to automate it. Is there any way to do it from the command line (like the sqlcmd.exe for sqlserver or sql plus in oracle) ??