http server and client mode
Wednesday, 16 May 2012 · 10 messages · last reply 21 May 2012
GC
Gilles CARRY16 May 2012 15:37 #
Hello,
I cannot set the http server to use a distant DB.
In the restxq.xqm file, I always get
Using this:
let $count := (count(db:open('logs')/top/session))
in restxq.xqm, I always get the error:
Stopped at line 15, column 38 in /usr/share/tomcat/webapps/BaseX72/restxq.xqm: [BASX0003] Database 'logs' not found.
On the web browser.
Using a CLI from a distant server, I can access the 'logs' DB.
The
db:list() instruction returns nothing.
In web.xml, I set org.basex.mode to "client" and "host" to the IP of my DB server. Something I don't understand is that in the below output (db:system()) I can see that "host" is present whereas "mode" is not. Credential are OK.
Any clue?
When in "client" mode, is "dbpath" useful?
Thanks,
Gilles.<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE top PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<top>
<system>
<generalinformation>
<version>7.2</version>
<usedmemory>21887 KB</usedmemory>
</generalinformation>
<mainoptions>
<dbpath>/home/basex/BaseXData</dbpath>
<debug>true</debug>
<eventport>1985</eventport>
<host>10.129.63.129</host>
<httppath>/usr/share/tomcat/webapps/BaseX72/</httppath>
<httpport>8984</httpport>
<keepalive>0</keepalive>
<lang>English</lang>
<langkeys>false</langkeys>
<nonproxyhosts></nonproxyhosts>
<parallel>8</parallel>
<port>1984</port>
<proxyhost></proxyhost>
<proxyport>80</proxyport>
<repopath>/usr/share/tomcat/webapps/BaseX72//repo</repopath>
<serverhost></serverhost>
<serverport>1984</serverport>
<stopport>8985</stopport>
<timeout>0</timeout>
</mainoptions>
<options>
<addarchives>true</addarchives>
<addraw>false</addraw>
<attrindex>true</attrindex>
<autoflush>true</autoflush>
<bindings></bindings>
<cachequery>false</cachequery>
<casesens>false</casesens>
<catfile></catfile>
<chop>true</chop>
<compplan>true</compplan>
<createfilter>*.xml</createfilter>
<diacritics>false</diacritics>
<dotcompact>false</dotcompact>
<dotdisplay>true</dotdisplay>
<dotplan>false</dotplan>
<dotty>dotty</dotty>
<dtd>false</dtd>
<exporter></exporter>
<forcecreate>false</forcecreate>
<ftindex>false</ftindex>
<htmlopt>html=false,omit-xml-declaration=false,method=xml,nons=false,nobogons=false,nodefaults=false,nocolons=false,norestart=false,ignorable=false,emptybogons=false,any=false,norootbogons=false,nocdata=false,lexical=false,encoding=utf-8</htmlopt>
<intparse>true</intparse>
<language>en</language>
<lserror>0</lserror>
<mainmem>false</mainmem>
<maxcats>100</maxcats>
<maxhits>-1</maxhits>
<maxlen>96</maxlen>
<maxstat>30</maxstat>
<parser>xml</parser>
<parseropt>encoding=UTF-8,flat=false,format=verbose,header=false,jsonml=false,lines=true,separator=comma</parseropt>
<pathindex>true</pathindex>
<queryinfo>false</queryinfo>
<querypath></querypath>
<runs>1</runs>
<scoring>0</scoring>
<serialize>true</serialize>
<serializer></serializer>
<skipcorrupt>false</skipcorrupt>
<stemming>false</stemming>
<stopwords></stopwords>
<tailcalls>42</tailcalls>
<textindex>true</textindex>
<updindex>false</updindex>
<wildcards>false</wildcards>
<writeback>false</writeback>
<xmlplan>false</xmlplan>
<xquery3>true</xquery3>
</options>
</system>
</top>DP
Dimitar Popov16 May 2012 19:09 #
Quoted text · 15:37:16 · 6 lines
Am Mittwoch, 16. Mai 2012, 15:37:16 schrieb Gilles CARRY: > Hello, > > I cannot set the http server to use a distant DB. > > In the restxq.xqm file, I always get
AFAIK, the current implementation of RESTXQ cannot connect to a remote DB server instance.
Regards,
Dimitar
PR
Philippe Rathé17 May 2012 03:52 #
Then do we need to run a BaseXServer using RESTXQ?
Quoted text · Dimitar Popov · 18 lines
On Wed, May 16, 2012 at 1:09 PM, Dimitar Popov <Dimitar.Popov at uni-konstanz.de> wrote: > Am Mittwoch, 16. Mai 2012, 15:37:16 schrieb Gilles CARRY: >> Hello, >> >> I cannot set the http server to use a distant DB. >> >> In the restxq.xqm file, I always get > > AFAIK, the current implementation of RESTXQ cannot connect to a > remote DB server instance. > > Regards, > Dimitar > _______________________________________________ > BaseX-Talk mailing list > BaseX-Talk at mailman.uni-konstanz.de > https://mailman.uni-konstanz.de/mailman/listinfo/basex-talk
DP
Dimitar Popov17 May 2012 12:59 #
Quoted text · 19:52:45 · 2 lines
Am Mittwoch, 16. Mai 2012, 19:52:45 schrieb Philippe Rathé: > Then do we need to run a BaseXServer using RESTXQ?
No, you don't need to run a separate BaseXServer if you want to use RESTXQ, since as already said, RESTXQ in BaseX can
access only local databases (or at least that is what I'm aware of).
Regards,
Dimitar
GC
Though, whenever httpserver (via restxq) tries to reach the DB, the distant server log shows these lines: 17:00:10.384 [10.129.63.247:45084] LOGIN log OK
17:00:11.623 [10.129.63.247:45084] LOGOUT log OK
'log' is the user name.
But that's all.
Gilles.
Quoted text · Dimitar Popov · 19 lines
> -----Original Message----- > From: Dimitar Popov [mailto:Dimitar.Popov at uni-konstanz.de] > Sent: mercredi 16 mai 2012 19:10 > To: basex-talk at mailman.uni-konstanz.de > Cc: Gilles CARRY > Subject: Re: [basex-talk] http server and client mode > > Am Mittwoch, 16. Mai 2012, 15:37:16 schrieb Gilles CARRY: > > Hello, > > > > I cannot set the http server to use a distant DB. > > > > In the restxq.xqm file, I always get > > AFAIK, the current implementation of RESTXQ cannot connect to a remote > DB server instance. > > Regards, > Dimitar
CG
Christian Grün18 May 2012 16:51 #
Hi Gilles,
Quoted text · Gilles CARRY · 3 lines
> Though, whenever httpserver (via restxq) tries to reach the DB, the distant server log shows these lines: > 17:00:10.384 [10.129.63.247:45084] LOGIN log OK > 17:00:11.623 [10.129.63.247:45084] LOGOUT log OK
I couldn't reprouce this issue; how do you communicate with the BaseX server? Christian
GC
Gilles CARRY21 May 2012 09:56 #
Hi Christian,
The http server (10.129.63.247) is run in a Tomcat framework. The DB instance is on a distant server (10.129.63.129).
I set the "client" mode and host address in WEB-INF/web.xml. It seems to reach the server as I get the below mentioned logs. However,
db:list() returns an empty string and db:open('logs') fails. db:system() does not show anything about the client mode wherease the host address is properly set.
I'm not sure this is clear enough for you. Tell me if you need more.
Thanks,
BR,
Gilles.Quoted text · Christian Grün · 17 lines
> -----Original Message----- > From: Christian Grün [mailto:christian.gruen at gmail.com] > Sent: vendredi 18 mai 2012 16:52 > To: Gilles CARRY > Cc: basex-talk at mailman.uni-konstanz.de > Subject: Re: [basex-talk] http server and client mode > > Hi Gilles, > > > Though, whenever httpserver (via restxq) tries to reach the DB, the distant > server log shows these lines: > > 17:00:10.384 [10.129.63.247:45084] LOGIN log OK > > 17:00:11.623 [10.129.63.247:45084] LOGOUT log OK > > I couldn't reprouce this issue; how do you communicate with the BaseX > server? > Christian
CG
Christian Grün21 May 2012 12:44 #
Hi Gilles,
yes, the reason is in fact the "client" mode, which is not supported by RESTXQ, but which will still connect to the server because of WebDAV and REST. In a nutshell: if you use RESTXQ, you should (at least for the moment) use the default or local mode.
Christian
Quoted text · Gilles CARRY · 34 lines
On Mon, May 21, 2012 at 9:56 AM, Gilles CARRY <gilles.carry at st.com> wrote: > Hi Christian, > > The http server (10.129.63.247) is run in a Tomcat framework. > The DB instance is on a distant server (10.129.63.129). > I set the "client" mode and host address in WEB-INF/web.xml. It seems to reach the server as I get the below mentioned logs. > However, db:list() returns an empty string and db:open('logs') fails. > db:system() does not show anything about the client mode wherease the host address is properly set. > > I'm not sure this is clear enough for you. Tell me if you need more. > > Thanks, > BR, > Gilles. > > > >> -----Original Message----- >> From: Christian Grün [mailto:christian.gruen at gmail.com] >> Sent: vendredi 18 mai 2012 16:52 >> To: Gilles CARRY >> Cc: basex-talk at mailman.uni-konstanz.de >> Subject: Re: [basex-talk] http server and client mode >> >> Hi Gilles, >> >> > Though, whenever httpserver (via restxq) tries to reach the DB, the distant >> server log shows these lines: >> > 17:00:10.384 [10.129.63.247:45084] LOGIN log OK >> > 17:00:11.623 [10.129.63.247:45084] LOGOUT log OK >> >> I couldn't reprouce this issue; how do you communicate with the BaseX >> server? >> Christian
GC
Gilles CARRY21 May 2012 12:58 #
Ok.
This is not very good news for us.
Do you think it is big deal to modify Restxq in order to support client mode? If no, I may try to patch the code if I have a clue where to start looking at. Which code area shall investigate? (So far, I never put my hands into Basex code)
Thanks,
Gilles.
Quoted text · Christian Grün · 54 lines
> -----Original Message----- > From: Christian Grün [mailto:christian.gruen at gmail.com] > Sent: lundi 21 mai 2012 12:44 > To: Gilles CARRY > Cc: basex-talk at mailman.uni-konstanz.de > Subject: Re: [basex-talk] http server and client mode > > Hi Gilles, > > yes, the reason is in fact the "client" mode, which is not supported by > RESTXQ, but which will still connect to the server because of WebDAV and > REST. In a nutshell: if you use RESTXQ, you should (at least for the moment) > use the default or local mode. > > Christian > ___________________________ > > On Mon, May 21, 2012 at 9:56 AM, Gilles CARRY <gilles.carry at st.com> wrote: > > Hi Christian, > > > > The http server (10.129.63.247) is run in a Tomcat framework. > > The DB instance is on a distant server (10.129.63.129). > > I set the "client" mode and host address in WEB-INF/web.xml. It seems to > reach the server as I get the below mentioned logs. > > However, db:list() returns an empty string and db:open('logs') fails. > > db:system() does not show anything about the client mode wherease the > host address is properly set. > > > > I'm not sure this is clear enough for you. Tell me if you need more. > > > > Thanks, > > BR, > > Gilles. > > > > > > > >> -----Original Message----- > >> From: Christian Grün [mailto:christian.gruen at gmail.com] > >> Sent: vendredi 18 mai 2012 16:52 > >> To: Gilles CARRY > >> Cc: basex-talk at mailman.uni-konstanz.de > >> Subject: Re: [basex-talk] http server and client mode > >> > >> Hi Gilles, > >> > >> > Though, whenever httpserver (via restxq) tries to reach the DB, the > >> > distant > >> server log shows these lines: > >> > 17:00:10.384 [10.129.63.247:45084] LOGIN log OK > >> > 17:00:11.623 [10.129.63.247:45084] LOGOUT log OK > >> > >> I couldn't reprouce this issue; how do you communicate with the BaseX > >> server? > >> Christian
CG
Christian Grün21 May 2012 13:10 #
Hi Gilles,
Quoted text · Gilles CARRY · 1 line
> Do you think it is big deal to modify Restxq in order to support client mode?
I'm afraid that's probably a bigger issue, as the interpretation of the client request is tightly coupled with the query evaluation process. However, the RESTXQ code itself is pretty compact, so you are invited to have a look at the code base:
https://github.com/BaseXdb/basex-api/tree/master/src/main/java/org/basex/http/restxq
Best,
Christian
Written for BaseX 7.2. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery