You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by Grzegorz Zuber <zu...@gmail.com> on 2015/10/29 14:17:44 UTC
Derby - query XML
I have XML stored in my database.
XML looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<orders>
<singleOrder no="1" date="2015-01-22">
<customer id="1" />
<products>
<product>
<productId>1</productId>
<quantity>3</quantity>
</product>
</products>
</singleOrder>
<singleOrder no="4" date="2015-02-27">
<customer id="1" />
<products>
<product>
<productId>3</productId>
<quantity>2</quantity>
</product>
<product>
<productId>4</productId>
<quantity>4</quantity>
</product>
</products>
</singleOrder>
<singleOrder no="2" date="2015-01-25">
<customer id="3" />
<products>
<product>
<productId>4</productId>
<quantity>5</quantity>
</product>
</products>
</singleOrder>
<singleOrder no="3" date="2015-02-01">
<customer id="4" />
<products>
<product>
<productId>1</productId>
<quantity>8</quantity>
</product>
<product>
<productId>3</productId>
<quantity>20</quantity>
</product>
</products>
</singleOrder>
</orders>
I want to get from it for all product: customer/@id, singleOrder/@no,
productId, quantity, singleOrder/@date, so the output will look like this:
customerIdorderIdproductIdquantitydate11132015-01-2214322015-02-271444
2015-02-2732452015-01-2543182015-02-01433202015-02-01
Do you know how to do that?
Thank you,
Grzegorz
Re: Derby ERROR XSDB6
Posted by Alessandro Manzoni <ma...@gmail.com>.
Il 30.10.2015 11.41, Peter Ondruška ha scritto:
> I've had exactly the same problem which has to do with Eclipse not
> being aware of embedded Derby specific way to shutdown. Eclipse only
> closes connection and database stays open. I solved this by running
> standalone Derby network server and connecting from Eclipse and
> application as network client.
One uncomfortable way I found is specifying shutdown=true connection
attribute (with user and password in case security is enabled. E.g.
DriverManager.getConnection("jdbc:derby:dbname;shutdown=true"), but this
cannot be done from DatabaseDevelopment sql editor, you have to change,
even temporary, the connection properties and try to connect (even with
test connection).
I hoped there was another way, maybe changing the Connection object:
>
>
> On Friday, 30 October 2015, Alessandro Manzoni
> <manzoni.alessandro4@gmail.com <ma...@gmail.com>>
> wrote:
>
> For some reasons I'm using derby embedded driver.
> The application performs as expected unless, for debug purpose, I
> open the database from eclipse DatabaseDevelopment perspective.
> Even if i close the connection from DatabaseDevelopment and
> closing DatabaseDevelopment perspective too, when I connect the db
> from the application I get the SQLExceplion:
> "ERROR XSDB6: Another instance of Derby may have already booted
> the database.
> The only way I found to reset this figure, is restarting eclipse.
> I imagine that's because DatabaseDevelopment is using a different JVM.
> Is there a way to force closing the db?
>
> Thank you.
>
>
>
> --
> Peter Ondruška
>
Re: Derby ERROR XSDB6
Posted by Peter Ondruška <pe...@kaibo.eu>.
I've had exactly the same problem which has to do with Eclipse not being
aware of embedded Derby specific way to shutdown. Eclipse only closes
connection and database stays open. I solved this by running standalone
Derby network server and connecting from Eclipse and application as network
client.
On Friday, 30 October 2015, Alessandro Manzoni <
manzoni.alessandro4@gmail.com> wrote:
> For some reasons I'm using derby embedded driver.
> The application performs as expected unless, for debug purpose, I open the
> database from eclipse DatabaseDevelopment perspective.
> Even if i close the connection from DatabaseDevelopment and closing
> DatabaseDevelopment perspective too, when I connect the db from the
> application I get the SQLExceplion:
> "ERROR XSDB6: Another instance of Derby may have already booted the
> database.
> The only way I found to reset this figure, is restarting eclipse. I
> imagine that's because DatabaseDevelopment is using a different JVM.
> Is there a way to force closing the db?
>
> Thank you.
>
>
--
Peter Ondruška
Derby ERROR XSDB6
Posted by Alessandro Manzoni <ma...@gmail.com>.
For some reasons I'm using derby embedded driver.
The application performs as expected unless, for debug purpose, I open
the database from eclipse DatabaseDevelopment perspective.
Even if i close the connection from DatabaseDevelopment and closing
DatabaseDevelopment perspective too, when I connect the db from the
application I get the SQLExceplion:
"ERROR XSDB6: Another instance of Derby may have already booted the
database.
The only way I found to reset this figure, is restarting eclipse. I
imagine that's because DatabaseDevelopment is using a different JVM.
Is there a way to force closing the db?
Thank you.