No, our xquery can be simple or complex depend on customer requirement, it is 
not our control. xml document retrieval is part of xquery using 
doc('6301904f80000114/0601904f80007547.xml') .

instead of
for $article in doc('6301904f80000114/0601904f80007547.xml') return $article
are you suggesting to use below command.
> XQUERY for $article in db:open('JunitDocbaseDB', 
> '6301904f80000114/0601904f80007547.xml') return $article

but in case of db:open xquery, we need to know database name much before. where 
as in doc(...) xquery, no need to pass database name as part of xquery. we are 
getting xquery from client side and later on on server side, we are connecting 
to specific basex database and then run this doc(...) xquery. so db:open will 
not help us.

connect to specific database:
=========================
    if(m_databaseName != null)
    xqs.setProperty("databaseName", m_databaseName);
    xqs.setProperty("user", m_administratorName);

    XQStaticContext xqsc;
    m_conn = (XQConnection2) xqs.getConnection(m_administratorName, password);

Run xquery :
==========
//got this query from client side
String xQuery = "for $article in doc('6301904f80000114/0601904f80007547.xml') 
return $article";

XQPreparedExpression xqPreparedExpr = null;
XQResultSequence resultSeq = null;
xqPreparedExpr = m_conn.prepareExpression(xQuery);
resultSeq = xqPreparedExpr.executeQuery();

running doc(...) xquery using above java program is working fine, if we open 
basexgui.bat and open database in GUI. otherwise throw error message. Is there 
any workaround to solve this doc(...) xquery.

Thanks,
Srikumar
________________________________
From: Christian Grün <christian.gr...@gmail.com>
Sent: Tuesday, August 18, 2020 2:28 PM
To: Srikumar Choudhury <schou...@opentext.com>
Cc: basex-talk@mailman.uni-konstanz.de <basex-talk@mailman.uni-konstanz.de>; 
Nikhil Sethi <nse...@opentext.com>
Subject: Re: [EXTERNAL] - Re: Error: Stopped at ., 1/20: [FODC0002] Resource 
'C:/Srikumar/Software/BaseX/BaseX941/basex/bin/6301904f80000114/0601904f80007547.xml'
 does not exist.

Fine. If you want to access documents from the database, db:open is
always the better choice.

On Tue, Aug 18, 2020 at 10:56 AM Srikumar Choudhury
<schou...@opentext.com> wrote:
>
> Yes I have tried it and it is returning result properly.
>
>
> ________________________________
> From: Christian Grün <christian.gr...@gmail.com>
> Sent: Tuesday, August 18, 2020 1:50 PM
> To: Srikumar Choudhury <schou...@opentext.com>
> Cc: basex-talk@mailman.uni-konstanz.de <basex-talk@mailman.uni-konstanz.de>; 
> Nikhil Sethi <nse...@opentext.com>
> Subject: [EXTERNAL] - Re: Error: Stopped at ., 1/20: [FODC0002] Resource 
> 'C:/Srikumar/Software/BaseX/BaseX941/basex/bin/6301904f80000114/0601904f80007547.xml'
>  does not exist.
>
> > > XQUERY for $article in doc('6301904f80000114/0601904f80007547.xml') 
> > > return $article
>
> Did you try db:open ?

Reply via email to