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
Steven FancherSubject: Extracting XML from a database using Java
Author: Steven Fancher
Date: 04 Nov 2006 05:57 PM
Within the 2007 IDE I have a .rdbxml adapter that I use to attach to an Oracle database and extract data into an XML doc. Works fine, very fast, etc.

I'd like to do this same task outside of the IDE, but I have been having a series of problems.

After reading the forums, the docs, the Deployment Adapter PDF and the java code that an Xquery doc using said adapter generates, I am completely stuck.

Within the IDE I can run both the db:///blah adapter and also a simple XQuery: '<doc>{.}</doc>' where the scenerio specifies the db:/// adapter as input and everything works, I get the expected XML doc as a result. (Note: this is only true if I run the Xquery using the built-in processor. If I use SAXON or the DataDirect processors, they run out of heap, but I'll leavethat problem for a later discussion...)

What I really need is a chunk of Java code that _just_ reads the database through the db URL and returns the XML doc. I can handle the post-processing externally. It seems like this must be possible. Can anyone help, send a code fragment or tell me I why this idea is completely braindead?

Thanks in advance!

Steven Fancher

Postnext
Ivan PedruzziSubject: Extracting XML from a database using Java
Author: Ivan Pedruzzi
Date: 06 Nov 2006 08:57 AM
Hi Steven,

The following code shows how to invoke a db URL

StylusFileFactory.unlockAPI("Insert your Installation ID here");

// if you need an InputStream
InputStream is = StylusFileFactory.createInputStream("db:///authors.rdbxml", "");
...
is.close()


// Result as local file
StylusFile sf = StylusFileFactory.getFactory().createStylusFile("db:///c:/temp/authors.rdbxml");
StylusFileHelpers.copyToFile(sf, "authors.xml");
sf.close();


If you are planning to use XQuery to manipulate your relational data, DataDirect XQuery offers a far superior solution.

With DataDirect XQuery you don't need to use "db:", please have a look at
http://www.stylusstudio.com/docs/v2007/d_xquery36.html#wp601937

See also "How to Generate Java Code for XQuery"
http://www.stylusstudio.com/docs/v2007/d_xquery65.html#wp496150

Hope this helps
Ivan Pedruzzi
Stylus Studio Team

Postnext
Steven FancherSubject: Extracting XML from a database using Java
Author: Steven Fancher
Date: 08 Nov 2006 05:54 AM
Dude, is there anything you don't have an answer for? :-)

Thanks - I haven't tried the code yet, but I will.

-Fancher

Postnext
Steven FancherSubject: Extracting XML from a database using Java
Author: Steven Fancher
Date: 08 Nov 2006 06:42 AM
Works like a charm on my windows laptop, thanks.

Hangs forever burning 50% of the CPU on a Solaris box using the same version JVM and (as far as I can tell...) all the same jars.

Should this work on the solaris box?

uname -a on the solaris box sez:
SunOS iptoolbox01 5.8 Generic_117350-39 sun4u sparc SUNW,Sun-Fire-280R

The only diag I have done so far is to run truss on the jvm which shows it is doing _something_,but I can't tell what. I have verified SQL port connectivity from the host. Any Ideas? Any type of logging I can turn on in the StylusFile class or any other place?

-Fancher

Postnext
Ivan PedruzziSubject: Extracting XML from a database using Java
Author: Ivan Pedruzzi
Date: 08 Nov 2006 08:51 AM
Which JVM version?
java -version

Could you tell us on which API call it seems to hang?

Are you using the installation ID from the Stylus Studio about box to unlock the API?
If yes you are running in evolution mode and the API needs to validate the license against our server, is the Solaris box connected to the Internet?

Thanks
Ivan Pedruzzi
Stylus Studio Team

Posttop
Steven FancherSubject: Extracting XML from a database using Java
Author: Steven Fancher
Date: 08 Nov 2006 08:11 PM
More info...

bash-2.03$ java -version
java version "1.5.0_07"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-b03)
Java HotSpot(TM) Server VM (build 1.5.0_07-b03, mixed mode)
---
This line of code never returns:
StylusFile sf = StylusFileFactory.getFactory().createStylusFile("db://./Visionael.rdbxml");

The machine is on an internal network behind who knows how many firewalls, but the unlock call returns true - I don't know if that is a true indication that it called the mothership or not. I can ping stylusstudio.com from the box, but that says nothing about what ports are open, etc. Is there any way to test this connectivity.

Here is one more strange thing: most of the time the code gets to the line that hangs just fine, I've put printlns in to watch the progtress, however about 20% of the time the prog prints out
<-- Checking Stylus Studio License --> and then hangs right then and there. Does this tell you anything useful? I have seen this last behavior on my windows laptop running the same code under eclipse
as well as on the solaris box.

Hope this helps. Knowing our security guys, you may well have hit the nail on the head with the phone home issue... But I donno...

-Fancher

 
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.