are you running you java code on the same machine where Xindice is
installed?

what error msg or exception are you getting?


In Peace,
Saqib Ali
http://www.seagate.com/cheetah/


|---------+--------------------------->
|         |           "Jeremie hattat"|
|         |           <Jeremie.hattat@|
|         |           orange.fr>      |
|         |           No Phone Info   |
|         |           Available       |
|         |                           |
|         |           04/02/2003 06:15|
|         |           AM              |
|         |           Please respond  |
|         |           to xindice-users|
|         |                           |
|---------+--------------------------->
  
>-------------------------------------------------------------------------------------------------------------------------------|
  |                                                                             
                                                  |
  |        To:      "xindice-users" <[email protected]>              
                                                  |
  |        cc:                                                                  
                                                  |
  |        Subject: Re: PB : url to connect xindice started on tomcat           
                                                  |
  
>-------------------------------------------------------------------------------------------------------------------------------|




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







Reply via email to