Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

eXist

  Asked By: Claude    Date: Jul 28    Category: Java    Views: 602
  

if I work with eXist, can i do all works in XML DB Such as select, Update, Delete and Insert with it? I don't need to SAX, DOM, JDOM,XSLT and ....?
do you know any link or pdf files or ... that can help me to Understand eXist and can work easily with this?

Share: 

 

3 Answers Found

 
Answer #1    Answered By: Daisy Phillips     Answered On: Jul 28

I am new to exist  and i find some code for importing exist servlet and i have sme code for
retrieving xml  from DB,


import org.xmldb.api.base.*;
import org.xmldb.api.modules.*;
import org.xmldb.api.*;
public class Example1 {
public static void main(String[] args) throws Exception {
Collection col = null;
try {
String driver = "org.dbxml.client.xmldb.DatabaseImpl";
Class c = Class.forName(driver);

Database database = (Database) c.newInstance();
DatabaseManager.registerDatabase(database);
col =
DatabaseManager.getCollection("xmldb:dbxml:///db/addresses");

String xpath = "/address[@id = 1]";
XPathQueryService service =
(XPathQueryService) col.getService("XPathQueryService", "1.0");
ResourceSet resultSet = service.query(xpath);
ResourceIterator results = resultSet.getIterator();

while (results.hasMoreResources()) {
Resource res = results.nextResource();
System.out.println((String) res.getContent());
}
}
catch (XMLDBException e) {
System.err.println("XML:DB Exception occurred " + e.errorCode + " " +
e.getMessage());
}
finally {
if (col != null) {
col.close();
}}}}
but i want to know how can i update  my xml doc? for updating my doc i must execute some query like this:
for $address in //address
return
(: Move lname and fname into a new name element :)
update replace $address with
<address>
<name>
<family>{$address/lname/text()}</family>
<given>{$address/fname/text()}</given>
</name>
{$address/city, $address/email}
</address>
or this:
<xupdate:modifications version="1.0"
xmlns:xupdate="http://www.xmldb.org/xupdate">
<xupdate:update select="/address[@id = 1]/name/last">Herman</xupdate:update>
</xupdate:modifications>

what is the difference beween two types? how can i do this work?

 
Answer #2    Answered By: Keiko Mori     Answered On: Jul 28

I downloaded jar file of eXist-1.0.2-rev5396 and installed this with command: java -jar eXist-1.0.2-rev5396.jar and after that ran exist  with clicking on "exist database startup" on desktop and then i could easily import this class:
import org.xmldb.api.*;
import org.xmldb.api.base.*;
import org.xmldb.api.modules.*;
to the my web application(my servlets). but after that when i want to import this class in other application after running jetty servlet ("exist database startup"), i couldn't add this class to that application. can anybody help  me?

 
Answer #3    Answered By: Code Guru     Answered On: Jul 28

when i start my exist  jetty server first time its run properly but after shutdown it, when i start this server again,in the middle of running servlet this error appeare: (exist is a xmlbd)

File lock last access timestamp: Oct 15, 2007 D:\Program Files\eXist\webapp\WEB-
INF\data\dbx_dir.lck
Found a stale lockfile. Trying to remove it: D:\Program Files\eXist\webapp\WEB-
INF\data\dbx_dir.lck
configuration error: The database directory seems to be locked by another databa
se instance. Found a valid lock file: D:\Program Files\eXist\webapp\WEB-INF\data
\dbx_dir.lck
org.exist.EXistException: The database directory seems to be locked by another d
atabase instance. Found a valid lock file: D:\Program Files\eXist\webapp\WEB-INF
\data\dbx_dir.lck

but i shutdown last process in this port! how can i solve this problem?

 
Didn't find what you were looking for? Find more on eXist Or get search suggestion and latest updates.




Tagged: