Hi Christian, Why I am getting below error message, even though 0601904f80007547.xml file exist in database. if we will open the corresponding database using basexgui.bat(i.e., open "JunitDocbaseDB" database in GUI), then xqPreparedExpr.executeQuery() java api is returning proper 0601904f80007547.xml data(see below log), otherwise throwing same below error message.
How I can resolve this issue or it is bug?
BXCE001 - Stopped at ., 1/20: [FODC0002] Resource 'C:/Srikumar/Software/BaseX/BaseX941/basex/bin/6301904f80000114/0601904f80007547.xml' does not exist.
Open basex.bat: =================
XQUERY db:open('JunitDocbaseDB', '6301904f80000114/0601904f80007547.xml')
<!-- Configuration file for user test suite. --> <testSuiteConfig version="2.0"> <testSuiteEnv> <paths> <path type="input" value="../data"/> </paths> </testSuiteEnv> <package name="com.documentum.test.xhive_integration.uc_1.uc_1_1"> <test name="TC_1_1_1" className="TC_1_1_1"/> </package> </testSuiteConfig> Query executed in 12.59 ms.
XQUERY for $article in doc('6301904f80000114/0601904f80007547.xml') return $article
Stopped at ., 1/20: [FODC0002] Resource 'C:/Srikumar/Software/BaseX/BaseX941/basex/bin/6301904f80000114/0601904f80007547.xml' does not exist.
Run same xquery from java program: ================================== XQPreparedExpression xqPreparedExpr = null; XQResultSequence resultSeq = null; String xQuery = "for $article in doc('6301904f80000114/0601904f80007547.xml') return $article"; xqPreparedExpr = m_conn.prepareExpression(xQuery); resultSeq = xqPreparedExpr.executeQuery();
Log: ==== [13:17:10.034] TRACE: XQConnection-1.prepareExpression(String) invoked, with the raw XQuery of: for $article in doc('6301904f80000114/0601904f80007547.xml') return $article [13:17:10.034] TRACE: XQConnection-1.prepareExpression(String, XQStaticContext) invoked, with the raw XQuery of: for $article in doc('6301904f80000114/0601904f80007547.xml') return $article [13:17:10.035] TRACE: XQPreparedExpression-1.executeQuery() invoked, with the raw XQuery of: for $article in doc('6301904f80000114/0601904f80007547.xml') return $article [13:17:10.036] TRACE: XQPreparedExpression-1.executeQuery(), raw XQuery resolved to: for $article in doc('6301904f80000114/0601904f80007547.xml') return $article javax.xml.xquery.XQException: BXCE001 - Stopped at ., 1/20: [FODC0002] Resource 'C:/Srikumar/Software/BaseX/BaseX941/basex/bin/6301904f80000114/0601904f80007547.xml' does not exist.
Run same xquery using above same java program:(after opening basexgui.bat and open "JunitDocbaseDB" database in GUI) ==============================================
log: ==== [13:22:49.313] TRACE: XQConnection-2.prepareExpression(String) invoked, with the raw XQuery of: for $article in doc('6301904f80000114/0601904f80007547.xml') return $article [13:22:49.313] TRACE: XQConnection-2.prepareExpression(String, XQStaticContext) invoked, with the raw XQuery of: for $article in doc('6301904f80000114/0601904f80007547.xml') return $article [13:22:49.315] TRACE: XQPreparedExpression-1.executeQuery() invoked, with the raw XQuery of: for $article in doc('6301904f80000114/0601904f80007547.xml') return $article [13:22:49.315] TRACE: XQPreparedExpression-1.executeQuery(), raw XQuery resolved to: for $article in doc('6301904f80000114/0601904f80007547.xml') return $article [13:22:49.318] DEBUG: XQPreparedExpression-1.close() invoked. Finished executing xquery with query Start iterating through the xquery results for query 0 Result : <!-- Configuration file for user test suite. --> <testSuiteConfig version="2.0"> <testSuiteEnv> <paths> <path type="input" value="../data"/> </paths> </testSuiteEnv> <package name="com.documentum.test.xhive_integration.uc_1.uc_1_1"> <test name="TC_1_1_1" className="TC_1_1_1"/> </package> </testSuiteConfig>
Thanks, Srikumar
Yes I have tried it and it is returning result properly.
[cid:cf9a7b34-5681-417e-8eb8-ff3ec195d2f9] ________________________________ From: Christian Grün christian.gruen@gmail.com Sent: Tuesday, August 18, 2020 1:50 PM To: Srikumar Choudhury schoudhu@opentext.com Cc: basex-talk@mailman.uni-konstanz.de basex-talk@mailman.uni-konstanz.de; Nikhil Sethi nsethi@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 ?
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 schoudhu@opentext.com wrote:
Yes I have tried it and it is returning result properly.
From: Christian Grün christian.gruen@gmail.com Sent: Tuesday, August 18, 2020 1:50 PM To: Srikumar Choudhury schoudhu@opentext.com Cc: basex-talk@mailman.uni-konstanz.de basex-talk@mailman.uni-konstanz.de; Nikhil Sethi nsethi@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 ?
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.gruen@gmail.com Sent: Tuesday, August 18, 2020 2:28 PM To: Srikumar Choudhury schoudhu@opentext.com Cc: basex-talk@mailman.uni-konstanz.de basex-talk@mailman.uni-konstanz.de; Nikhil Sethi nsethi@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 schoudhu@opentext.com wrote:
Yes I have tried it and it is returning result properly.
From: Christian Grün christian.gruen@gmail.com Sent: Tuesday, August 18, 2020 1:50 PM To: Srikumar Choudhury schoudhu@opentext.com Cc: basex-talk@mailman.uni-konstanz.de basex-talk@mailman.uni-konstanz.de; Nikhil Sethi nsethi@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 ?
No, our xquery can be simple or complex depend on customer requirement, it is not our control.
So it’s completely another party that is generating the client queries?
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.
By default, your database must be contained in the path argument of fn:doc call as well. By enabling the DEFAULTDB option, however, your path will first be resolved against a database that has been opened in the global context. See [1] for more information on accessing databases resources with BaseX.
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.
Charles Foster may have enabled the DEFAULTDB option in his driver, so that may be the reason why XQJ deviates from the standard behavior of BaseX.
So it’s completely another party that is generating the client queries? Srikumar>> yes it is another component, which generate query, we do not have control on it.
By default, your database must be contained in the path argument of fn:doc call as well. By enabling the DEFAULTDB option, however, your path will first be resolved against a database that has been opened in the global context. See [1] for more information on accessing databases resources with BaseX. Srikumar>> yes if I will modify the doc xquery and passed database name, it is working fine. For example: for $article in doc('JunitDocbaseDB/6301904f80000114/0601904f80007547.xml') return $article"
I will try one more option like open database just before running xquery. java code: ======== String xQuery = "for $article in doc('6301904f80000114/0601904f80007547.xml') return $article";
xqPreparedExpr = m_conn.prepareExpression(xQuery); xqPreparedExpr.executeCommand("OPEN " + "JunitDocbaseDB"); resultSeq = xqPreparedExpr.executeQuery();
Thanks, Srikumar
________________________________ From: Christian Grün christian.gruen@gmail.com Sent: Tuesday, August 18, 2020 3:18 PM To: Srikumar Choudhury schoudhu@opentext.com Cc: basex-talk@mailman.uni-konstanz.de basex-talk@mailman.uni-konstanz.de; Nikhil Sethi nsethi@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.
No, our xquery can be simple or complex depend on customer requirement, it is not our control.
So it’s completely another party that is generating the client queries?
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.
By default, your database must be contained in the path argument of fn:doc call as well. By enabling the DEFAULTDB option, however, your path will first be resolved against a database that has been opened in the global context. See [1] for more information on accessing databases resources with BaseX.
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.
Charles Foster may have enabled the DEFAULTDB option in his driver, so that may be the reason why XQJ deviates from the standard behavior of BaseX.
[1] https://urldefense.com/v3/__https://docs.basex.org/wiki/Databases__;!!Obbck6...
I have tried below test but it did not help. it throw error message.
String xQuery = "for $article in doc('6301904f80000114/0601904f80007547.xml') return $article";
xqPreparedExpr = m_conn.createExpression(); String comamnd = "OPEN " + docbasename; xqPreparedExpr.executeCommand(comamnd); resultSeq = xqPreparedExpr.executeQuery(xQuery);
Thanks, Srikumar
________________________________ From: Srikumar Choudhury schoudhu@opentext.com Sent: Tuesday, August 18, 2020 3:49 PM To: Christian Grün christian.gruen@gmail.com Cc: basex-talk@mailman.uni-konstanz.de basex-talk@mailman.uni-konstanz.de; Nikhil Sethi nsethi@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.
So it’s completely another party that is generating the client queries? Srikumar>> yes it is another component, which generate query, we do not have control on it.
By default, your database must be contained in the path argument of fn:doc call as well. By enabling the DEFAULTDB option, however, your path will first be resolved against a database that has been opened in the global context. See [1] for more information on accessing databases resources with BaseX. Srikumar>> yes if I will modify the doc xquery and passed database name, it is working fine. For example: for $article in doc('JunitDocbaseDB/6301904f80000114/0601904f80007547.xml') return $article"
I will try one more option like open database just before running xquery. java code: ======== String xQuery = "for $article in doc('6301904f80000114/0601904f80007547.xml') return $article";
xqPreparedExpr = m_conn.prepareExpression(xQuery); xqPreparedExpr.executeCommand("OPEN " + "JunitDocbaseDB"); resultSeq = xqPreparedExpr.executeQuery();
Thanks, Srikumar
________________________________ From: Christian Grün christian.gruen@gmail.com Sent: Tuesday, August 18, 2020 3:18 PM To: Srikumar Choudhury schoudhu@opentext.com Cc: basex-talk@mailman.uni-konstanz.de basex-talk@mailman.uni-konstanz.de; Nikhil Sethi nsethi@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.
No, our xquery can be simple or complex depend on customer requirement, it is not our control.
So it’s completely another party that is generating the client queries?
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.
By default, your database must be contained in the path argument of fn:doc call as well. By enabling the DEFAULTDB option, however, your path will first be resolved against a database that has been opened in the global context. See [1] for more information on accessing databases resources with BaseX.
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.
Charles Foster may have enabled the DEFAULTDB option in his driver, so that may be the reason why XQJ deviates from the standard behavior of BaseX.
[1] https://urldefense.com/v3/__https://docs.basex.org/wiki/Databases__;!!Obbck6...
So did you try my suggestion to enable DEFAULTDB?
On Tue, Aug 18, 2020 at 1:17 PM Srikumar Choudhury schoudhu@opentext.com wrote:
I have tried below test but it did not help. it throw error message.
String xQuery = "for $article in doc('6301904f80000114/0601904f80007547.xml') return $article";
xqPreparedExpr = m_conn.createExpression(); String comamnd = "OPEN " + docbasename; xqPreparedExpr.executeCommand(comamnd); resultSeq = xqPreparedExpr.executeQuery(xQuery);
Thanks, Srikumar
From: Srikumar Choudhury schoudhu@opentext.com Sent: Tuesday, August 18, 2020 3:49 PM To: Christian Grün christian.gruen@gmail.com Cc: basex-talk@mailman.uni-konstanz.de basex-talk@mailman.uni-konstanz.de; Nikhil Sethi nsethi@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.
So it’s completely another party that is generating the client queries? Srikumar>> yes it is another component, which generate query, we do not have control on it.
By default, your database must be contained in the path argument of fn:doc call as well. By enabling the DEFAULTDB option, however, your path will first be resolved against a database that has been opened in the global context. See [1] for more information on accessing databases resources with BaseX. Srikumar>> yes if I will modify the doc xquery and passed database name, it is working fine. For example: for $article in doc('JunitDocbaseDB/6301904f80000114/0601904f80007547.xml') return $article"
I will try one more option like open database just before running xquery. java code: ======== String xQuery = "for $article in doc('6301904f80000114/0601904f80007547.xml') return $article";
xqPreparedExpr = m_conn.prepareExpression(xQuery); xqPreparedExpr.executeCommand("OPEN " + "JunitDocbaseDB"); resultSeq = xqPreparedExpr.executeQuery();
Thanks, Srikumar
From: Christian Grün christian.gruen@gmail.com Sent: Tuesday, August 18, 2020 3:18 PM To: Srikumar Choudhury schoudhu@opentext.com Cc: basex-talk@mailman.uni-konstanz.de basex-talk@mailman.uni-konstanz.de; Nikhil Sethi nsethi@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.
No, our xquery can be simple or complex depend on customer requirement, it is not our control.
So it’s completely another party that is generating the client queries?
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.
By default, your database must be contained in the path argument of fn:doc call as well. By enabling the DEFAULTDB option, however, your path will first be resolved against a database that has been opened in the global context. See [1] for more information on accessing databases resources with BaseX.
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.
Charles Foster may have enabled the DEFAULTDB option in his driver, so that may be the reason why XQJ deviates from the standard behavior of BaseX.
[1] https://urldefense.com/v3/__https://docs.basex.org/wiki/Databases__;!!Obbck6...
I have tried with below code, but it did not work. Is it correct to way to set this option?? Is there any other way to set DEFAULTDB? or I am missing something.
XQDataSource xqs = new BaseXXQDataSource(); xqs.setLogWriter(new PrintWriter(System.out, true)); xqs.setProperty("serverName", m_address); xqs.setProperty("port", m_port); if(m_databaseName != null) { xqs.setProperty("databaseName", m_databaseName); System.setProperty("DEFAULTDB", "true"); } xqs.setProperty("user", m_administratorName);
XQStaticContext xqsc; try { m_conn = (XQConnection2) xqs.getConnection(m_administratorName, password);
Thanks, Srikumar
________________________________ From: Christian Grün christian.gruen@gmail.com Sent: Tuesday, August 18, 2020 4:51 PM To: Srikumar Choudhury schoudhu@opentext.com Cc: basex-talk@mailman.uni-konstanz.de basex-talk@mailman.uni-konstanz.de; Nikhil Sethi nsethi@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.
So did you try my suggestion to enable DEFAULTDB?
On Tue, Aug 18, 2020 at 1:17 PM Srikumar Choudhury schoudhu@opentext.com wrote:
I have tried below test but it did not help. it throw error message.
String xQuery = "for $article in doc('6301904f80000114/0601904f80007547.xml') return $article";
xqPreparedExpr = m_conn.createExpression(); String comamnd = "OPEN " + docbasename; xqPreparedExpr.executeCommand(comamnd); resultSeq = xqPreparedExpr.executeQuery(xQuery);
Thanks, Srikumar
From: Srikumar Choudhury schoudhu@opentext.com Sent: Tuesday, August 18, 2020 3:49 PM To: Christian Grün christian.gruen@gmail.com Cc: basex-talk@mailman.uni-konstanz.de basex-talk@mailman.uni-konstanz.de; Nikhil Sethi nsethi@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.
So it’s completely another party that is generating the client queries? Srikumar>> yes it is another component, which generate query, we do not have control on it.
By default, your database must be contained in the path argument of fn:doc call as well. By enabling the DEFAULTDB option, however, your path will first be resolved against a database that has been opened in the global context. See [1] for more information on accessing databases resources with BaseX. Srikumar>> yes if I will modify the doc xquery and passed database name, it is working fine. For example: for $article in doc('JunitDocbaseDB/6301904f80000114/0601904f80007547.xml') return $article"
I will try one more option like open database just before running xquery. java code: ======== String xQuery = "for $article in doc('6301904f80000114/0601904f80007547.xml') return $article";
xqPreparedExpr = m_conn.prepareExpression(xQuery); xqPreparedExpr.executeCommand("OPEN " + "JunitDocbaseDB"); resultSeq = xqPreparedExpr.executeQuery();
Thanks, Srikumar
From: Christian Grün christian.gruen@gmail.com Sent: Tuesday, August 18, 2020 3:18 PM To: Srikumar Choudhury schoudhu@opentext.com Cc: basex-talk@mailman.uni-konstanz.de basex-talk@mailman.uni-konstanz.de; Nikhil Sethi nsethi@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.
No, our xquery can be simple or complex depend on customer requirement, it is not our control.
So it’s completely another party that is generating the client queries?
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.
By default, your database must be contained in the path argument of fn:doc call as well. By enabling the DEFAULTDB option, however, your path will first be resolved against a database that has been opened in the global context. See [1] for more information on accessing databases resources with BaseX.
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.
Charles Foster may have enabled the DEFAULTDB option in his driver, so that may be the reason why XQJ deviates from the standard behavior of BaseX.
[1] https://urldefense.com/v3/__https://docs.basex.org/wiki/Databases__;!!Obbck6...
I also tried below option, but it is not working. it throw same error message. C:\Srikumar\Software\BaseX\BaseX941\basex>java -Dorg.basex.DEFAULTDB=true -cp basex.jar org.basex.BaseX -c"get DEFAULTDB" DEFAULTDB: true
Then run the xquery using java program. Thanks, Srikumar
________________________________ From: Srikumar Choudhury Sent: Tuesday, August 18, 2020 5:33 PM To: Christian Grün christian.gruen@gmail.com Cc: basex-talk@mailman.uni-konstanz.de basex-talk@mailman.uni-konstanz.de; Nikhil Sethi nsethi@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.
I have tried with below code, but it did not work. Is it correct to way to set this option?? Is there any other way to set DEFAULTDB? or I am missing something.
XQDataSource xqs = new BaseXXQDataSource(); xqs.setLogWriter(new PrintWriter(System.out, true)); xqs.setProperty("serverName", m_address); xqs.setProperty("port", m_port); if(m_databaseName != null) { xqs.setProperty("databaseName", m_databaseName); System.setProperty("DEFAULTDB", "true"); } xqs.setProperty("user", m_administratorName);
XQStaticContext xqsc; try { m_conn = (XQConnection2) xqs.getConnection(m_administratorName, password);
Thanks, Srikumar
________________________________ From: Christian Grün christian.gruen@gmail.com Sent: Tuesday, August 18, 2020 4:51 PM To: Srikumar Choudhury schoudhu@opentext.com Cc: basex-talk@mailman.uni-konstanz.de basex-talk@mailman.uni-konstanz.de; Nikhil Sethi nsethi@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.
So did you try my suggestion to enable DEFAULTDB?
On Tue, Aug 18, 2020 at 1:17 PM Srikumar Choudhury schoudhu@opentext.com wrote:
I have tried below test but it did not help. it throw error message.
String xQuery = "for $article in doc('6301904f80000114/0601904f80007547.xml') return $article";
xqPreparedExpr = m_conn.createExpression(); String comamnd = "OPEN " + docbasename; xqPreparedExpr.executeCommand(comamnd); resultSeq = xqPreparedExpr.executeQuery(xQuery);
Thanks, Srikumar
From: Srikumar Choudhury schoudhu@opentext.com Sent: Tuesday, August 18, 2020 3:49 PM To: Christian Grün christian.gruen@gmail.com Cc: basex-talk@mailman.uni-konstanz.de basex-talk@mailman.uni-konstanz.de; Nikhil Sethi nsethi@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.
So it’s completely another party that is generating the client queries? Srikumar>> yes it is another component, which generate query, we do not have control on it.
By default, your database must be contained in the path argument of fn:doc call as well. By enabling the DEFAULTDB option, however, your path will first be resolved against a database that has been opened in the global context. See [1] for more information on accessing databases resources with BaseX. Srikumar>> yes if I will modify the doc xquery and passed database name, it is working fine. For example: for $article in doc('JunitDocbaseDB/6301904f80000114/0601904f80007547.xml') return $article"
I will try one more option like open database just before running xquery. java code: ======== String xQuery = "for $article in doc('6301904f80000114/0601904f80007547.xml') return $article";
xqPreparedExpr = m_conn.prepareExpression(xQuery); xqPreparedExpr.executeCommand("OPEN " + "JunitDocbaseDB"); resultSeq = xqPreparedExpr.executeQuery();
Thanks, Srikumar
From: Christian Grün christian.gruen@gmail.com Sent: Tuesday, August 18, 2020 3:18 PM To: Srikumar Choudhury schoudhu@opentext.com Cc: basex-talk@mailman.uni-konstanz.de basex-talk@mailman.uni-konstanz.de; Nikhil Sethi nsethi@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.
No, our xquery can be simple or complex depend on customer requirement, it is not our control.
So it’s completely another party that is generating the client queries?
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.
By default, your database must be contained in the path argument of fn:doc call as well. By enabling the DEFAULTDB option, however, your path will first be resolved against a database that has been opened in the global context. See [1] for more information on accessing databases resources with BaseX.
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.
Charles Foster may have enabled the DEFAULTDB option in his driver, so that may be the reason why XQJ deviates from the standard behavior of BaseX.
[1] https://urldefense.com/v3/__https://docs.basex.org/wiki/Databases__;!!Obbck6...
I have tried with below code, but it did not work. Is it correct to way to set this option?? Is there any other way to set DEFAULTDB?
XQDataSource xqs = new BaseXXQDataSource(); ... System.setProperty("DEFAULTDB", "true");
The property key needs to be prefixed with 'org.basex.', and I would recommend you to set this property as early as possible (i.e., before the BaseXXQDataSource instance is created). See [1] for more information on how to set options with BaseX.
I remember there also was a way to set options via XQJ, but I can’t tell you off-hand how the corresponding method was called.
Hi Christian, I have tested below code but it is not working.
System.setProperty("org.basex.DEFAULTDB", "true"); XQDataSource xqs = new BaseXXQDataSource();
and xquery is: String xQuery = "for $article in doc('6301904f80000114/0601904f80007547.xml') return $article"; it is not working. Thanks, Srikumar ________________________________ From: Christian Grün christian.gruen@gmail.com Sent: Tuesday, August 18, 2020 10:09 PM To: Srikumar Choudhury schoudhu@opentext.com Cc: basex-talk@mailman.uni-konstanz.de basex-talk@mailman.uni-konstanz.de; Nikhil Sethi nsethi@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.
I have tried with below code, but it did not work. Is it correct to way to set this option?? Is there any other way to set DEFAULTDB?
XQDataSource xqs = new BaseXXQDataSource(); ... System.setProperty("DEFAULTDB", "true");
The property key needs to be prefixed with 'org.basex.', and I would recommend you to set this property as early as possible (i.e., before the BaseXXQDataSource instance is created). See [1] for more information on how to set options with BaseX.
I remember there also was a way to set options via XQJ, but I can’t tell you off-hand how the corresponding method was called.
[1] https://urldefense.com/v3/__https://docs.basex.org/wiki/Options__;!!Obbck6kT...
I have tested below code but it is not working.
System.setProperty("org.basex.DEFAULTDB", "true"); XQDataSource xqs = new BaseXXQDataSource();
What do you get if you run the following XQuery expression?
db:system()//defaultdb
I have tried following steps:
C:\Srikumar\Software\BaseX\BaseX941\basex>java -Dorg.basex.DEFAULTDB=true -cp basex.jar org.basex.BaseX -c"get DEFAULTDB" DEFAULTDB: true
C:\Srikumar\Software\BaseX\BaseX941\basex>cd bin
C:\Srikumar\Software\BaseX\BaseX941\basex\bin>basex BaseX 9.4.1 [Standalone] Try 'help' to get more information.
XQUERY for $article in doc('6301904f80000114/0601904f80007547.xml') return $article
Stopped at ., 1/20: [FODC0002] Resource 'C:/Srikumar/Software/BaseX/BaseX941/basex/bin/6301904f80000114/0601904f80007547.xml' does not exist.
XQUERY db:system()//defaultdb
<defaultdb>false</defaultdb> Query executed in 37.99 ms.
exit
See you.
Thanks, Srikumar ________________________________ From: Christian Grün christian.gruen@gmail.com Sent: Friday, August 21, 2020 4:24 PM To: Srikumar Choudhury schoudhu@opentext.com Cc: basex-talk@mailman.uni-konstanz.de basex-talk@mailman.uni-konstanz.de; Nikhil Sethi nsethi@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.
I have tested below code but it is not working.
System.setProperty("org.basex.DEFAULTDB", "true"); XQDataSource xqs = new BaseXXQDataSource();
What do you get if you run the following XQuery expression?
db:system()//defaultdb
Let’s stick with one variant:
What do you get if you run the following XQuery expression?
…in your XQJ code?
C:\Srikumar\Software\BaseX\BaseX941\basex>java -Dorg.basex.DEFAULTDB=true -cp basex.jar org.basex.BaseX -c"get DEFAULTDB" DEFAULTDB: true
C:\Srikumar\Software\BaseX\BaseX941\basex\bin>basex BaseX 9.4.1 [Standalone] Try 'help' to get more information.
…this can’t work, as properties won’t be persisted, i.e., won’t be available in future BaseX instances. If you want that, you can add the option in your .basex configuration file (see the Wiki document that I have referenced earlier).
basex-talk@mailman.uni-konstanz.de