After a couple of weeks of fighting with Tamino’s Java APIs to do node level insertions, I have come to the following comments. Please, if someone here finds my assertions to be wrong, PLEASE post your comments.
- App. Server: I am using Tomcat 4.0.2 (Catalina) running on a Windows 2000 Professional machine. Running Java 1.4 and Xerces 2.0. Clients connect using http port 8080, no proxying.
- DB Server: Tamino on Windows 2000 Server, SP2, single CPU machine. Running Tamino 184.108.40.206 using IIS.
What I did: tried both ways of node insertion in a document that I already have in the database.
The document I have is about 343,783 bytes. The inserted node is about 42K.
Had Tamino installed and after reading the QA guide posted by Bill Leeney found that I was using an old version of MS XML. Installed MS XML 4.0 (guide says it will work with any version later than 3.0). – this is important, read section for Java HTTP API –
Using Java API:
Tamino DOESN’T support node level insertions using the Java API, therefore you have to get the entire document, insert your node and then send the entire document back to the server.
In my setup it took 3375 ms. to insert 43,476 bytes. This is the time elapsed to insert the node in memory and update+commit it on the server.
Using Java HTTP API:
Using this method, you call appendChild on the TaminoClient class. You must give a document and an XPath. The following are suggestions that may save you many many hours of work:
- NodeLevelUpdate.dll doesn’t work with MS XML 4.0. It works only with MS XML 3.0. If you have ver. 4.0 it will rise an Unhandled Exception and will kill inetinfo.exe; killing your connectionwith the client (client will show a connection refused exception). So use MS XML 3.0 SP2.
- You MUST use docuverse implementation when appending a node in your document. The reason for this is because the API uses the Node.toString() method to send the XML over the network. If you use xerces, you will be sending [nodename:null] over, which will not work. So, get your node, re-parse it and create an instance of a docuverse document and use this instance to send it to the server. Not sure if that is a DOM Level 2 vs. Level 1 problem. Docuverse doesn’t support importNode method, therefore you have to convert your XML in a String and re-parse it using docuverse implementation. Any suggestions?
- For me, it didn’t work using the root access (/) for the XPath, I had to use the indirect access (//) method. That means that an xpath of /Data didn’t work for me, I had to use //Data; which in theory is less efficient.
- If you run into troube, use TaminoClient.setTrace(true) method and you will see what is being sent to the server over HTTP.
- When I was querying a wrong document I didn’t get any answer from the server, just an empty response. So I guess that when there is an error, you receive nothing.
In my setup, it took about 3,364 ms. to store 42,239 bytes using appendChild. This is the time it took between the appendChild + commit operations on TaminoClient.
- The document sizes are measured as the size of their string representation.
- Since you can go either way, what would happen if a connection is inserting a child using HTTP API and another instance is trying to query the document using the Java API?; does the NodeUpdate DLL block the database document and puts the server on hold until the whole insert operation ends? Is that controlled by the transaction?
- What would happen if two different App. servers (say, in a cluster) try to update the same document at the same time using the Java API (not the nodeUpdate)?
To me, it is very important to have node-level access to update or insert in an existing document. I think it is the basic required functionality from a DB. Hopefully SAG will provide this pretty soon as said in some postings.