Project

Profile

Help

Support #1703

closed

Simple question - 9.1 sql extension

Added by Tony Slosar almost 12 years ago. Updated over 11 years ago.

Status:
Closed
Priority:
Low
Assignee:
-
Category:
Saxon extensions
Sprint/Milestone:
-
Start date:
2013-02-19
Due date:
% Done:

0%

Estimated time:
Legacy ID:
Applies to branch:
Fix Committed on Branch:
Fixed in Maintenance Release:
Platforms:

Description

Hello and thanks for your time to look at this.

I know it is a stupid question but I keep banging my head and can't get it to work.

We have 9.1 in production and I just want to do some simple queries but I can't get the extension to work.

Following is the xslt which is correct as far as I can tell.

I don't want to enable the extension for all transformations if I can help it but if I have to use a config.xml where does it go? The sql jar is in the same directory so I should not have a path issue.

I am working on this in oXygen but will eventually be implemented on our linux server.

Help! I am stumped...

Best regards,

Tony


Files

language.xsl (1.02 KB) language.xsl Tony Slosar, 2013-02-19 17:22
Actions #2

Updated by Michael Kay almost 12 years ago

There's nothing obviously wrong with the XSLT code, but there are plenty of ways it can go wrong because of configuration issues. I'm afraid 9.1 is fading in the memory a little, and although this area hasn't changed much, some of the configuration stuff has changed a lot.

The first thing is to establish exactly (a) how you are running it, and (b) how it is failing. For maximal diagostics, use -t and -T and -TJ on the command line.

Actions #3

Updated by Tony Slosar almost 12 years ago

Thank you so much Mr. Kay for your response.

When running in oXygen I get "XTDE1450: Unknown extension instruction"

When running on the command line with -t and -T and -TJ I get: "No Java class net.sf.saxon.sql.SQLElementFactory could be loaded".

All of the saxon9-* jars are present.

Actions #4

Updated by Tony Slosar almost 12 years ago

Sorry about the strike through.

Message thrown with the options enabled:

No Java class net.sf.saxon.sql.SQLElementFactory could be loaded

Actions #5

Updated by Michael Kay almost 12 years ago

It's really useful to say exactly how you ran the command line. For example, the effect you describe is consistent with a common mistake which is to run using the ~~jar option rather than the -cp option on the command line ~~ this ignores anything on the classpath. But without seeing your command line, that's a random guess, there are many other things that could cause the same symptoms. However, we've narrowed it down to problems with loading the Saxon extension code. If you're running from the command line, that is always a classpath issue. For some reason, saxon9-sql.jar is not being found on the classpath.

Actions #6

Updated by Tony Slosar almost 12 years ago

Thanks again for your response.

I was using ~~jar however I have tried -cp and can't get it to work. I hope you can understand that I am not a java developer ~~ just wanting to do a simple query from xsl. Everything is vanilla so the standard command line syntax would be helpful.

This is what I am trying but does not work:

java -cp "/opt/lf523/tomcat/webapps/motive/WEB-INF/lib/*" saxon9.jar input.xml transform.xsl

I have tried a bunch of different combinations found via google with no luck.

Like I said, stupid question - and I know these types of questions are annoying to seasoned developers however I do not have access to a java developer.

Thank you kindly for your patience with me.

Actions #7

Updated by Michael Kay almost 12 years ago

I do appreciate the problems people have if they are new to other technologies like Java (or using the command line) as well as to XSLT, and we try to provide some beginner's advice in the documentation while avoiding reproducing the full documentation. However, as mentioned before, it's easier to tell people what they are doing wrong if they tell us exactly what they are doing).

If saxon9.jar and saxon9-sql.jar are in the folder /lib/saxon, and you're using a Unix shell, then your command line should look like this:

java -cp /lib/saxon/saxon9.jar:/lib/saxon/saxon9-sql.jar net.sf.saxon.Transform -s:source.xml -xsl:stylesheet.xsl -o:out.hthl -t

Actions #8

Updated by Tony Slosar almost 12 years ago

That worked. Thank you very much.

Have a great day!

Actions #9

Updated by Tony Slosar almost 12 years ago

Well, as you probably suspected, I didn't get any further.

Now I get: SXSQ0003: JDBC Connection Failure: com.mysql.jdbc.Driver

The classpath to the Saxon sql extension is specified in the command line but that doesn't seem to be helping here. I believe the driver is in the mysql.jar however <xsl:param name="driver" select="'jdbc:mysql://localhost/com.mysql.jdbc.Driver'"/> returns the same.

This is the documentation I am looking at - is there any other?

http://www.saxonica.com/documentation/sql-extension/connect.xml

Path to mysql.jar is /opt/lf523-motive-test/tomcat-6.0.18/lib/ext

I can't seem to think of anything else to provide - please let me know what else may help.

Again, your time helping me is greatly appreciated.

Kind regards,

Tony

Actions #10

Updated by Michael Kay almost 12 years ago

The next step is to make sure that /opt/lf523-motive-test/tomcat-6.0.18/lib/ext/mysql.jar is on the classpath. Unless you changed the command line from the one I gave you, it isn't.

At this stage unfortunately you're into JDBC territory rather than Saxon territory, which makes it more difficult to help you. I'm afraid that getting all the pieces into place to make this work can be tricky - it's one of those things that either works first time or needs a lot of fiddling about. What I often advise people is to make sure that they can connect direcly from a Java application to the database before they try doing it via Saxon - but to be honest, that's really just a way of getting Saxon out of the loop so it's clear that this isn't the place to turn for help.

Actions #11

Updated by Tony Slosar almost 12 years ago

Thanks again Mr. Kay. I think my issues are around classpath.

Actions #12

Updated by Michael Kay over 11 years ago

  • Tracker changed from Extensions to Support
  • Status changed from New to Closed

Closing this enquiry as there is no further input from the originator.

Please register to edit this issue

Also available in: Atom PDF