Hi Lee,
Yes you can create only one session object and you can do any
number of xcc operations (say run newAdhocQuery or what ever you need). At
the end finally you can close the session object.
Eg:
session = contentSource.newSession();
File file = new File("C:\\MarkLogic\\abc.xml");
InputStream is = new FileInputStream(file);
ContentCreateOptions createOptions = new
ContentCreateOptions();
createOptions.setFormatBinary();
Content content = ContentFactory.newContent(
"transaction5.xml", is, createOptions);
session.insertContent(content);
System.out.println(" Document Inserted:" );
Request request = session.newAdhocQuery(
"xdmp:document-insert(\"111.xml\" ,\"<a1> abc 111</a1>\")");
ResultSequence rs =
session.submitRequest(request);
In this example same session object is used to do 2 operations . You can
also do the same.
Regards,
Santhosh Rajasekaran
"Lee, David" <[email protected]>
Sent by: [email protected]
05/06/2009 12:34 AM
Please respond to
General Mark Logic Developer Discussion <[email protected]>
To
"General Mark Logic Developer Discussion"
<[email protected]>
cc
Subject
[MarkLogic Dev General] Connection Caching
I read that the ML xcc library handles "connection pooling" .. .but does
it handle "connection caching" ?
What I mean is this.
Suppose I were to do 10 XCC operations (say run newAdhocQuery).
Is there a significant advantage to reusing a session ?
Vs. creating a new session for each one.
The context of the question ... I'm working on the ML connector to xmlsh (
www.xmlsh.org) and I'm wondering if there is a significant advantage to
complicating the API. Right now every ML operation creates a new session
(from a connection string like "xcc://user:p...@host:port/DB") then runs
the operation.
Would there be a significant advantage to instead having a kind of "login"
method and then reusing the session instead of creating a new one.
Any opinions welcome !
-David Lee
----------------------------------------
David A. Lee
Senior Principal Software Engineer
Epocrates, Inc.
[email protected]
812-482-5224
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general
ForwardSourceID:NT0000AE2E
=====-----=====-----=====
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you
_______________________________________________
General mailing list
[email protected]
http://xqzone.com/mailman/listinfo/general