You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by Susan Cline <ho...@pacbell.net> on 2006/02/14 19:57:57 UTC

XMLPARSE usage?

Hi,

I'm trying to use the XMLPARSE functionality that I believe is available in the 10.2 snapshot
jars;

truncated sysinfo output:

[C:\derby\db-derby-snapshot-10.2.0.0-372122\lib\derby.jar] 10.2.0.0 alpha - (372122)
[C:\derby\db-derby-snapshot-10.2.0.0-372122\lib\derbytools.jar] 10.2.0.0 alpha -
 (372122)

I found this post from May 2005 that had the correct usage at the time the initial patch was
posted:

http://mail-archives.apache.org/mod_mbox/db-derby-dev/200505.mbox/%3C4294CF0A.5060406@sbcglobal.net%3E

[ from the above post ]

Syntax is as follows:

XMLPARSE( DOCUMENT <string-value-expression> PRESERVE WHITESPACE )

Ex:

ij> INSERT INTO xTable VALUES (1, XMLPARSE(DOCUMENT '<simp> doc </simp>' 
PRESERVE WHITESPACE));
1 row inserted/updated/deleted

[ end post ]

However, when I try the following I get errors:

ij> create table xmltab (id integer, xml_col xml);

ij> insert into xmltab values (1, xmlparse(document '<simp> doc </simp>'preserve whitespace));
ERROR XJ001: Java exception: ': java.lang.NullPointerException'.

ij> insert into xmltab values (1, xmlparse(document '<simp> doc </simp>' preserve whitespace));
ERROR 40XT0: An internal error was identified by RawStore module.

Has the syntax for XMLPARSE changed?

If so, can someone post the correct syntax?  Similarly, if the syntax for XMLSERIALIZE and
XMLEXISTS has changed I'd like that information as well.

Thanks!

Susan 

Re: XMLPARSE usage?

Posted by Susan Cline <ho...@pacbell.net>.
--- Andrew McIntyre <mc...@gmail.com> wrote:

> On 2/14/06, Satheesh Bandaram <sa...@sourcery.org> wrote:
> > I think the problem is because of XMLTypeCompiler not being listed in
> > 'extraDBMStypes.properties'. I looked at 10.2 snapshot derby.jar and I
> > don't find XMLTypeCompiler in the JAR.
> 
> And... fixed, revision 377822.
> 
> andrew

Hi,

Thanks to everyone for their responses.  I could not respond to Satheesh's email asking me which
JDK I was using, although it sounds like it may not be relevant, but the complete sysinfo output
is below:

------------------ Java Information ------------------
Java Version:    1.5.0_06
Java Vendor:     Sun Microsystems Inc.
Java home:       C:\tools\jdks\jdk1.5.0_06\jre
Java classpath:  C:\derby\DB-DER~1.0-3\lib\derby.jar;C:\derby\DB-DER~1.0-3\lib\d
erbytools.jar;
OS name:         Windows XP
OS architecture: x86
OS version:      5.1
Java user name:  slc
Java user home:  C:\Documents and Settings\slc
Java user dir:   C:\derby\db-derby-snapshot-10.2.0.0-372122\frameworks\embedded\
bin
java.specification.name: Java Platform API Specification
java.specification.version: 1.5
--------- Derby Information --------
JRE - JDBC: J2SE 5.0 - JDBC 3.0
[C:\derby\db-derby-snapshot-10.2.0.0-372122\lib\derby.jar] 10.2.0.0 alpha - (372
122)
[C:\derby\db-derby-snapshot-10.2.0.0-372122\lib\derbytools.jar] 10.2.0.0 alpha -
 (372122)
------------------------------------------------------
----------------- Locale Information -----------------
------------------------------------------------------

Thanks,

Susan


Re: XMLPARSE usage?

Posted by Andrew McIntyre <mc...@gmail.com>.
On 2/14/06, Satheesh Bandaram <sa...@sourcery.org> wrote:
> I think the problem is because of XMLTypeCompiler not being listed in
> 'extraDBMStypes.properties'. I looked at 10.2 snapshot derby.jar and I
> don't find XMLTypeCompiler in the JAR.

And... fixed, revision 377822.

andrew

Re: XMLPARSE usage?

Posted by Satheesh Bandaram <sa...@Sourcery.Org>.
I think the problem is because of XMLTypeCompiler not being listed in
'extraDBMStypes.properties'. I looked at 10.2 snapshot derby.jar and I
don't find XMLTypeCompiler in the JAR.

I also tried earlier with classes and there is no problem there....

Satheesh

Army wrote:

