简体   繁体   English

eXist-db:使用 XML:DB API 从 Java 应用程序连接时的用户名/密码

[英]eXist-db: username/password when connecting from Java applications with the XML:DB API

I want to insert data from my Java application to a secured eXist-db我想将数据从我的 Java 应用程序插入到安全的 eXist-db

I found this document: https://exist-db.org/exist/apps/doc/devguide_xmldb but it does not have guide for passing username and password.我找到了这个文档: https : //exist-db.org/exist/apps/doc/devguide_xmldb但它没有传递用户名和密码的指南。

I tried我试过

database.setProperty("username", "admin");
database.setProperty("password", "admin");

But this exception is still thrown:但是仍然抛出这个异常:

org.xmldb.api.base.XMLDBException: Failed to invoke method parse in class org.exist.xmlrpc.RpcConnection: Write permission is not granted on the Collection

Anybody can help ?有人可以帮忙吗?

You can find examples of using eXist-db's XML:DB API in the eXist book, for reference the example Java applications code is here: https://github.com/eXist-book/book-code/tree/master/chapters/integration/xmldb-client您可以在 eXist 书中找到使用 eXist-db 的 XML:DB API 的示例,参考示例 Java 应用程序代码在这里: https : //github.com/eXist-book/book-code/tree/master/chapters/集成/xmldb-客户端

Specifically, you might find this helpful:具体来说,您可能会发现这很有帮助:

https://github.com/eXist-book/book-code/blob/master/chapters/integration/xmldb-client/xmldb-client-store/src/main/java/exist/book/example/xmldb/client/StoreApp.java#L56 https://github.com/eXist-book/book-code/blob/master/chapters/integration/xmldb-client/xmldb-client-store/src/main/java/exist/book/example/xmldb/client/ StoreApp.java#L56

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM