XML Editor
Sign up for a WebBoard account Sign Up Keyword Search Search More Options... Options
Chat Rooms Chat Help Help News News Log in to WebBoard Log in Not Logged in
Show tree view Topic
Go to previous topicPrev TopicGo to next topicNext Topic
Postnext
Midas WangSubject: Want to execute a XQuery by API
Author: Midas Wang
Date: 13 Dec 2006 10:10 PM
I am using datadirect processor.
I want to execute a XQuery file by API like XQueryRunner.query(XQueryFilePath). But when there is RDB collections in the xquery, the datadirect API need a database configuration stream to initilize the connection.
Is there any method to generate such a configuration stream by program?

Thanks,
Midas

Postnext
Minollo I.Subject: Want to execute a XQuery by API
Author: Minollo I.
Date: 13 Dec 2006 10:22 PM
Take a look at the documentation:
http://media.datadirect.com/download/docs/ddxquery/ddxqug/conf_sourcefiles.html#wp182031

A simple example is:
...
DDXQDataSource ds = new DDXQDataSource();
ds.setProperty(com.ddtek.xquery.xqj.mediator.DDXQDataSource.JDBCURL, "jdbc:xquery:sqlserver://localhost:1433;databaseName=PortfolioData;user=sa;password=");
XQConnection connection = ds.getConnection();
XQExpression expression = connection.createExpression();
File xqueryFile = new File("c:/my.xquery");
XQSequence sequence = expression.executeQuery(new InputStreamReader(new FileInputStream(xqueryFile)));
...

Postnext
Midas WangSubject: Want to execute a XQuery by API
Author: Midas Wang
Date: 13 Dec 2006 10:35 PM
Thank you, Ivan. You give me a method to do the DB connection.
Actually, I found such connection information in the XQuery metaInformation section. And when I generated Java code from this XQuery, I got a file like 'c_Scenario1.xml' which included some db connection information in another format.
I want to know is there any API provided to extract such a xml from the XQuery file?

Thanks,
Midas

Postnext
Minollo I.Subject: Want to execute a XQuery by API
Author: Minollo I.
Date: 13 Dec 2006 10:41 PM
There isn't an automated way to extract the connection information that Stylus Studio stores in the XQuery file as a comment. The general idea is that the information stored in the XQuery file is used at development time; and that at deployment time you use different ways to get the proper information, which is potentially different.

In theory you could parse that information yourself, but I would strongly discourage that approach.

Postnext
Midas WangSubject: Want to execute a XQuery by API
Author: Midas Wang
Date: 13 Dec 2006 10:49 PM
Why do you discourage this way?
I want to use this way to store RDB connection information, also allow user to reset it in deployment.
Is there any problem with this method?

Thanks,
Midas

Postnext
Minollo I.Subject: Want to execute a XQuery by API
Author: Minollo I.
Date: 13 Dec 2006 10:56 PM
The problem is that the "meta-information" stored by Stylus Studio is an internal format that is not guaranteed to remain unchanged or backward compatible in future versions of the tool.

Posttop
Midas WangSubject: Want to execute a XQuery by API
Author: Midas Wang
Date: 14 Dec 2006 12:12 AM
I see. Thank you!

Midas

 
Go to previous topicPrev TopicGo to next topicNext Topic
Download A Free Trial of Stylus Studio 6 XML Professional Edition Today! Powered by Stylus Studio, the world's leading XML IDE for XML, XSLT, XQuery, XML Schema, DTD, XPath, WSDL, XHTML, SQL/XML, and XML Mapping!  
go

Log In Options

Site Map | Privacy Policy | Terms of Use | Trademarks
Stylus Scoop XML Newsletter:
W3C Member
Stylus Studio® and DataDirect XQuery ™are from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2016 All Rights Reserved.