Hi Sini,

Check this one.

 xquery version "1.0-ml";

  import module namespace admin = "http://marklogic.com/xdmp/admin";
  at "/MarkLogic/admin.xqy";

  let $config := admin:get-configuration()
  return
  admin:database-get-name($config,xdmp:database())


 I think this will help you.



On Tue, Jul 16, 2013 at 12:03 PM, Manoj <[email protected]> wrote:

> Sini
>   you can get the name of the current db where the query is running using
> the following api.
>
> xdmp:database-name(xdmp:database())
>
> *xdmp:database()* : This will return the id of the current db where the
> query is being executed.
> *xdmp:database-name()*: this will return the name of the db(db id) which
> is passed to it.
>
> Thanks & Regards
> Manoj
>
> On Tue, Jul 16, 2013 at 2:20 AM, sini narayanan 
> <[email protected]>wrote:
>
>> Hi All,
>>
>> Is it possible to get the database name without providing the ID of the
>> same?
>> When I run xquery on a specific DB, I need to get the database name on
>> which the query is getting executed. I don not want to hardcode the ID or
>> the name.
>>
>> Thanks,
>> Sini
>>
>> _______________________________________________
>> General mailing list
>> [email protected]
>> http://developer.marklogic.com/mailman/listinfo/general
>>
>>
>
> _______________________________________________
> General mailing list
> [email protected]
> http://developer.marklogic.com/mailman/listinfo/general
>
>
_______________________________________________
General mailing list
[email protected]
http://developer.marklogic.com/mailman/listinfo/general

Reply via email to