Am Donnerstag, 24. Mai 2012, 06:59:34 schrieb Anupam Bakshi:
Hello, I have not been able to find a way to connect from a Servlet to the BaseX running in Tomcat .
What I want to do is run BaseX in Tomcat (using the .war file) and have a Servlet connect to it.
Any pointers will be greatly appreciated.
Best regards, Anupam
From: Anupam Bakshi bakshia@yahoo.com To: "basex-talk@mailman.uni-konstanz.de" basex-talk@mailman.uni-konstanz.de Sent: Tuesday, May 22, 2012 2:21 PM Subject: Question about Servlet accessing BaseX
Hello,
I'm creating my first BaseX based app and have a few questions about the best possible way to architect it around BaseX.
I need to use BaseX as a service in a Tomcat container on the same server machine. I have the following doubts:
I need to validate the XML coming into the database and do XSLT transformation. Should this be done in a servlet that connects to BaseX?
If so, should the servlet use REST too, or is there a better way for direct connection?
Since BaseX is running in Tomcat context, is it possible to access it using a local client on the server machine- for debug etc on the server machine?
Thank you for your help.
Best regards, Anupam
Hi Anupam,
BaseX WAR is a web application which provides WebDAV, REST, and RESTXQ interfaces to access your databases. You cannot "connect to it" using either XQJ or the BaseX Client Java API [1].
If your sole purpose is to access XML databases stored in BaseX from a Servlet, then you don't need BaseX WAR. You have two options: 1) use BaseX as an embedded database server in your Servlet or 2) use a separate BaseX Database Server which you can access using the BaseX Client Java API or XQJ.
If you need one of the 3 listed web services (WebDAV, REST, or RESTXQ), and simultaneously access the databases from your Servlet, then your only option is to start a separate BaseX Database Server (which you can access from your servlet using 2) from the previous paragraph) and configure the BaseX Web Application to use this server as described in our wiki [2] (note: this option will be removed in the next version of BaseX so you may want to remain with 7.2.1).
I hope this is helpful.
Regards, Dimitar
[1] http://docs.basex.org/wiki/Clients [2] http://docs.basex.org/wiki/Web_Application