[xquery-talk] XQuery and databases - XQuery 2.0
wolfgang at exist-db.org
Mon Jun 8 18:29:28 PDT 2009
> how can I use a xml-file stored in a database ?
> I tried with eXist but i did not work:
please ask product specific questions on the corresponding mailing
lists. How you access a stored document depends on the database product
you use. There's no general answer to this.
> let $path :='http://localhost:8080/exist/rest/db/my.xml'
> ...doc(path )...
> -> FileNotFoundException: http://localhost:8080/exist/rest/db/Abteilung_DocIDinRepo.xml
> (I tried several other paths and combinations)
Just use a relative URI: doc("/db/my.xml"). The xquery is running on the
server. It knows and has access to all documents stored there. There's
no need to use an HTTP URI here.
> 2)Is there (or will there be) possibility to make a database-connection just with XQuery ? So that I can give host, port, login, passwort, etc and XQuery is able to connect to the database ?
> Am I correct, that at the moment it is only possible if you use XQuery executed from java (or an other programming language, that is able to create a connection) ?
Mmmmh, the query engine is running on top of the database, so it has a
connection to that server. I guess what you are asking for is a way to
access resources stored on a different server than the one which is
running the query? You can retrieve external documents via an HTTP URL,
just as you tried above. However, eXist will retrieve those documents
and parse them locally. You loose the benefits of indexes and the like.
If you are asking for distributed search: we (eXist) do not provide such
a feature right now, though some work is underway. You may have a look
at some of the commercial xmldbs if you need this.
More information about the talk