You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Phil Friedman <pf...@terralink.com> on 2002/05/13 18:27:16 UTC

Xalan 2.0.1 vs 2.3.1 SQL Extension problems

I'm upgrading From Xalan 2.0.1 to 2.3.1 and having problems wih the SQL
Extensions. Any suggestions would be appreciated. I'm using NetDirect'
JDataServer 2.19.9 to access FoxPro .dbf files. My JVM is 1.3.1, on
Win2K SP2. I'm using the commandline xslt processor.

The JDataServer log looks very different for the same XML and XSL files:

Xalan 2.0.1:

2002-05-09 14:05:49 Created statement 1 for client id:2
2002-05-09 14:05:49 update aldr set ld_wname= strtran( ld_wname , chr(31) , '{31}' ) \
where 0!= at( chr(31), ld_wname) 2002-05-09 14:05:49    -> Send socket 328 Statement, \
Execute Direct, ID:10 Con:1 Stmt:2, Status=1 2002-05-09 14:05:49    <- Recv socket \
328 Statement, Execute Direct, ID:10 Con:1 Stmt:3

Xalan 2.3.1:

2002-05-09 14:01:04 Created a new connection in slot 2
2002-05-09 14:01:04 Connection 2 connected to T32CWD
2002-05-09 14:01:04    -> Send socket 248 Connection, Connect, ID:7 Con:0 Stmt:0, \
Status=1 2002-05-09 14:01:04    <- Recv socket 248 Statement, Execute Direct, ID:10 \
Con:2 Stmt:0 2002-05-09 14:01:04 Created statement 0 for client id:0
2002-05-09 14:01:04 update aldr set ld_wname= strtran( ld_wname , chr(31) , '{31}' ) \
where 0!= at( chr(31), ld_wname) 2002-05-09 14:01:04    -> Send socket 248 Statement, \
Execute Direct, ID:10 Con:2 Stmt:0, Status=1 2002-05-09 14:01:04 Started thread for \
socket 368 2002-05-09 14:01:04    <- Recv socket 368 Connection, Connect, ID:7 Con:0 \
Stmt:0

Eventually Xalan 2.0.1 completes some 10K similiar sql statements, but
2.3.1 eventually causes:

2002-05-09 14:02:45 Socket thead failed to create

Why does 2.3.1 seem to be creating a new connection for each SQL
statement?

Here's how I connect 2.0.1:

    <xsl:variable name="DbCon" select="sql:new( $DbDrvr, $DbUrl)"/>

2.3.1:

    <xsl:variable name="DbCon" select="sql:new()"/>
    <xsl:if test="not(sql:connect($DbCon, $DbDrvr, $DbUrl))">
      <xsl:message>Error Connecting to the Database:</xsl:message>
      <xsl:copy-of select="sql:getError($DbCon)/ext-error"/>
    </xsl:if>
    <xsl:value-of select="sql:disableStreamingMode($DbCon)"/>

Here's the recursive template that actually executes the SQL:

  <xsl:template name = "tblClnCol4n">  
    <xsl:param name = "DbCon"/>
    <xsl:param name = "table-name"/> 
    <xsl:param name = "n"/>  
    <!--  -->
    <xsl:if test = "9!= $n and 10!= $n and 13!= $n">    
      <xsl:variable name = "sql">
        update <xsl:value-of select = "$table-name"/> set <xsl:value-of select = \
"@column-name"/>= strtran( <xsl:value-of select = "@column-name"/>                    \
, chr(<xsl:value-of select = "$n"/>)  , '{<xsl:value-of select = "$n"/>}'
                                                                                      \
                )
           where 0!= at( chr(<xsl:value-of select = "$n"/>), <xsl:value-of select = \
"@column-name"/>)  </xsl:variable>    
      <xsl:variable name = "qy" select = "sql:query( $DbCon, normalize-space( \
$sql))"/>      <xsl:if test = "$msg-sql">      
        <xsl:message><xsl:value-of select = "normalize-space( $sql)"/></xsl:message>
      </xsl:if>    
      <!--! no results, so ignore error... <xsl:apply-templates \
select="$qy/ext-error"/> -->          </xsl:if>  
    <xsl:if test = "0!= $n">    
      <xsl:call-template name = "tblClnCol4n">      
        <xsl:with-param name = "DbCon" select = "$DbCon"/>      
        <xsl:with-param name = "table-name" select = "$table-name"/> 
        <xsl:with-param name = "n" select = "$n -1"/>    
      </xsl:call-template>  
    </xsl:if>
  </xsl:template> <!-- tblClnCol4n -->


Regards,  Philip Friedman -- Terralink Software Systems -- 207-772-6500
x101