In my use of this call, I have "xmldb:xmldb:...
col = DatabaseManager.getCollection("xmldb:xindice:///db/myexamples");
Yours don't match. That is the difference that I see.
I am using dbXML 1.04b (Mustard).
I've created
the collection and added a few documents. I've queried the collection
from the command line and get the right results. I'm no trying to
do the same thing from a Java program to get to grips with the XML:DB Api.
The code I'm using is below. Any ideas where I'm going wrong will
be gratefully received. Cheers Richard import
org.xmldb.api.base.*;
import org.xmldb.api.modules.*;
import org.xmldb.api.*; public
class ConnectToDbxml {
/** */
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:xindice:///db/myexamples");
String xpath = "/person";
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 occured " + e.errorCode);
}
finally {
if (col != null) {
col.close();
}
}
}
}
----- Original Message -----
Sent: Tuesday, February 05, 2002 5:39
PM
Subject: Re: exception error code
It means something didn't work :-). I don't mean that
in a bad way,
I think you get that error for many different types of problems.
Have you created the collection "myexamples"?
Try
dbxmladmin lc -c /db
It should list your collections.
Try "getting" one of the ones that are in the list.
HTH,
Mark
Richard Featherstone wrote:
Hi
Hope someone can help In
a Java program I try and call
col = DatabaseManager.getCollection("xmldb:dbxml:///db/myexamples");
and I get
XML:DB EXCEPTION: occured 1 can
anyone tell me what error code 1 is so I can try to trace the problem
Cheers Richard