dbTalk Databases Forums  

Opening container question

comp.databases.berkeley-db comp.databases.berkeley-db


Discuss Opening container question in the comp.databases.berkeley-db forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
Rupert Woodman
 
Posts: n/a

Default Opening container question - 06-21-2006 , 10:00 AM






Hi,

I'm just having a look at BerkeleyDB XML for the first time, using the Java
API.

I created a new container using the Berkeley DB XML Shell (Tests.dbxml)
using the command:

createContainer "Tests.dbxml"

I then wrote an application to open the container, but I get an exception
thrown:

Container - Tests.dbxml - container closed.
com.sleepycat.dbxml.XmlException: Error: No such file or directory, errcode
= DATABASE_ERROR
at com.sleepycat.dbxml.dbxml_javaJNI.XmlManager_openC ontainer__SWIG_2(Native
Method)
at com.sleepycat.dbxml.XmlManager.openContainer(XmlMa nager.java:473)
at com.sleepycat.dbxml.XmlManager.openContainer(XmlMa nager.java:187)
at com.sleepycat.dbxml.XmlManager.openContainer(XmlMa nager.java:131)
at com.microfocus.XMLRepository.dbExample.<init>(dbEx ample.java:40)
at com.microfocus.XMLRepository.dbExample.main(dbExam ple.java:52)

If I call the existsContainer method before I make the call to
openContainer, it returns a value of 5.

However, if I create a container ("Test.xml") using
XmlManager.createContainer method, the same openContainer method, it works
ok.

I'm sure I must be missing something obviosu here, but I've not found
anything in the docs I've read so far.

thanks very much

Code below:

try {

File f = new File("c:/Documents and Settings/rupertw/");
String strContainer = "Tests.dbxml";

EnvironmentConfig envConf = new EnvironmentConfig();
envConf.setCacheSize(50 * 1024 * 1024);
envConf.setInitializeCache(true);
envConf.setInitializeLogging(true);
envConf.setErrorStream(System.err);

Environment myEnv = new Environment(f, envConf);

xmManager = new XmlManager(myEnv, null);
xmManager.setLogLevel(XmlManager.LEVEL_ALL, true);
xmManager.setLogCategory(XmlManager.CATEGORY_ALL, true);

System.err.println("existsContainer returns: " +
xmManager.existsContainer(strContainer));

XmlContainer x = xmManager.openContainer(strContainer);

System.err.println("Opened ok");

} catch (XmlException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
}





Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.