You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xalan.apache.org by "Loren M. Lang" <lo...@north-winds.org> on 2010/12/09 01:02:07 UTC

Xalan XSLT and SQL

I'm trying to use the SQL extension for Xalan to generate an XML
document from a MySQL database.  I have the MySQL J/Connector in my
class path, but I get an error with sql:new() trying to load the driver:

$ java -classpath
mysql-connector-java-5.1.13/mysql-connector-java-5.1.13-bin.jar -jar
xalan-j_2_7_1/xalan.jar -xsl xalan-sql.xsl

xalan-sql.xsl; Line #8; Column #129; java.lang.IllegalArgumentException:
Invalid Driver Name Specified!

According to MySQL's documentation, the driver name is
com.mysql.jdbc.Driver.  Here is the XSL file I am testing with:

<xsl:stylesheet version="1.0"
 xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
 xmlns="http://www.w3.org/1999/xhtml"
 xmlns:sql="http://xml.apache.org/xalan/sql"
 extension-element-prefixes="sql">
  <xsl:output method="html"/>
  <xsl:template match="/">
    <xsl:variable name="products"
select="sql:new('com.mysql.jdbc.Driver', 'jdbc:mysql://localhost/test',
'user', 'password')"/>
  </xsl:template>
</xsl:stylesheet>

Any ideas?  I have used J/Connector before with other Java programs.

-- 
Loren M. Lang
lorenl@north-winds.org
http://www.north-winds.org/


Public Key: ftp://ftp.north-winds.org/pub/lorenl_pubkey.asc
Fingerprint: 10A0 7AE2 DAF5 4780 888A  3FA4 DCEE BB39 7654 DE5B


Re: Xalan XSLT and SQL

Posted by Michael Ludwig <mi...@gmx.de>.
Moin Loren,

Loren M. Lang schrieb am 08.12.2010 um 16:02 (-0800):
> I'm trying to use the SQL extension for Xalan to generate an XML
> document from a MySQL database.  I have the MySQL J/Connector in my
> class path, but I get an error with sql:new() trying to load the driver:
> 
> $ java -classpath
> mysql-connector-java-5.1.13/mysql-connector-java-5.1.13-bin.jar -jar
> xalan-j_2_7_1/xalan.jar -xsl xalan-sql.xsl

You're using the -jar option, so your -classpath will be ignored.

> xalan-sql.xsl; Line #8; Column #129; java.lang.IllegalArgumentException:
> Invalid Driver Name Specified!

Quote from the doc page "java - the Java application launcher":

  -jar

  […] When you use this option, the JAR file is the source of all user
  classes, and other user class path settings are ignored.

http://localhost/javadoc/technotes/tools/windows/java.html

-- 
Michael Ludwig