>
> I'll try to find time to look at this.  Note that as part of my
> in-progress-but-currently-back-burnered work for the 10.2 release I
> will be enabling XML tests to run as part of derbyall, so this type of
> problem (where it only occurs against the jar files) will be caught in
> the regression tests.
>
> But in the meantime, thanks for bringing this to my attention.  If
> anyone out there knows what might be causing this NPE with the jars
> but not with classes, I'd appreciate any pointers...
>
> Army
>
> P.S. In case you're interested, I see the following results when using
> the "classes" directory.  Note that the changes I hope to make for the
> 10.2 release will catch the "class not found" type of exceptions and
> print something more friendly.  In the meantime, though:
>
> Sun 1.3 (expected failure because XML interfaces aren't part of 1.3):
>
> ERROR 38000: The exception 'java.lang.NoClassDefFoundError:
> org/xml/sax/ErrorHandler' was thrown while evaluating an expression.
> ERROR XJ001: Java exception: 'org/xml/sax/ErrorHandler:
> java.lang.NoClassDefFoundError'.
>
> IBM 1.3 (expected failure because XML interfaces aren't part of 1.3):
>
> ERROR 38000: The exception 'java.lang.NoClassDefFoundError:
> javax/xml/transform/Result' was thrown while evaluating an expression.
> ERROR XJ001: Java exception: 'javax/xml/transform/Result:
> java.lang.NoClassDefFoundError'.
>
> Sun 1.4.2, 1.5:
>
> ERROR 2200L: XMLPARSE operand is not an XML document; see next
> exception for details.
> ERROR XJ001: Java exception: 'SAX2 driver class
> org.apache.xerces.parsers.SAXParser not found: org.xml.sax.SAXException'.
>
> This is an expected error if I don't have Xerces in my classpath; if I
> put Xerces in my classpath (i.e. just include xercesImpl.jar), then
> the insert statement succeeds.
>
> IBM 1.4.2:
>
> Statement succeeds (because Xerces is part of the IBM 1.4.2 jvm).
>
>
>


Re: XMLPARSE usage?

Posted by Andrew McIntyre <mc...@gmail.com>.
On 2/14/06, Army <qo...@sbcglobal.net> wrote:
>
> But in the meantime, thanks for bringing this to my attention.  If anyone out
> there knows what might be causing this NPE with the jars but not with classes,
> I'd appreciate any pointers...

derby.jar is missing
org.apache.derby.impl.sql.compile.XMLTypeCompiler. If this class is
not directly referenced by any other class, then you will need to add
it to tools/jar/extraDBMSclasses.properties in order for it to be
pulled into the jar build.

andrew

Re: XMLPARSE usage?

Posted by Army <qo...@sbcglobal.net>.
Rajesh Kartha wrote:
> The 10.2 build you have is an old one. Try in the latest codeline and it
> should work.
> 
> On 2/14/06, Susan Cline <ho...@pacbell.net> wrote:
>>
>>However, when I try the following I get errors:
>>
>>ij> create table xmltab (id integer, xml_col xml);
>>
>>ij> insert into xmltab values (1, xmlparse(document '<simp> doc
>></simp>'preserve whitespace));
>>ERROR XJ001: Java exception: ': java.lang.NullPointerException'.

The syntax is still as documented, so your statement is correct.

It looks like the problem is with the jar files--when I tried your statement 
against the classes directory with various JVMs, I got the expected results (see 
  "PS" below).  But when I tried to do it against the jars (10.2.0.0 alpha - 
(377424), I see the same NPE that you do:

java.lang.NullPointerException
	at 
org.apache.derby.impl.sql.compile.TypeCompilerFactoryImpl.getAnInstance(TypeCompilerFactoryImpl.java:318)
	at 
org.apache.derby.impl.sql.compile.TypeCompilerFactoryImpl.staticGetTypeCompiler(TypeCompilerFactoryImpl.java:263)
	at 
org.apache.derby.impl.sql.compile.TypeCompilerFactoryImpl.getTypeCompiler(TypeCompilerFactoryImpl.java:81)
	at 
org.apache.derby.impl.sql.compile.QueryTreeNode.getTypeCompiler(QueryTreeNode.java:726)
	at org.apache.derby.impl.sql.compile.ValueNode.getTypeCompiler(ValueNode.java:221)
	at 
org.apache.derby.impl.sql.compile.ResultColumn.checkStorableExpression(ResultColumn.java:837)
	at 
org.apache.derby.impl.sql.compile.ResultColumnList.checkStorableExpressions(ResultColumnList.java:812)
	at org.apache.derby.impl.sql.compile.InsertNode.bind(InsertNode.java:440)

I'll try to find time to look at this.  Note that as part of my 
in-progress-but-currently-back-burnered work for the 10.2 release I will be 
enabling XML tests to run as part of derbyall, so this type of problem (where it 
only occurs against the jar files) will be caught in the regression tests.

But in the meantime, thanks for bringing this to my attention.  If anyone out 
there knows what might be causing this NPE with the jars but not with classes, 
I'd appreciate any pointers...

Army

P.S. In case you're interested, I see the following results when using the 
"classes" directory.  Note that the changes I hope to make for the 10.2 release 
will catch the "class not found" type of exceptions and print something more 
friendly.  In the meantime, though:

Sun 1.3 (expected failure because XML interfaces aren't part of 1.3):

ERROR 38000: The exception 'java.lang.NoClassDefFoundError: 
org/xml/sax/ErrorHandler' was thrown while evaluating an expression.
ERROR XJ001: Java exception: 'org/xml/sax/ErrorHandler: 
java.lang.NoClassDefFoundError'.

IBM 1.3 (expected failure because XML interfaces aren't part of 1.3):

ERROR 38000: The exception 'java.lang.NoClassDefFoundError: 
javax/xml/transform/Result' was thrown while evaluating an expression.
ERROR XJ001: Java exception: 'javax/xml/transform/Result: 
java.lang.NoClassDefFoundError'.

Sun 1.4.2, 1.5:

ERROR 2200L: XMLPARSE operand is not an XML document; see next exception for 
details.
ERROR XJ001: Java exception: 'SAX2 driver class 
org.apache.xerces.parsers.SAXParser not found: org.xml.sax.SAXException'.

This is an expected error if I don't have Xerces in my classpath; if I put 
Xerces in my classpath (i.e. just include xercesImpl.jar), then the insert 
statement succeeds.

IBM 1.4.2:

Statement succeeds (because Xerces is part of the IBM 1.4.2 jvm).


Re: XMLPARSE usage?

Posted by Rajesh Kartha <ka...@gmail.com>.
I should have tried with jars. Looks like the jar files are missing
something during build, I get the same exception when I use jars instead of
the codeline (after a recent svn update)

The derby.log shows:
Database Class Loader started - derby.database.classpath=''
2006-02-14 19:49:16.100 GMT Thread[main,5,main] (XID = 126), (SESSIONID =
0), (D
ATABASE = xmldb), (DRDAID = null), Cleanup action starting
2006-02-14 19:49:16.100 GMT Thread[main,5,main] (XID = 126), (SESSIONID =
0), (D
ATABASE = xmldb), (DRDAID = null), Failed Statement is: insert into xmltab
value
s (1, xmlparse(document '<simp> doc </simp>'preserve whitespace))
java.lang.NullPointerException
        at
org.apache.derby.impl.sql.compile.ResultColumn.checkStorableExpressio
n(ResultColumn.java:837)
        at
org.apache.derby.impl.sql.compile.ResultColumnList.checkStorableExpre
ssions(ResultColumnList.java:812)
        at org.apache.derby.impl.sql.compile.InsertNode.bind(InsertNode.java
:440
)
        at org.apache.derby.impl.sql.GenericStatement.prepMinion
(GenericStatemen
t.java:344)
        at org.apache.derby.impl.sql.GenericStatement.prepare(
GenericStatement.j
ava:118)
        at
org.apache.derby.impl.sql.conn.GenericLanguageConnectionContext.prepa
reInternalStatement(GenericLanguageConnectionContext.java:720)
        at org.apache.derby.impl.jdbc.EmbedStatement.execute(
EmbedStatement.java
:533)
        at org.apache.derby.impl.jdbc.EmbedStatement.execute(
EmbedStatement.java
:480)
        at org.apache.derby.impl.tools.ij.ij.executeImmediate(ij.java:313)
        at org.apache.derby.impl.tools.ij.utilMain.doCatch(utilMain.java
:433)
        at org.apache.derby.impl.tools.ij.utilMain.go(utilMain.java:310)
        at org.apache.derby.impl.tools.ij.Main.go(Main.java:203)
        at org.apache.derby.impl.tools.ij.Main.mainCore(Main.java:169)
        at org.apache.derby.impl.tools.ij.Main14.main(Main14.java:55)
        at org.apache.derby.tools.ij.main(ij.java:60)
Cleanup action completed

I will log a JIRA for this.

Regards,
Rajesh

On 2/14/06, Rajesh Kartha <ka...@gmail.com> wrote:
>
> The 10.2 build you have is an old one. Try in the latest codeline and it
> should work.
>
>
> ij> create table xmltab (id integer, xml_col xml);
> 0 rows inserted/updated/deleted
> ij> insert into xmltab values (1, xmlparse(document '<simp> doc
> </simp>'preserve whitespace));
> 1 row inserted/updated/deleted
> ij> insert into xmltab values (1, xmlparse(document '<simp> doc </simp>'
> preserve whitespace));
> 1 row inserted/updated/deleted
> ij> insert into xmltab values (6, xmlparse(document '<half> <masted> bass
> </masted> boosted. </half>' preserve whitespace));
> 1 row inserted/updated/deleted
>
>
> Regards,
> Rajesh
>
> On 2/14/06, Susan Cline <ho...@pacbell.net> wrote:
> >
> > Hi,
> >
> > I'm trying to use the XMLPARSE functionality that I believe is available
> > in the 10.2 snapshot
> > jars;
> >
> > truncated sysinfo output:
> >
> > [C:\derby\db-derby-snapshot-10.2.0.0-372122\lib\derby.jar] 10.2.0.0alpha - (372122)
> > [C:\derby\db-derby-snapshot-10.2.0.0-372122\lib\derbytools.jar] 10.2.0.0alpha -
> > (372122)
> >
> > I found this post from May 2005 that had the correct usage at the time
> > the initial patch was
> > posted:
> >
> > http://mail-archives.apache.org/mod_mbox/db-derby-dev/200505.mbox/%3C4294CF0A.5060406@sbcglobal.net%3E
> >
> >
> > [ from the above post ]
> >
> > Syntax is as follows:
> >
> > XMLPARSE( DOCUMENT <string-value-expression> PRESERVE WHITESPACE )
> >
> > Ex:
> >
> > ij> INSERT INTO xTable VALUES (1, XMLPARSE(DOCUMENT '<simp> doc </simp>'
> >
> > PRESERVE WHITESPACE));
> > 1 row inserted/updated/deleted
> >
> > [ end post ]
> >
> > However, when I try the following I get errors:
> >
> > ij> create table xmltab (id integer, xml_col xml);
> >
> > ij> insert into xmltab values (1, xmlparse(document '<simp> doc
> > </simp>'preserve whitespace));
> > ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
> >
> > ij> insert into xmltab values (1, xmlparse(document '<simp> doc </simp>'
> > preserve whitespace));
> > ERROR 40XT0: An internal error was identified by RawStore module.
> >
> > Has the syntax for XMLPARSE changed?
> >
> > If so, can someone post the correct syntax?  Similarly, if the syntax
> > for XMLSERIALIZE and
> > XMLEXISTS has changed I'd like that information as well.
> >
> > Thanks!
> >
> > Susan
> >
>
>

Re: XMLPARSE usage?

Posted by Rajesh Kartha <ka...@gmail.com>.
The 10.2 build you have is an old one. Try in the latest codeline and it
should work.


ij> create table xmltab (id integer, xml_col xml);
0 rows inserted/updated/deleted
ij> insert into xmltab values (1, xmlparse(document '<simp> doc
</simp>'preserve whitespace));
1 row inserted/updated/deleted
ij> insert into xmltab values (1, xmlparse(document '<simp> doc </simp>'
preserve whitespace));
1 row inserted/updated/deleted
ij> insert into xmltab values (6, xmlparse(document '<half> <masted> bass
</masted> boosted. </half>' preserve whitespace));
1 row inserted/updated/deleted


Regards,
Rajesh

On 2/14/06, Susan Cline <ho...@pacbell.net> wrote:
>
> Hi,
>
> I'm trying to use the XMLPARSE functionality that I believe is available
> in the 10.2 snapshot
> jars;
>
> truncated sysinfo output:
>
> [C:\derby\db-derby-snapshot-10.2.0.0-372122\lib\derby.jar] 10.2.0.0 alpha
> - (372122)
> [C:\derby\db-derby-snapshot-10.2.0.0-372122\lib\derbytools.jar] 10.2.0.0alpha -
> (372122)
>
> I found this post from May 2005 that had the correct usage at the time the
> initial patch was
> posted:
>
>
> http://mail-archives.apache.org/mod_mbox/db-derby-dev/200505.mbox/%3C4294CF0A.5060406@sbcglobal.net%3E
>
> [ from the above post ]
>
> Syntax is as follows:
>
> XMLPARSE( DOCUMENT <string-value-expression> PRESERVE WHITESPACE )
>
> Ex:
>
> ij> INSERT INTO xTable VALUES (1, XMLPARSE(DOCUMENT '<simp> doc </simp>'
> PRESERVE WHITESPACE));
> 1 row inserted/updated/deleted
>
> [ end post ]
>
> However, when I try the following I get errors:
>
> ij> create table xmltab (id integer, xml_col xml);
>
> ij> insert into xmltab values (1, xmlparse(document '<simp> doc
> </simp>'preserve whitespace));
> ERROR XJ001: Java exception: ': java.lang.NullPointerException'.
>
> ij> insert into xmltab values (1, xmlparse(document '<simp> doc </simp>'
> preserve whitespace));
> ERROR 40XT0: An internal error was identified by RawStore module.
>
> Has the syntax for XMLPARSE changed?
>
> If so, can someone post the correct syntax?  Similarly, if the syntax for
> XMLSERIALIZE and
> XMLEXISTS has changed I'd like that information as well.
>
> Thanks!
>
> Susan
>