xml-xindice-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jeremie hattat" <Jeremie.hat...@orange.fr>
Subject Re: PB : url to connect xindice started on tomcat
Date Wed, 02 Apr 2003 14:15:18 GMT
thanks Saqib,

I'll try to clearly explain my problem in spite of my poor english (sorry).

I've got a tomcat, including the xindice.war.
I try from an external java programm to connect the database running under tomcat : 

import org.xmldb.api.base.*;
import org.xmldb.api.modules.*;
import org.xmldb.api.*;

public class myUpdate {
   public static void main(String[] args) throws Exception {
      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);
	try{
	 col = DatabaseManager.getCollection("xmldb:xindice://jeremie:8888/db/adressbook");
         System.out.println("La collection est : "+col);
        }catch(Exception e){
        	System.out.println(e.toString()+" ");
        	e.printStackTrace();
        	System.exit(1);
        }

         String xpath = "//person[fname = 'fname1']";
         
         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();
         }
      }
   }
}

the url ("xmldb:xindice://jeremie:8888/db/adressbook") is the one i used when i was running
the standalone server with the command :
$xindice start in the c:\%XINDICE_HOME%\ directory

Now i'd like to interact with the database running under tomcat...

I've already tried the url you propose but it does'nt work...

I hope you'll anderstood my problem...

Jeremie



Mime
View raw message