i need to import data extracted from my xml documents into an oracle database. Since it is only for internal use the saxon-sql-extension sounds suitble. However, all attempts to get it to work failed so far (using oxygen 16.0)...
my script:
Code: Select all
<xsl:transform version="3.0"
xmlns:xsl = "http://www.w3.org/1999/XSL/Transform"
xmlns:xs = "http://www.w3.org/2001/XMLSchema"
xmlns:err = "http://www.w3.org/2005/xqt-errors"
xmlns:saxon = "http://saxon.sf.net/"
xmlns:sql = "http://saxon.sf.net/sql"
extension-element-prefixes="saxon sql"
exclude-result-prefixes="#all">
<xsl:template match="/">
<xsl:variable name="driver" select="'oracle.jdbc.OracleDriver'"/>
<xsl:variable name="database" select="'jdbc:oracle:thin:@xxx'"/>
<xsl:variable name="user" select="'xxx'"/>
<xsl:variable name="password" select="'xxx'"/>
<xsl:try>
<sql:connect driver="{$driver}" database="{$database}" user="{$user}" password="{$password}"/>
<xsl:message>
<sql:query table="table" column="*"/>
</xsl:message>
<sql:close/>
<xsl:catch>
<xsl:message>ERROR: <xsl:value-of select="$err:description"/></xsl:message>
</xsl:catch>
</xsl:try>
</xsl:template>
</xsl:transform>
Using xsl:fallback within sql:connect (as int the example provided by saxon) results to a null pointer exception so I uses xsl:try/catch.
saxon9-sql.jar is present in oxygen-lib folder. I also added saxon9-sql.jar explicitly to the transformation scenario but it had no effect.
I uses a configuration file to map the sql namespace to the factory but it had no effect.
Code: Select all
<configuration xmlns="http://saxon.sf.net/ns/configuration" edition="EE">
<global allowExternalFunctions="true" versionOfXml="1.0"/>
<xslt>
<extensionElement namespace="http://net.sf.saxon/sql"
factory="net.sf.saxon.option.sql.SQLElementFactory"/>
</xslt>
</configuration>
Now I'm runing out of options.
Any ideas what might go wrong? Or is there an alternative to import data from xml (generated with xslt) into an oracle database?
Thanks and regards,
Patrik