DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11788>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=11788

Basic-Connection SQL Extension Sample  Failed If data column is defined as data type  
nvarchar

           Summary: Basic-Connection SQL Extension Sample  Failed If data
                    column is defined as data type  nvarchar
           Product: XalanJ2
           Version: 2.3Dx
          Platform: PC
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Critical
          Priority: Other
         Component: org.apache.xalan.lib.sql
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]
                CC: [EMAIL PROTECTED]


This problem is involving the
xalan-j_2_3_1\samples\extensions\sql\basic-connection\DumpSQL.xsl

Xalan is unable to retrieve data for column in MSSQL Server if the column is 
defined as data type nvarchar.  All the other columns returned correctly.

To reproduce the problem please do the following or see the complete source 
file: (Modified Complete Source File also included)

1) Create a Data Source Name in Windows call NWDSN
- ensure that this is pointing to the Northwind sample database as default

2) Modified the "driver" and "datasource" param name in the DumpSQL.xsl
<xsl:param name="driver" select="'sun.jdbc.odbc.JdbcOdbcDriver'"/>
<xsl:param name="datasource" select="'jdbc:odbc:NWDSN'"/>

3)Add two param name
<xsl:param name="cid" select="'sa'"/>
<xsl:param name="psw" select="'12345678'"/>

4) Change the query to the select the products table
<xsl:param name="query" select="'SELECT * FROM Products'"/>

5) Final change the connection statement to include connection id and password
<xsl:variable name="db" select="sql:new($driver, $datasource, $cid, $psw)"/>


Complete Modified DumpSQL.XSL file
<?xml version="1.0"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform";
                version="1.0"
                xmlns:sql="org.apache.xalan.lib.sql.XConnection"
                extension-element-prefixes="sql">

<xsl:output method="html" indent="yes"/>

<xsl:param name="driver" select="'sun.jdbc.odbc.JdbcOdbcDriver'"/>
<xsl:param name="datasource" select="'jdbc:odbc:NWDSN'"/>
<xsl:param name="cid" select="'sa'"/>
<xsl:param name="psw" select="'12345678'"/>
<xsl:param name="query" select="'SELECT * FROM Products'"/>

<xsl:template match="/">
    <xsl:variable name="db" select="sql:new($driver, $datasource, $cid, $psw)"/>
    <xsl:variable name="table" select='sql:query($db, $query)'/>
    <xsl:copy-of select="$table" />
    <xsl:value-of select="sql:close($db)"/>
</xsl:template>

</xsl:stylesheet>

Reply via email to