niXforums Forum Index
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   PreferencesPreferences   Log in to check your private messagesLog in to check your private messages   Log inLog in 
·  nixdoc.net ·  man pages ·  Linux HOWTOs ·  FreeBSD Tips ·  Forums
navigation Forum index » Databases » Berkeley DB
Newbie BerkeleyDB XML question
Post new topic   Reply to topic Page 1 of 1 [1 Post] View previous topic :: View next topic
Author Message
Rupert Woodman
*nix forums beginner


Joined: 21 Jun 2006
Posts: 5

PostPosted: Fri Jun 30, 2006 7:38 pm    Post subject: Newbie BerkeleyDB XML question Reply with quote

I'm having some problems getting started with BerkeleyDB XML and I'd really
appreciate some help or guidance.

I've written a java application which reads some XML from a file and writes
it to a container.
Unfortunately, I have a couple of peoblems.
The first one, is than unless I enable auto-open, it tells me the container
is closed. I've looked at the source and it's failing somewhere in the
native methds which makes it difficult to resolve. This is less of a
problem to me at the minute, tho I note that someone from Sleepycat said
it's a slow way of doing things.

The other problem is more of a show-stopper:

Opening container TestMetadata.dbxml
Container - TestMetadata.dbxml - Node storage container opened.
Opening container TestMetadata.dbxml
Indexer - XML Indexer: Fatal Parse error in document at line, 1, char 23.
Parser message: An exception occurred! Type:UTFDataFormatException,
Message:invalid byte 1 (?) of a 1-byte sequence.

The XML data file is valid (if slightly dull):

<?xml version="1.0" ?>

<metadata>
<test id="1" name="test1">

</test>

<test id="2" name="test2">

</test>

</metadata>

I don't see why this should fail with such an error.

The method I'm using to write the data is as follows:

public boolean write(String strDocKey, String strXmlDoc) throws
XmlException
{
boolean boolRetVal = true;

try {
semWriteAccess.acquire();

openContainer();

// Do write
XmlTransaction xtTrans = xmManager.createTransaction();

XmlUpdateContext xucUpdate =
xmManager.createUpdateContext();

xcContainer.putDocument(xtTrans, strDocKey, strXmlDoc,
xucUpdate);

xtTrans.commit();

} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
boolRetVal = false;
} finally {
semWriteAccess.release();
}

return boolRetVal;
}


I'm setting up as follows:

Environment envCurrent =
getEnvironment(BERKELEY_TEST_REPOSITORY_HOME);

XmlManagerConfig xmc = new XmlManagerConfig();

xmc.setAllowAutoOpen(true);

xmManager = new XmlManager(envCurrent, xmc);

xmManager.setLogLevel(XmlManager.LEVEL_ALL, true);
xmManager.setLogCategory(XmlManager.CATEGORY_ALL, true);



public Environment getEnvironment(String strBase) throws
FileNotFoundException, DatabaseException
{
File f = new File(strBase);

EnvironmentConfig envConf = new EnvironmentConfig();
envConf.setMaxLocks(10000);
envConf.setMaxLockers(10000);
envConf.setMaxLockObjects(10000);

envConf.setCacheSize(50 * 1024 * 1024);
envConf.setAllowCreate(true);
envConf.setInitializeCache(true);
envConf.setTransactional(true);
envConf.setInitializeLocking(true);
envConf.setInitializeLogging(true);
envConf.setErrorStream(System.err);

Environment myEnv = new Environment(f, envConf);

return myEnv;
}

Any ideas, please let me know - I'm really keen to get this going.

Thanks
Back to top
Google

Back to top
Display posts from previous:   
Post new topic   Reply to topic Page 1 of 1 [1 Post] View previous topic :: View next topic
The time now is Fri Nov 21, 2008 12:39 am | All times are GMT
navigation Forum index » Databases » Berkeley DB
Jump to:  

Similar Topics
Topic Author Forum Replies Last Post
No new posts Newbie question: How to forward a domain to a mailbox? leei Postfix 0 Fri Aug 24, 2007 4:55 pm
No new posts configuration question for httpd Karl Wang Apache 1 Fri Jul 21, 2006 2:10 pm
No new posts nim problem/question Ron AIX 0 Fri Jul 21, 2006 1:57 pm
No new posts question for JAVA developer who r using postgres sql as b... deepak pal PostgreSQL 1 Fri Jul 21, 2006 9:00 am
No new posts Encryption Question dtuttle1@gmail.com Berkeley DB 2 Thu Jul 20, 2006 10:09 pm

Debt Consolidation | Books | MPAA | Free Ringtones | Anime Downloads
Copyright © 2004-2005 DeniX Solutions SRL
 
Other DeniX Solutions sites: Unix/Linux blog |  electronics forum |  medicine forum |  science forum | 
Privacy Policy


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.2333s ][ Queries: 16 (0.1332s) ][ GZIP on - Debug on ]