I am having a problem performing an XUpdate operation from within a
servlet.

SCENARIO:
I have no problem accessing the addressbook collection from the command
line like:

----------------------------------
xindice -c xmldb:xindice:///db   

  system
  addressbook

Total collections: 2
----------------------------------

or using XPath from the command line like this:
----------------------------------
xindice xpath -c xmldb:xindice:///db/addressbook -q "*"

<fname src:col="/db/addressbook"
src:key="1601a7c01f9fdabb000000f18b1010db" xmln
s:src="http://xml.apache.org/xindice/Query";>Gerry</fname>
<lname src:col="/db/addressbook"
src:key="1601a7c01f9fdabb000000f18b1010db" xmln
s:src="http://xml.apache.org/xindice/Query";>Reno</lname>
<phone src:col="/db/addressbook"
src:key="1601a7c01f9fdabb000000f18b1010db" type
="work"
xmlns:src="http://xml.apache.org/xindice/Query";>999-999-9999</phone>
<phone src:col="/db/addressbook"
src:key="1601a7c01f9fdabb000000f18b1010db" type
="home"
xmlns:src="http://xml.apache.org/xindice/Query";>888-888-8888</phone>
<phone src:col="/db/addressbook"
src:key="1601a7c01f9fdabb000000f18b1010db" type
="cell"
xmlns:src="http://xml.apache.org/xindice/Query";>777-777-7777</phone>
<email src:col="/db/addressbook"
src:key="1601a7c01f9fdabb000000f18b1010db" type
="home"
xmlns:src="http://xml.apache.org/xindice/Query";>[EMAIL PROTECTED]</email>
<email src:col="/db/addressbook"
src:key="1601a7c01f9fdabb000000f18b1010db" type
="work"
xmlns:src="http://xml.apache.org/xindice/Query";>[EMAIL PROTECTED]</email>
<address src:col="/db/addressbook"
src:key="1601a7c01f9fdabb000000f18b1010db" ty
pe="home" xmlns:src="http://xml.apache.org/xindice/Query";>123456 Home
St.</addre
ss>
<address src:col="/db/addressbook"
src:key="1601a7c01f9fdabb000000f18b1010db" ty
pe="work" xmlns:src="http://xml.apache.org/xindice/Query";>987654 Work
St.</addre
ss>
----------------------------------

The problem is when I use the exact same syntax to try and perform an
XUpdate operation from a servlet I get a 'connection refused' response.

passing URI: "xmldb:xindice:///db/addressbook" in test servlet to my
bean I get:

XML:DB Exception occured 1 1 A connection to the Database instance 'db'
could not be created. Error: Connection refused: connect
----------------------------------
my bean code for xupdate: (called from servlet)
XUpdate modification doc and collection uri string are passed as args.

public class XUpdate {
   protected static Database database = null;
   protected static Collection col = null;

   public static void xupdate(String xupdatedoc, String colstring)
throws Exception {
      try {
         if ( database == null ) {
                String driver =
"org.apache.xindice.client.xmldb.DatabaseImpl";
                Class c = Class.forName(driver);
         
                Database database = (Database) c.newInstance();
                DatabaseManager.registerDatabase(database);
                col = DatabaseManager.getCollection(colstring); 
         }
         XUpdateQueryService service =
            (XUpdateQueryService) col.getService("XUpdateQueryService",
"1.0");
         service.update(xupdatedoc);
      }
       catch(ClassNotFoundException e)
       {
           System.err.println("ClassNotFoundException occured " + e);
           e.printStackTrace();
       } catch (XMLDBException e) {
         System.err.println("XML:DB Exception occured " + e.errorCode +
" " + e.vendorErrorCode + " " + e.getMessage() );
      }
      finally {
         if (col != null) {
            col.close();
         }
      }
   }
}
----------------------------------

Does anyone have an XUpdate operation working from within a JSP or
servlet?  Can you tell me what URI makes it work?

Thanks,
Gerry Reno


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus � Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

Reply via email to