Berkeley XML DB
Hi,
is the Berkeley XML DB available as a 100% Java edition, like the Berkeley DB? I've only seen a Java API for the C/C++ version of Berkeley XML DB via JNI.
Günther
Günther,
No, it is not. It's only available using JNI.
Regards,
George
Similar Messages
-
Need help with Berkeley XML DB Performance
We need help with maximizing performance of our use of Berkeley XML DB. I am filling most of the 29 part question as listed by Oracle's BDB team.
Berkeley DB XML Performance Questionnaire
1. Describe the Performance area that you are measuring? What is the
current performance? What are your performance goals you hope to
achieve?
We are measuring the performance while loading a document during
web application startup. It is currently taking 10-12 seconds when
only one user is on the system. We are trying to do some testing to
get the load time when several users are on the system.
We would like the load time to be 5 seconds or less.
2. What Berkeley DB XML Version? Any optional configuration flags
specified? Are you running with any special patches? Please specify?
dbxml 2.4.13. No special patches.
3. What Berkeley DB Version? Any optional configuration flags
specified? Are you running with any special patches? Please Specify.
bdb 4.6.21. No special patches.
4. Processor name, speed and chipset?
Intel Xeon CPU 5150 2.66GHz
5. Operating System and Version?
Red Hat Enterprise Linux Relase 4 Update 6
6. Disk Drive Type and speed?
Don't have that information
7. File System Type? (such as EXT2, NTFS, Reiser)
EXT3
8. Physical Memory Available?
4GB
9. Are you using Replication (HA) with Berkeley DB XML? If so, please
describe the network you are using, and the number of Replica’s.
No
10. Are you using a Remote Filesystem (NFS) ? If so, for which
Berkeley DB XML/DB files?
No
11. What type of mutexes do you have configured? Did you specify
–with-mutex=? Specify what you find inn your config.log, search
for db_cv_mutex?
None. Did not specify -with-mutex during bdb compilation
12. Which API are you using (C++, Java, Perl, PHP, Python, other) ?
Which compiler and version?
Java 1.5
13. If you are using an Application Server or Web Server, please
provide the name and version?
Oracle Appication Server 10.1.3.4.0
14. Please provide your exact Environment Configuration Flags (include
anything specified in you DB_CONFIG file)
Default.
15. Please provide your Container Configuration Flags?
final EnvironmentConfig envConf = new EnvironmentConfig();
envConf.setAllowCreate(true); // If the environment does not
// exist, create it.
envConf.setInitializeCache(true); // Turn on the shared memory
// region.
envConf.setInitializeLocking(true); // Turn on the locking subsystem.
envConf.setInitializeLogging(true); // Turn on the logging subsystem.
envConf.setTransactional(true); // Turn on the transactional
// subsystem.
envConf.setLockDetectMode(LockDetectMode.MINWRITE);
envConf.setThreaded(true);
envConf.setErrorStream(System.err);
envConf.setCacheSize(1024*1024*64);
envConf.setMaxLockers(2000);
envConf.setMaxLocks(2000);
envConf.setMaxLockObjects(2000);
envConf.setTxnMaxActive(200);
envConf.setTxnWriteNoSync(true);
envConf.setMaxMutexes(40000);
16. How many XML Containers do you have? For each one please specify:
One.
1. The Container Configuration Flags
XmlContainerConfig xmlContainerConfig = new XmlContainerConfig();
xmlContainerConfig.setTransactional(true);
xmlContainerConfig.setIndexNodes(true);
xmlContainerConfig.setReadUncommitted(true);
2. How many documents?
Everytime the user logs in, the current xml document is loaded from
a oracle database table and put it in the Berkeley XML DB.
The documents get deleted from XML DB when the Oracle application
server container is stopped.
The number of documents should start with zero initially and it
will grow with every login.
3. What type (node or wholedoc)?
Node
4. Please indicate the minimum, maximum and average size of
documents?
The minimum is about 2MB and the maximum could 20MB. The average
mostly about 5MB.
5. Are you using document data? If so please describe how?
We are using document data only to save changes made
to the application data in a web application. The final save goes
to the relational database. Berkeley XML DB is just used to store
temporary data since going to the relational database for each change
will cause severe performance issues.
17. Please describe the shape of one of your typical documents? Please
do this by sending us a skeleton XML document.
Due to the sensitive nature of the data, I can provide XML schema instead.
18. What is the rate of document insertion/update required or
expected? Are you doing partial node updates (via XmlModify) or
replacing the document?
The document is inserted during user login. Any change made to the application
data grid or other data components gets saved in Berkeley DB. We also have
an automatic save every two minutes. The final save from the application
gets saved in a relational database.
19. What is the query rate required/expected?
Users will not be entering data rapidly. There will be lot of think time
before the users enter/modify data in the web application. This is a pilot
project but when we go live with this application, we will expect 25 users
at the same time.
20. XQuery -- supply some sample queries
1. Please provide the Query Plan
2. Are you using DBXML_INDEX_NODES?
Yes.
3. Display the indices you have defined for the specific query.
XmlIndexSpecification spec = container.getIndexSpecification();
// ids
spec.addIndex("", "id", XmlIndexSpecification.PATH_NODE | XmlIndexSpecification.NODE_ATTRIBUTE | XmlIndexSpecification.KEY_EQUALITY, XmlValue.STRING);
spec.addIndex("", "idref", XmlIndexSpecification.PATH_NODE | XmlIndexSpecification.NODE_ATTRIBUTE | XmlIndexSpecification.KEY_EQUALITY, XmlValue.STRING);
// index to cover AttributeValue/Description
spec.addIndex("", "Description", XmlIndexSpecification.PATH_EDGE | XmlIndexSpecification.NODE_ELEMENT | XmlIndexSpecification.KEY_SUBSTRING, XmlValue.STRING);
// cover AttributeValue/@value
spec.addIndex("", "value", XmlIndexSpecification.PATH_EDGE | XmlIndexSpecification.NODE_ATTRIBUTE | XmlIndexSpecification.KEY_EQUALITY, XmlValue.STRING);
// item attribute values
spec.addIndex("", "type", XmlIndexSpecification.PATH_EDGE | XmlIndexSpecification.NODE_ATTRIBUTE | XmlIndexSpecification.KEY_EQUALITY, XmlValue.STRING);
// default index
spec.addDefaultIndex(XmlIndexSpecification.PATH_NODE | XmlIndexSpecification.NODE_ELEMENT | XmlIndexSpecification.KEY_EQUALITY, XmlValue.STRING);
spec.addDefaultIndex(XmlIndexSpecification.PATH_NODE | XmlIndexSpecification.NODE_ATTRIBUTE | XmlIndexSpecification.KEY_EQUALITY, XmlValue.STRING);
// save the spec to the container
XmlUpdateContext uc = xmlManager.createUpdateContext();
container.setIndexSpecification(spec, uc);
4. If this is a large query, please consider sending a smaller
query (and query plan) that demonstrates the problem.
21. Are you running with Transactions? If so please provide any
transactions flags you specify with any API calls.
Yes. READ_UNCOMMITED in some and READ_COMMITTED in other transactions.
22. If your application is transactional, are your log files stored on
the same disk as your containers/databases?
Yes.
23. Do you use AUTO_COMMIT?
No.
24. Please list any non-transactional operations performed?
No.
25. How many threads of control are running? How many threads in read
only mode? How many threads are updating?
We use Berkeley XML DB within the context of a struts web application.
Each user logged into the web application will be running a bdb transactoin
within the context of a struts action thread.
26. Please include a paragraph describing the performance measurements
you have made. Please specifically list any Berkeley DB operations
where the performance is currently insufficient.
We are clocking 10-12 seconds of loading a document from dbd when
five users are on the system.
getContainer().getDocument(documentName);
27. What performance level do you hope to achieve?
We would like to get less than 5 seconds when 25 users are on the system.
28. Please send us the output of the following db_stat utility commands
after your application has been running under "normal" load for some
period of time:
% db_stat -h database environment -c
% db_stat -h database environment -l
% db_stat -h database environment -m
% db_stat -h database environment -r
% db_stat -h database environment -t
(These commands require the db_stat utility access a shared database
environment. If your application has a private environment, please
remove the DB_PRIVATE flag used when the environment is created, so
you can obtain these measurements. If removing the DB_PRIVATE flag
is not possible, let us know and we can discuss alternatives with
you.)
If your application has periods of "good" and "bad" performance,
please run the above list of commands several times, during both
good and bad periods, and additionally specify the -Z flags (so
the output of each command isn't cumulative).
When possible, please run basic system performance reporting tools
during the time you are measuring the application's performance.
For example, on UNIX systems, the vmstat and iostat utilities are
good choices.
Will give this information soon.
29. Are there any other significant applications running on this
system? Are you using Berkeley DB outside of Berkeley DB XML?
Please describe the application?
No to the first two questions.
The web application is an online review of test questions. The users
login and then review the items one by one. The relational database
holds the data in xml. During application load, the application
retrieves the xml and then saves it to bdb. While the user
is making changes to the data in the application, it writes those
changes to bdb. Finally when the user hits the SAVE button, the data
gets saved to the relational database. We also have an automatic save
every two minues, which saves bdb xml data and saves it to relational
database.
Thanks,
Madhav
[email protected]Could it be that you simply do not have set up indexes to support your query? If so, you could do some basic testing using the dbxml shell:
milu@colinux:~/xpg > dbxml -h ~/dbenv
Joined existing environment
dbxml> setverbose 7 2
dbxml> open tv.dbxml
dbxml> listIndexes
dbxml> query { collection()[//@date-tip]/*[@chID = ('ard','zdf')] (: example :) }
dbxml> queryplan { collection()[//@date-tip]/*[@chID = ('ard','zdf')] (: example :) }Verbosity will make the engine display some (rather cryptic) information on index usage. I can't remember where the output is explained; my feeling is that "V(...)" means the index is being used (which is good), but that observation may not be accurate. Note that some details in the setVerbose command could differ, as I'm using 2.4.16 while you're using 2.4.13.
Also, take a look at the query plan. You can post it here and some people will be able to diagnose it.
Michael Ludwig -
Berkeley Xml 2.4.13 works on Tomcat but not on Glassfish
I recently upgraded my web app to using the latest version of Berkeley Xml from 2.3. The old version worked fine on both glassfish and tomcat java servers.
When I upgraded and made the necessary modifications to my app I could not get it to work on glassfish but had no problems on tomcat.
This error happens in the beginning of start up when I call the XmlManager constructor. I am clueless as to what it is because I can not recreate it on anything else but glassfish v2. I even created a new project and played around with some options.
Here is part of the stack trace:
DB errno:0
The log message is null.
com.sleepycat.dbxml.XmlException: Uncaught exception from C++ API, errcode = INTERNAL_ERROR
at com.sleepycat.dbxml.dbxml_javaJNI.new_XmlManager(Native Method)
at com.sleepycat.dbxml.XmlManager.<init>(XmlManager.java:56)
For now I am going to just use tomcat, but I would really like to know what is going on for both peace of mind and because I like some of the features of glassfish.
Not sure if this matters but I am deploying the web app through netbeans 6 for both glassfish and tomcat.
Thanks in advance for any help.I don't think it is a library path problem. The java.library.path shows the right values. I did have it working fine on the previous version of berkeley xml. I did have a version mismatch problem but I deleted the other database. I did have problems uninstalling the old database and I had to do it manually (the uninstall was hanging). Maybe I didn't clean it up correctly. My confusion is if I didn't clean it up correctly why does it work on everything else but glassfish.
Thanks for your help. -
Hi,
I read that Berkeley XML DB is an XML database which uses the Berkeley DB as the actual storage engine.
Berkeley DB itself is available as a binary in either C/C++ or as a 100% Java lib which can nicely be used via maven.
Now I had thought, that there is also a 100% Java version of Berkeley XML DB which just sits on top of the Berkeley DB Java version as its backend. Instead it seems that the Java API to the XML DB is actually using the C/C++ Version of Berkeley DB via JNI calls.
Is that correct?
GüntherGünther,
Sorry this post was unanswered for so long. You're understanding is correct -- Berkeley DB XML's core is written in C++ and uses the Berkeley DB C engine for storage. The Java API for Berkeley DB XML is implemented on the C++ code using JNI.
There is no 100% Java version of Berkeley DB XML.
George -
Using Berkeley XML DB in a servlet
h2. Problem:
I have a servlet using Berkeley XML DB as listed in the code snippet below. For simplicity I have removed the exception handling from the code snippet. When I invoke the servlet several times, the memory usage goes high and gets released only when the application is undeployed i.e when the destroy() method is called.
h2. Questions:
1. Is this the best way to use Berkeley XML DB in a servlet?
2. What other techniques can be adopted to release memory held by XmlManager, XmlContainer and Environment?
Please help!
Thanks,
Madhav
h2. Code Snippet:
public class MyServlet extends HttpServlet {
String containerName = "mycontainer";
String content = "<hello>Hello World</hello>";
String environmentDir = ".";
XmlManager mgr = null;
XmlContainer cont = null;
Environment env = null;
public void init(ServletConfig config) throws ServletException {
EnvironmentConfig config = new EnvironmentConfig();
env = new Environment( new File(envHome), config);
XmlManagerConfig mconfig = new XmlManagerConfig();
mgr = new XmlManager(env, mconfig);
XmlContainerConfig cconfig = new XmlContainerConfig();
cont = mgr.createContainer(containerName, cconfig);
public void destroy() {
try {
if (cont != null)
cont.delete();
if (mgr != null)
mgr.delete();
if (env != null)
env.close();
} catch (Exception e) {
// ignore exceptions in cleanup
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException {
for (int i =; i < 5000; i++) {
XmlTransaction txn = mgr.createTransaction();
cont.putDocument(txn, newDocName, content);
txn.commit();
}Hi,
I guess you posted not all code since I can't see for example configuring an environment for transaction support.
Is your servlet doing only what is described in the doGet() method?
Did you try to launch a stand-alone application and execute method doGet() multiple times? What happens with memory?
Maybe you are using in-memory logging?
Vyacheslav
UPD: Probably you don't want to create and commit a txn for every small document. Grouping some of documents in the scope of a single transaction might help. I'm not sure about memory, but in terms of efficiency it's faster
Edited by: detonator413 on Nov 13, 2009 11:38 PM
Edited by: detonator413 on Nov 14, 2009 12:38 AM -
Loading large XMLs to Berkeley XML DB
Hi all ,
I am trying to load a very big XML file to Berkeley XML DB from unix shell. I have created a container of type node storage with node index. It is taking around 15 minutes to load the document. My system configuration is 64GB RAM and 2 CPU each with 4 cores.It is very much require for me to use node storage with indexing for best xquery performanceIs there a way to improvise the loading performance ?Hi,
DB XML is an embeddable database that means that it is supposed to be integrated into your application that in turn takes care about communication with client. That means if you want the server-client architecture you wouldn't have to take care of it yourself. For example, writing a Java servlet that under the hood connects locally to DB XML and does necessary stuff. If I remember correctly, there was one example (in the DB XML examples) that implements a servlet, but I have never look into it.
Vyacheslav -
Error in compiling Berkeley xml database sample...
hi,
I try a sample code found in "Apress- The Definitive Guide to Berkeley DB XML"
here is the code:
#include <iostream>
#include "dbxml\DbXml.hpp"
using namespace std;
using namespace DbXml;
int tmain(int argc, TCHAR* argv[])
XmlManager myManager;
try
XmlContainer myContainer =
myManager.openContainer("Customers.dbxml");
catch (XmlException &xe)
cout << xe.what() << endl;
return 0;
and it gives me this errors...
Error 1 error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall DbXml::XmlManager::~XmlManager(void)" (__imp_??1XmlManager@DbXml@@QAE@XZ) referenced in function __catch$_wmain$0 BerkeleyDemo.obj
Error 2 error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall DbXml::XmlContainer::~XmlContainer(void)" (__imp_??1XmlContainer@DbXml@@QAE@XZ) referenced in function _wmain BerkeleyDemo.obj
Error 3 error LNK2019: unresolved external symbol "__declspec(dllimport) public: class DbXml::XmlContainer __thiscall DbXml::XmlManager::openContainer(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_?openContainer@XmlManager@DbXml@@QAE?AVXmlContainer@2@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) referenced in function _wmain BerkeleyDemo.obj
Error 4 error LNK2019: unresolved external symbol "__declspec(dllimport) public: __thiscall DbXml::XmlManager::XmlManager(void)" (__imp_??0XmlManager@DbXml@@QAE@XZ) referenced in function _wmain BerkeleyDemo.obj
Error 5 fatal error LNK1120: 4 unresolved externals
What am I doing wrong??BTW my OS is window Vista...is Vista compatible to berkeley db xml??I added all the required path in m references path but still it give me that error
This is all that I've included in my reference
C:\Program Files\Oracle\Berkeley DB XML 2.3.10\bin
C:\Program Files\Oracle\Berkeley DB XML 2.3.10\xerces-c-src\src\xercesc
C:\Program Files\Oracle\Berkeley DB XML 2.3.10\db-4.5.20\build_windows
C:\Program Files\Oracle\Berkeley DB XML 2.3.10\include
C:\Program Files\Oracle\Berkeley DB XML 2.3.10\include\dbxml
and it gives this error...
Error 1 error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall DbXml::XmlManager::~XmlManager(void)" (__imp_??1XmlManager@DbXml@@QAE@XZ) BerkeleyDemo.obj
Error 2 error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall DbXml::XmlContainer::~XmlContainer(void)" (__imp_??1XmlContainer@DbXml@@QAE@XZ) BerkeleyDemo.obj
Error 3 error LNK2001: unresolved external symbol "__declspec(dllimport) public: class DbXml::XmlContainer __thiscall DbXml::XmlManager::openContainer(class std::basic_string<char,struct std::char_traits<char>,class std::allocator<char> > const &)" (__imp_?openContainer@XmlManager@DbXml@@QAE?AVXmlContainer@2@ABV?$basic_string@DU?$char_traits@D@std@@V?$allocator@D@2@@std@@@Z) BerkeleyDemo.obj
Error 4 error LNK2001: unresolved external symbol "__declspec(dllimport) public: __thiscall DbXml::XmlManager::XmlManager(void)" (__imp_??0XmlManager@DbXml@@QAE@XZ) BerkeleyDemo.obj
Error 5 fatal error LNK1120: 4 unresolved externals C:\Users\angel\Documents\Visual Studio 2005\Projects\BerkeleyDemo\Debug\BerkeleyDemo.exe
Message was edited by:
user582959 -
Hi,
berkeley xml db version: dbxml-2.5.16
I currently have a job (in java) which creates a container and inserts anywhere between 1,000 - 25,000 documents while the container is open and then closes container.
I have 5-15 separate processes that kick off an instance this job and each job inserts documents into separate containers(ie pid1 - container A, pid2 - container B, pid3 - container C etc).
The problem occurs randomly to any process with any one of the below errors:
1) com.sleepycat.dbxml.XmlException: Error: No such file or directory, errcode = DATABASE_ERROR
2) com.sleepycat.dbxml.XmlException: Error: Permission denied File: ../src/dbxml/nodeStore/NsEventReader.cpp Line: 829, errcode = DATABASE_ERROR
The odd thing about receiving the above errors is that when the processes are kicked off again, it goes through fine.
a snippet of the environment configuration:
BerkeleyErrorHandler berkeleyerrorhandler = new BerkeleyErrorHandler();
EnvironmentConfig environmentConfig = new EnvironmentConfig();
environmentConfig.setErrorHandler(berkeleyerrorhandler);
environmentConfig.setAllowCreate(true);
environmentConfig.setInitializeCache(true);
environmentConfig.setInitializeLocking(true);
environmentConfig.setCacheSize(255 * 1024 * 1024);
environmentConfig.setThreaded(true);
Insertion of document:
String xmlDocument
xmlContainer.putDocument(docName, xmlDocument);
Java heap size: -Xmx2g
Ram: 256G
O.S.: SunOS 5.10Hello,
The, "Build signature doesn't match environment" error indicates
that you are using an environment created by a different different
version of BDB than the one you installed. Is there an older
environment in /var/www/html/modules/lib that something is
picking up? Or do you have a PATH pointing to another one?
Thank you,
Sandra -
Performance question on small XML content but with large volume
Hi all,
I am new to Berkeley XML DB.
I have the following simple XML content:
<s:scxml xmlns:s="http://www.w3.org/2005/07/scxml">
<s:state id="a"/>
<s:state id="b"/>
<s:state id="c"/>
</s:scxml>
about 1.5K bytes each but the total number of such content is large (5 million+ records).
This is a typical query:
query 'count(collection("test.dbxml")/s:scxml/s:state[@id="a"]/following-sibling::s:state[@id="e"])'
where the id attribute is used heavily.
I've tested with about 10000 records with the following indexes:
Index: edge-attribute-equality-string for node {}:id
Index: unique-node-metadata-equality-string for node {http://www.sleepycat.com/2002/dbxml}:name
Index: edge-element-presence-none for node {}:scxml
Index: edge-element-presence-none for node {}:state
but the query took just under one minute to complete. Is this the expected performance? It seems slow. Is there anyway to speed it up?
In addition, the total size of the XML content is about 12M but ~100M of data is generated with the log.xxxxxxxxxx files. Is this expected?
Thanks.Hi Ron,
Yes, I've noticed the URI issue after sending the post and changed them to:
dbxml> listindex
Default Index: none
Index: edge-attribute-equality-string for node {http://www.w3.org/2005/07/scxml}
:id
Index: unique-node-metadata-equality-string for node {http://www.sleepycat.com/2
002/dbxml}:name
Index: edge-element-presence-none for node {http://www.w3.org/2005/07/scxml}:scx
ml
Index: edge-element-presence-none for node {http://www.w3.org/2005/07/scxml}:sta
te
5 indexes found.
I added more records (total ~30000) but the query still took ~1 minute and 20 seconds to run. Here is the query plan:
dbxml> queryplan 'count(collection("test.dbxml")/s:scxml/s:state[@id="start"]/fo
llowing-sibling::s:state[@id="TryToTransfer"])'
<XQuery>
<Function name="{http://www.w3.org/2005/xpath-functions}:count">
<DocumentOrder>
<DbXmlNav>
<QueryPlanFunction result="collection" container="test.dbxml">
<OQPlan>n(P(edge-element-presence-none,=,root:http://www.sleepycat.com
/2002/dbxml.scxml:http://www.w3.org/2005/07/scxml),P(edge-element-presence-none,
=,scxml:http://www.w3.org/2005/07/scxml.state:http://www.w3.org/2005/07/scxml))<
/OQPlan>
</QueryPlanFunction>
<DbXmlStep axis="child" prefix="s" uri="http://www.w3.org/2005/07/scxml"
name="scxml" nodeType="element"/>
<DbXmlStep axis="child" prefix="s" uri="http://www.w3.org/2005/07/scxml"
name="state" nodeType="element"/>
<DbXmlFilter>
<DbXmlCompare name="equal" join="attribute" name="id" nodeType="attrib
ute">
<Sequence>
<AnyAtomicTypeConstructor value="start" typeuri="http://www.w3.org
/2001/XMLSchema" typename="string"/>
</Sequence>
</DbXmlCompare>
</DbXmlFilter>
<DbXmlStep axis="following-sibling" prefix="s" uri="http://www.w3.org/20
05/07/scxml" name="state" nodeType="element"/>
<DbXmlFilter>
<DbXmlCompare name="equal" join="attribute" name="id" nodeType="attrib
ute">
<Sequence>
<AnyAtomicTypeConstructor value="TryToTransfer" typeuri="http://ww
w.w3.org/2001/XMLSchema" typename="string"/>
</Sequence>
</DbXmlCompare>
</DbXmlFilter>
</DbXmlNav>
</DocumentOrder>
</Function>
</XQuery>
I've noticed the indexes with URI were not used so I added back the indexes without URI:
dbxml> listindex
Default Index: none
Index: edge-attribute-equality-string for node {}:id
Index: edge-attribute-equality-string for node {http://www.w3.org/2005/07/scxml}
:id
Index: unique-node-metadata-equality-string for node {http://www.sleepycat.com/2
002/dbxml}:name
Index: edge-element-presence-none for node {}:scxml
Index: edge-element-presence-none for node {http://www.w3.org/2005/07/scxml}:scx
ml
Index: edge-element-presence-none for node {}:state
Index: edge-element-presence-none for node {http://www.w3.org/2005/07/scxml}:sta
te
8 indexes found.
Here is the query plan with the above indexes:
dbxml> queryplan 'count(collection("test.dbxml")/s:scxml/s:state[@id="start"]/fo
llowing-sibling::s:state[@id="TryToTransfer"])'
<XQuery>
<Function name="{http://www.w3.org/2005/xpath-functions}:count">
<DocumentOrder>
<DbXmlNav>
<QueryPlanFunction result="collection" container="test.dbxml">
<OQPlan>n(P(edge-element-presence-none,=,root:http://www.sleepycat.com
/2002/dbxml.scxml:http://www.w3.org/2005/07/scxml),P(edge-element-presence-none,
=,scxml:http://www.w3.org/2005/07/scxml.state:http://www.w3.org/2005/07/scxml),V
(edge-attribute-equality-string,state:http://www.w3.org/2005/07/scxml.@id,=,'sta
rt'),V(edge-attribute-equality-string,state:http://www.w3.org/2005/07/scxml.@id,
=,'TryToTransfer'))</OQPlan>
</QueryPlanFunction>
<DbXmlStep axis="child" prefix="s" uri="http://www.w3.org/2005/07/scxml"
name="scxml" nodeType="element"/>
<DbXmlStep axis="child" prefix="s" uri="http://www.w3.org/2005/07/scxml"
name="state" nodeType="element"/>
<DbXmlFilter>
<DbXmlCompare name="equal" join="attribute" name="id" nodeType="attrib
ute">
<Sequence>
<AnyAtomicTypeConstructor value="start" typeuri="http://www.w3.org
/2001/XMLSchema" typename="string"/>
</Sequence>
</DbXmlCompare>
</DbXmlFilter>
<DbXmlStep axis="following-sibling" prefix="s" uri="http://www.w3.org/20
05/07/scxml" name="state" nodeType="element"/>
<DbXmlFilter>
<DbXmlCompare name="equal" join="attribute" name="id" nodeType="attrib
ute">
<Sequence>
<AnyAtomicTypeConstructor value="TryToTransfer" typeuri="http://ww
w.w3.org/2001/XMLSchema" typename="string"/>
</Sequence>
</DbXmlCompare>
</DbXmlFilter>
</DbXmlNav>
</DocumentOrder>
</Function>
</XQuery>
The indexes are used in this case and the execution time was reduced to about 40 seconds. I set the namespace with setNamespace when the session is created. Is this the reason why the indexes without URI are used?
Any other performance improvement hints?
Thanks,
Ken -
Is it possible to use xml publisher with xml document as data source ?
I have an application that have to publish document from xml document that are not part a oracle 10g database but will be stored into Oracle Berkeley XML database insteed. Is it possible to use server and/or desktop to publish these documents ?
I test the desktop edition using the source xml document but it render no data when the template is executed (vizualization)
I installed the server edition and i'm not able to declare xml document as a data source
So i have a doubt that xml publisher is able to publish something from a xml datasource
ThanksYes, it is possible.
The problem should come from your template. Refer to "edit a RTF template" in the docs.
A fact is that XML Publisher server edition is not very adapted to an XML file datasource. In order to use it, you should use an HTTP datasource, with the URL of your XML document (that you should place on a web server...). The problem is that this URL is fixed and point always on the same reference...so XML Publisher server edition is not very good for that use.
I choose to use the XML Publisher Java API which is better for this task. -
How does XDB optimize XML Query?
I found the query speed of XDB is much slower than Berkeley XML DB.
How does XDB optimize XML Query?
Are there any documents on this subject?
And can XDB create indices on XMLType ( e.g. the index on element/attribute value and/or structure index)? if yes, how to do that?lezhou had a valid question and asked about:
"I found the query speed of XDB is much slower than Berkeley XML DB"
"How does XDB optimize XML Query?"
These point to a "XML DB Concepts Guide", which does not yet exist.
The procedures are explained, the methods are explained. If you enable event tracing as described in the XMLDB Developers Guide 10gR2, you will see statements in your trace file which will tell you more about the XML DB architecture (and therefor you can deduct performance impact) then the manual will reveal.
An other example:
The xdbconfig.xsd file is neatly explained - in regards of http-port-etc
But not what the implecations are if you alter one of the other ones (the not explained parameters).
If you know the architecture (GROUND LEVEL), you can give an correct answer to the initial question "I found the query speed of XDB is much slower than Berkeley XML DB. How does XDB optimize XML Query?"
The balanced tree index is constructed the same way (on the same theory) in Oracle, DB2, but apparantly X is faster because in with the same buildup/architecture/databasestructure for both products, with the same data, with the same X --> value Y is beter constructed and delivers a better performance.
apples = apples
oracle xmldb = berkeley xmldb --> how can i test the o.apples=b.apples and that under these circumstances o.apples are faster ;-)
THEREFOR:
"I have to disagree a little bit...("It speaks about all these in detail").
Still waiting for the XMLDB Concepts Guide / Administrators Guide / Performance Guide. -
Getting realistic performance expectations.
I am running tests to see if I can use the Oracle Berkeley XML database as a backend to a web application but am running into query response performance limitations. As per the suggestions for performance related questions, I have pulled together answers to the series of questions that need to be addressed, and they are given below. The basic issue at stake, however, is am I being realistic about what I can expect to achieve with the database?
Regards
Geoff Shuetrim
Oracle Berkeley DB XML database performance.
Berkeley DB XML Performance Questionnaire
1. Describe the Performance area that you are measuring? What is the
current performance? What are your performance goals you hope to
achieve?
I am using the database as a back end to a web application that is expected
to field a large number of concurrent queries.
The database scale is described below.
Current performance involves responses to simple queries that involve 1-2
minute turn around (this improves after a few similar queries have been run,
presumably because of caching, but not to a point that is acceptable for
web applications).
Desired performance is for queries to execute in milliseconds rather than
minutes.
2. What Berkeley DB XML Version? Any optional configuration flags
specified? Are you running with any special patches? Please specify?
Berkeley DB XML Version: 2.4.16.1
Configuration flags: enable-java -b 64 prefix=/usr/local/BerkeleyDBXML-2.4.16
No special patches have been applied.
3. What Berkeley DB Version? Any optional configuration flags
specified? Are you running with any special patches? Please Specify.
Berkeley DB Version? 4.6.21
Configuration flags: None. The Berkeley DB was built and installed as part of the
Oracle Berkeley XML database build and installation process.
No special patches have been applied.
4. Processor name, speed and chipset?
Intel Core 2 CPU 6400 @ 2.13 GHz (1066 FSB) (4MB Cache)
5. Operating System and Version?
Ubuntu Linux 8.04 (Hardy) with the 2.6.24-23 generic kernel.
6. Disk Drive Type and speed?
300 GB 7200RPM hard drive.
7. File System Type? (such as EXT2, NTFS, Reiser)
EXT3
8. Physical Memory Available?
Memory: 3.8GB DDR2 SDRAM
9. Are you using Replication (HA) with Berkeley DB XML? If so, please
describe the network you are using, and the number of Replica’s.
No.
10. Are you using a Remote Filesystem (NFS) ? If so, for which
Berkeley DB XML/DB files?
No.
11. What type of mutexes do you have configured? Did you specify
–with-mutex=? Specify what you find inn your config.log, search
for db_cv_mutex?
I did not specify -with-mutex when building the database.
config.log indicates:
db_cv_mutex=POSIX/pthreads/library/x86_64/gcc-assembly
12. Which API are you using (C++, Java, Perl, PHP, Python, other) ?
Which compiler and version?
I am using the Java API.
I am using the gcc 4.2.4 compiler.
I am using the g++ 4.2.4 compiler.
13. If you are using an Application Server or Web Server, please
provide the name and version?
I am using the Tomcat 5.5 application server.
It is not using the Apache Portable Runtime library.
It is being run using a 64 bit version of the Sun Java 1.5 JRE.
14. Please provide your exact Environment Configuration Flags (include
anything specified in you DB_CONFIG file)
I do not have a DB_CONFIG file in the database home directory.
My environment configuration is as follows:
Threaded = true
AllowCreate = true
InitializeLocking = true
ErrorStream = System.err
InitializeCache = true
Cache Size = 1024 * 1024 * 500
InitializeLogging = true
Transactional = false
TrickleCacheWrite = 20
15. Please provide your Container Configuration Flags?
My container configuration is done using the Java API.
The container creation code is:
XmlContainerConfig containerConfig = new XmlContainerConfig();
containerConfig.setStatisticsEnabled(true);
XmlContainer container = xmlManager.createContainer("container",containerConfig);I am guessing that this means that the only flag I have set is the one
that enables recording of statistics to use in query optimization.
I have no other container configuration information to provide.
16. How many XML Containers do you have?
I have one XML container.
The container has 2,729,465 documents.
The container is a node container rather than a wholedoc container.
Minimum document size is around 1Kb.
Maximum document size is around 50Kb.
Average document size is around 2Kb.
I am using document data as part of the XQueries being run. For
example, I condition query results upon the values of attributes
and elements in the stored documents.
The database has the following indexes:
xmlIndexSpecification = dataContainer.getIndexSpecification();
xmlIndexSpecification.replaceDefaultIndex("node-element-presence");
xmlIndexSpecification.addIndex(Constants.XBRLAPINamespace,"fragment","node-element-presence");
xmlIndexSpecification.addIndex(Constants.XBRLAPINamespace,"data","node-element-presence");
xmlIndexSpecification.addIndex(Constants.XBRLAPINamespace,"xptr","node-element-presence");
xmlIndexSpecification.addIndex("","stub","node-attribute-presence");
xmlIndexSpecification.addIndex("","index", "unique-node-attribute-equality-string");
xmlIndexSpecification.addIndex(Constants.XBRL21LinkNamespace,"label","node-element-substring-string");
xmlIndexSpecification.addIndex(Constants.GenericLabelNamespace,"label","node-element-substring-string");
xmlIndexSpecification.addIndex("","name","node-attribute-substring-string");
xmlIndexSpecification.addIndex("","parentIndex", "node-attribute-equality-string");
xmlIndexSpecification.addIndex("","uri", "node-attribute-equality-string");
xmlIndexSpecification.addIndex("","type", "node-attribute-equality-string");
xmlIndexSpecification.addIndex("","targetDocumentURI", "node-attribute-equality-string");
xmlIndexSpecification.addIndex("","targetPointerValue", "node-attribute-equality-string");
xmlIndexSpecification.addIndex("","absoluteHref", "node-attribute-equality-string");
xmlIndexSpecification.addIndex("","id","node-attribute-equality-string");
xmlIndexSpecification.addIndex("","value", "node-attribute-equality-string");
xmlIndexSpecification.addIndex("","arcroleURI", "node-attribute-equality-string");
xmlIndexSpecification.addIndex("","roleURI", "node-attribute-equality-string");
xmlIndexSpecification.addIndex("","name", "node-attribute-equality-string");
xmlIndexSpecification.addIndex("","targetNamespace", "node-attribute-equality-string");
xmlIndexSpecification.addIndex("","contextRef", "node-attribute-equality-string");
xmlIndexSpecification.addIndex("","unitRef", "node-attribute-equality-string");
xmlIndexSpecification.addIndex("","scheme", "node-attribute-equality-string");
xmlIndexSpecification.addIndex("","value", "node-attribute-equality-string");
xmlIndexSpecification.addIndex(Constants.XBRL21Namespace,"identifier", "node-element-equality-string");
xmlIndexSpecification.addIndex(Constants.XMLNamespace,"lang","node-attribute-equality-string");
xmlIndexSpecification.addIndex(Constants.XLinkNamespace,"label","node-attribute-equality-string");
xmlIndexSpecification.addIndex(Constants.XLinkNamespace,"from","node-attribute-equality-string");
xmlIndexSpecification.addIndex(Constants.XLinkNamespace,"to","node-attribute-equality-string");
xmlIndexSpecification.addIndex(Constants.XLinkNamespace,"type","node-attribute-equality-string");
xmlIndexSpecification.addIndex(Constants.XLinkNamespace,"arcrole","node-attribute-equality-string");
xmlIndexSpecification.addIndex(Constants.XLinkNamespace,"role","node-attribute-equality-string");
xmlIndexSpecification.addIndex(Constants.XLinkNamespace,"label","node-attribute-equality-string");
xmlIndexSpecification.addIndex(Constants.XBRLAPILanguagesNamespace,"language","node-element-presence");
xmlIndexSpecification.addIndex(Constants.XBRLAPILanguagesNamespace,"code","node-element-equality-string");
xmlIndexSpecification.addIndex(Constants.XBRLAPILanguagesNamespace,"value","node-element-equality-string");
xmlIndexSpecification.addIndex(Constants.XBRLAPILanguagesNamespace,"encoding","node-element-equality-string");17. Please describe the shape of one of your typical documents? Please
do this by sending us a skeleton XML document.
The following provides the basic information about the shape of all documents
in the data store.
<ns:fragment xmlns:ns="..." attrs...(about 20 of them)>
<ns:data>
Single element that varies from document to document but that
is rarely more than a few small elements in size and (in some cases)
a lengthy section of string content for the single element.
</ns:data>
</ns:fragment>18. What is the rate of document insertion/update required or
expected? Are you doing partial node updates (via XmlModify) or
replacing the document?
Document insertion rates are not a first order performance criteria.
I do no document modifications using XmlModify.
When doing updates I replace the original document.
19. What is the query rate required/expected?
Not sure how to provide metrics for this but a single web page is
being generated, this can involve hundreds of queries. each of which
should be trivial to execute given the indexing strategy in use.
20. XQuery -- supply some sample queries
1. Please provide the Query Plan
2. Are you using DBXML_INDEX_NODES?
I am using DBXML_INDEX_NODES by default because I
am using a node container rather than a whole document
container.
3. Display the indices you have defined for the specific query.
4. If this is a large query, please consider sending a smaller
query (and query plan) that demonstrates the problem.
Example queries.
1. collection('browser')/*[@parentIndex='none']
<XQuery>
<QueryPlanToAST>
<LevelFilterQP>
<StepQP axis="parent-of-attribute" uri="*" name="*" nodeType="element">
<ValueQP container="browser" index="node-attribute-equality-string" operation="eq" child="parentIndex" value="none"/>
</StepQP>
</LevelFilterQP>
</QueryPlanToAST>
</XQuery>2. collection('browser')/*[@stub]
<XQuery>
<QueryPlanToAST>
<LevelFilterQP>
<StepQP axis="parent-of-attribute" uri="*" name="*" nodeType="element">
<PresenceQP container="browser" index="node-attribute-presence-none" operation="eq" child="stub"/>
</StepQP>
</LevelFilterQP>
</QueryPlanToAST>
</XQuery>3. qplan "collection('browser')/*[@type='org.xbrlapi.impl.ConceptImpl' or @parentIndex='asdfv_3']"
<XQuery>
<QueryPlanToAST>
<LevelFilterQP>
<StepQP axis="parent-of-attribute" uri="*" name="*" nodeType="element">
<UnionQP>
<ValueQP container="browser" index="node-attribute-equality-string" operation="eq" child="type" value="org.xbrlapi.impl.ConceptImpl"/>
<ValueQP container="browser" index="node-attribute-equality-string" operation="eq" child="parentIndex" value="asdfv_3"/>
</UnionQP>
</StepQP>
</LevelFilterQP>
</QueryPlanToAST>
</XQuery>4.
setnamespace xlink http://www.w3.org/1999/xlink
qplan "collection('browser')/*[@uri='http://www.xbrlapi.org/my/uri' and */*[@xlink:type='resource' and @xlink:label='description']]"
<XQuery>
<QueryPlanToAST>
<LevelFilterQP>
<NodePredicateFilterQP uri="" name="#tmp8">
<StepQP axis="parent-of-child" uri="*" name="*" nodeType="element">
<StepQP axis="parent-of-child" uri="*" name="*" nodeType="element">
<NodePredicateFilterQP uri="" name="#tmp1">
<StepQP axis="parent-of-attribute" uri="*" name="*" nodeType="element">
<ValueQP container="browser" index="node-attribute-equality-string" operation="eq" child="label:http://www.w3.org/1999/xlink"
value="description"/>
</StepQP>
<AttributeJoinQP>
<VariableQP name="#tmp1"/>
<ValueQP container="browser" index="node-attribute-equality-string" operation="eq" child="type:http://www.w3.org/1999/xlink"
value="resource"/>
</AttributeJoinQP>
</NodePredicateFilterQP>
</StepQP>
</StepQP>
<AttributeJoinQP>
<VariableQP name="#tmp8"/>
<ValueQP container="browser" index="node-attribute-equality-string" operation="eq" child="uri" value="http://www.xbrlapi.org/my/uri"/>
</AttributeJoinQP>
</NodePredicateFilterQP>
</LevelFilterQP>
</QueryPlanToAST>
</XQuery>21. Are you running with Transactions? If so please provide any
transactions flags you specify with any API calls.
I am not running with transactions.
22. If your application is transactional, are your log files stored on
the same disk as your containers/databases?
The log files are stored on the same disk as the container.
23. Do you use AUTO_COMMIT?
Yes. I think that it is a default feature of the DocumentConfig that
I am using.
24. Please list any non-transactional operations performed?
I do document insertions and I do XQueries.
25. How many threads of control are running? How many threads in read
only mode? How many threads are updating?
One thread is updating. Right now one thread is running queries. I am
not yet testing the web application with concurrent users given the
performance issues faced with a single user.
26. Please include a paragraph describing the performance measurements
you have made. Please specifically list any Berkeley DB operations
where the performance is currently insufficient.
I have loaded approximately 7 GB data into the container and then tried
to run the web application using that data. This involves running a broad
range of very simple queries, all of which are expected to be supported
by indexes to ensure that they do not require XML document traversal activity.
Querying performance is insufficient, with even the most basic queries
taking several minutes to complete.
27. What performance level do you hope to achieve?
I hope to be able to run a web application that simultaneously handles
page requests from hundreds of users, each of which involves a large
number of database queries.
28. Please send us the output of the following db_stat utility commands
after your application has been running under "normal" load for some
period of time:
% db_stat -h database environment -c
1038 Last allocated locker ID
0x7fffffff Current maximum unused locker ID
9 Number of lock modes
1000 Maximum number of locks possible
1000 Maximum number of lockers possible
1000 Maximum number of lock objects possible
155 Number of current locks
157 Maximum number of locks at any one time
200 Number of current lockers
200 Maximum number of lockers at any one time
13 Number of current lock objects
17 Maximum number of lock objects at any one time
1566M Total number of locks requested (1566626558)
1566M Total number of locks released (1566626403)
0 Total number of locks upgraded
852 Total number of locks downgraded
3 Lock requests not available due to conflicts, for which we waited
0 Lock requests not available due to conflicts, for which we did not wait
0 Number of deadlocks
0 Lock timeout value
0 Number of locks that have timed out
0 Transaction timeout value
0 Number of transactions that have timed out
712KB The size of the lock region
21807 The number of region locks that required waiting (0%)
% db_stat -h database environment -l
0x40988 Log magic number
13 Log version number
31KB 256B Log record cache size
0 Log file mode
10Mb Current log file size
0 Records entered into the log
28B Log bytes written
28B Log bytes written since last checkpoint
1 Total log file I/O writes
0 Total log file I/O writes due to overflow
1 Total log file flushes
0 Total log file I/O reads
1 Current log file number
28 Current log file offset
1 On-disk log file number
28 On-disk log file offset
1 Maximum commits in a log flush
0 Minimum commits in a log flush
96KB Log region size
0 The number of region locks that required waiting (0%)
% db_stat -h database environment -m
500MB Total cache size
1 Number of caches
1 Maximum number of caches
500MB Pool individual cache size
0 Maximum memory-mapped file size
0 Maximum open file descriptors
0 Maximum sequential buffer writes
0 Sleep after writing maximum sequential buffers
0 Requested pages mapped into the process' address space
1749M Requested pages found in the cache (99%)
722001 Requested pages not found in the cache
911092 Pages created in the cache
722000 Pages read into the cache
4175142 Pages written from the cache to the backing file
1550811 Clean pages forced from the cache
19568 Dirty pages forced from the cache
3 Dirty pages written by trickle-sync thread
62571 Current total page count
62571 Current clean page count
0 Current dirty page count
65537 Number of hash buckets used for page location
1751M Total number of times hash chains searched for a page (1751388600)
8 The longest hash chain searched for a page
3126M Total number of hash chain entries checked for page (3126038333)
4535 The number of hash bucket locks that required waiting (0%)
278 The maximum number of times any hash bucket lock was waited for (0%)
1 The number of region locks that required waiting (0%)
0 The number of buffers frozen
0 The number of buffers thawed
0 The number of frozen buffers freed
1633189 The number of page allocations
4301013 The number of hash buckets examined during allocations
259 The maximum number of hash buckets examined for an allocation
1570522 The number of pages examined during allocations
1 The max number of pages examined for an allocation
184 Threads waited on page I/O
Pool File: browser
8192 Page size
0 Requested pages mapped into the process' address space
1749M Requested pages found in the cache (99%)
722001 Requested pages not found in the cache
911092 Pages created in the cache
722000 Pages read into the cache
4175142 Pages written from the cache to the backing file
% db_stat -h database environment -r
Not applicable.
% db_stat -h database environment -t
Not applicable.
vmstat
r b swpd free buff cache si so bi bo in cs us sy id wa
1 4 40332 773112 27196 1448196 0 0 173 239 64 1365 19 4 72 5
iostat
Linux 2.6.24-23-generic (dell) 06/02/09
avg-cpu: %user %nice %system %iowait %steal %idle
18.37 0.01 3.75 5.67 0.00 72.20
Device: tps Blk_read/s Blk_wrtn/s Blk_read Blk_wrtn
sda 72.77 794.79 1048.35 5376284 7091504
29. Are there any other significant applications running on this
system? Are you using Berkeley DB outside of Berkeley DB XML?
Please describe the application?
No other significant applications are running on the system.
I am not using Berkeley DB outside of Berkeley DB XML.
The application is a web application that organises the data in
the stored documents into hypercubes that users can slice/dice and analyse.
Edited by: Geoff Shuetrim on Feb 7, 2009 2:23 PM to correct the appearance of the query plans.Hi Geoff,
Thanks for filling out the performance questionnaire. Unfortunately the forum software seems to have destroyed some of your queries - you might want to use \[code\] and \[code\] to markup your queries and query plans next time.
Geoff Shuetrim wrote:
Current performance involves responses to simple queries that involve 1-2
minute turn around (this improves after a few similar queries have been run,
presumably because of caching, but not to a point that is acceptable for
web applications).
Desired performance is for queries to execute in milliseconds rather than
minutes.I think that this is a reasonable expectation in most cases.
14. Please provide your exact Environment Configuration Flags (include
anything specified in you DB_CONFIG file)
I do not have a DB_CONFIG file in the database home directory.
My environment configuration is as follows:
Threaded = true
AllowCreate = true
InitializeLocking = true
ErrorStream = System.err
InitializeCache = true
Cache Size = 1024 * 1024 * 500
InitializeLogging = true
Transactional = false
TrickleCacheWrite = 20If you are performing concurrent reads and writes, you need to enable transactions in the both the environment and the container.
Example queries.
1. collection('browser')/*[@parentIndex='none']
<XQuery>
<QueryPlanToAST>
<LevelFilterQP>
<StepQP axis="parent-of-attribute" uri="*" name="*" nodeType="element">
<ValueQP container="browser" index="node-attribute-equality-string" operation="eq" child="parentIndex" value="none"/>
</StepQP>
</LevelFilterQP>
</QueryPlanToAST>
</XQuery>
I have two initial observations about this query:
1) It looks like it could return a lot of results - a query that returns a lot of results will always be slow. If you only want a subset of the results, use lazy evalulation, or put an explicit call to the subsequence() function in the query.
2) An explicit element name with an index on it often performs faster than a "*" step. I think you'll get faster query execution if you specify the document element name rather than "*", and then add a "node-element-presence" index on it.
3) Generally descendant axis is faster than child axis. If you just need the document rather than the document (root) element, you might find that this query is a little faster (any document with a "parentIndex" attribute whose value is "none"):
collection()[descendant::*/@parentIndex='none']Similar observations apply to the other queries you posted.
Get back to me if you're still having problems with specific queries.
John -
Problem with default namespaces
Hello,
I'm using version 2.3.10 of Berkeley XML.
All my XML documents have a default namespace declared in the root element, like this:
<rootElement xmlns="http://www....something.../something">
but I get errors when I query the documents - and the only way of avoiding the errors seems to be by manually removing the default namespace attribute.
I tried setting the XmlQueryContext.setNamespace("", myUri) - but it doesn't work. I saw this mentioned in another post - and you said it was scheduled to work that way in the next release.
Can you tell me when the next release will be, and what I can do right now to get around this problem. I need to keep the xmlns attribute in the root element since I have other applications which need to access the documents before I put them into the database and they make use of it.
Kind Regards
Swami KevalaHi Swami,
You have two options:
1) Bind a prefix to your namespace URI, and use that prefix in your queries:
XmlQueryContext.setNamespace("pre", myUri);
XmlManager.query("/pre:rootElement", qc);
2) Bind the default element namespace inside the query:
XmlManager.query("declare default element namespace \"" + myUri + "\"; /rootElement", qc);
John -
How to set the size of mutex region?
I am using a berkeley xml db on a CMS system.
The server's memory is 562M. When more than 80 users visited the system (without setting the environment configuration of berkeley DB), the berkeley db got the following errors: unable to allocate memory for mutex; resize mutex region.
Firstly, I set the environment configuration programmatically. I used java class EnvironmentConfig.setMutexIncrement(int) to change the region of mutex. However, the same error still happened event after EnvironmentConfig.setMutexIncrement(200) was used.
Therefore, I change the cachesize to 1M. But got the same error.
My config is
config.setCacheSize(1 * 1024 * 1024);
config.setAllowCreate(true);
config.setInitializeCache(true);
config.setInitializeLocking(true);
config.setInitializeLogging(true);
config.setThreaded(true);
Any help would by gratefully received.
Best Regards
JosieHi Josie,
The solution is to allocate a bigger number of mutexes to allocate. This can be done by calling DbEnv::mutex_set_max or DbEnv::mutex_set_increment.
For more details, please check here:
C++ APIs: http://www.oracle.com/technology/documentation/berkeley-db/xml/api_cxx/mutex_set_max.html
Java APIs: http://www.oracle.com/technology/documentation/berkeley-db/db/java/com/sleepycat/db/EnvironmentConfig.html#setMaxMutexes(int)
http://www.oracle.com/technology/documentation/berkeley-db/db/java/com/sleepycat/db/EnvironmentConfig.html#setMutexIncrement(int)
Please try to apply the above suggestion, and let me know if it works.
Thanks,
Bogdan Coman -
Hi,
I am trying to update an existing document in a container using a query, and being more specific i want to add a new node in the document. I've tried to do it using XmlModify :
try {
XmlUpdateContext updateContext = mgr.createUpdateContext();
// query for all the documents that we want to update
XmlResults results = mgr.query(txn, fullQuery, context, null);
XmlValue value = results.next();
while (value != null) {
XmlDocument document = value.asDocument();
XmlModify mod = mgr.createModify();
String Violation="Violation";
XmlQueryExpression select =mgr.prepare("collection('myData.dbxml')/QoSdb/QoEViolation", context);
mod.addAppendStep(select, XmlModify.Element, "MyChild", "This is my child");
mod.execute(results, context, updateContext);
value = results.next();
} catch (XmlException e) {
but it wasn't successful..
Any suggestions on how to do this?
I am using the latest release of Berkeley XML DB, and i am working on Fedora OS
Thanks in advance
PanayiotisHi,
There are at least a couple of things wrong:
1. Your select (XmlQueryExpression) needs to be a query that is relative to the context of the XmlModify.execute() call, which is a document (or whatever is returned by the "fullQuery" expression (you didn't include that). Typically, this means that the XQuery expression for the select query starts with "." or "/" and not "collection()"
2. you call mod.execute(results, ...) and not mod.execute(value, ...)
This is done after calling results.next(), which means that your context is not what I think you want it to be.
Regards,
George
Maybe you are looking for
-
ITunes locks PC during large downloads
This started happening about a month ago and there have been no major changes to my system (I've had this system for over a year). PC running Windows Home 7 Premium 64 bit with SP1 and all available Microsoft updates installed. iTunes is version 10.
-
The target "GetTargetPath" does not exist
Hi the following error occurs when i build a solution containing my VSPackage project and a windowsApplication. Error 1 The target "GetTargetPath" does not exist in the project. MyLibrary18.mlproj WindowsApplication1 Please help Thanks kajal
-
Hi, I have upgrade to Lion (10.7..) and Keynote too. One of the many problems is the error with "Document Warnings" with a window listing the missing images. Never had this before, any pointers please.
-
Add a first page (turn page 1 into page 2 so page 1 is then blank)
Basically I have a resume created but must add a cover letter to the file. So I need to create a blank page that will be page 1.
-
S230u wrong driver picked up in SU / thininstal​ler
I have a s230u and when I run system update it is picking up the wrong wless driver software. this is the one picked up by SU / and thininstaller : If you check this thread - this is the one i'm told is the correct driver? http://forums.lenovo.com/t5