You are viewing a plain text version of this content. The canonical link for it is here.
Posted to xindice-dev@xml.apache.org by Kam Lai Wong <kl...@hkem.com> on 2002/10/17 05:29:33 UTC
Driver problem (Urgent)
Hi all,
I am now facing the driver problem. I use java programming to connect to xindice database. Here is my file..
package xindSearch.util;
import org.xmldb.api.base.*;
import org.xmldb.api.modules.*;
import org.xmldb.api.*;
public class XinDB{
public ResourceSet getResultSet(String collection, String xql) throws Exception{
ResourceSet resultSet = null;
Collection col = null;
try{
String driver = "org.apache.xindice.client.xmldb.DatabaseImpl";
Class c = Class.forName(driver);
Database database = (Database) c.newInstance();
DatabaseManager.registerDatabase(database);
String collectionName = "xmldb:xindice:///db/"+collection;
System.out.println(collectionName);
col = DatabaseManager.getCollection(collectionName);
XPathQueryService service = (XPathQueryService) col.getService("XPathQueryService", "1.0");
resultSet = service.query(xql);
}catch (XMLDBException e){
System.err.println("XML:DB Exception occured " + e.errorCode);
}catch(Exception e){
System.err.println("Exception occured " + e.getMessage());
}
finally{
if (col != null){
col.close();
}
return resultSet;
}
}
}
I expect it will turn out the ResourceSet after I give my collection name and my xpath. However it throws Excpetion with this.. "Exception occured org.apache.xindice.client.xmldb.DatabaseImpl". What's wrong with the driver?
______________________________________________________
HKDict - the latest and easy to use Online Dictionary
http://www.hkdict.com