You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by jo...@apache.org on 2005/07/28 02:33:49 UTC

cvs commit: xml-xalan/java/samples/extensions/sql/ext-connection dbtest.xsl ExternalConnection.java

johng       2005/07/27 17:33:49

  Modified:    java/samples/extensions/sql/ext-connection dbtest.xsl
                        ExternalConnection.java
  Log:
  
  PR:XalanJ-2172	
  Obtained from:
  Submitted by:	John Gentilin	
  Reviewed by:	Yas Talwar
  CVS: ----------------------------------------------------------------------
  CVS: Change Example file to utilize the Apache Derby DBMS
  
  Revision  Changes    Path
  1.5       +58 -58    xml-xalan/java/samples/extensions/sql/ext-connection/dbtest.xsl
  
  Index: dbtest.xsl
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/samples/extensions/sql/ext-connection/dbtest.xsl,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- dbtest.xsl	24 Aug 2001 04:44:59 -0000	1.4
  +++ dbtest.xsl	28 Jul 2005 00:33:49 -0000	1.5
  @@ -1,59 +1,59 @@
  -<?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="query" select="'SELECT * FROM import1'"/>
  -
  -<xsl:template match="/">
  -    <xsl:variable name="db" select="sql:new()"/>
  -
  -    <!-- Connect to the database with minimal error detection -->
  -		<xsl:if test="not(sql:connect($db, 'extpool'))" >
  -    	<xsl:message>Error Connecting to the Database</xsl:message>
  -      <xsl:copy-of select="sql:getError($db)/ext-error" />
  -    </xsl:if>
  -    
  -
  -    <HTML>
  -      <HEAD>
  -        <TITLE>List of products</TITLE>
  -      </HEAD>
  -      <BODY>
  -        <TABLE border="1">
  -          <xsl:variable name="table" select='sql:query($db, $query)'/>
  -          
  -          <!-- 
  -          	Let's include Error Checking, the error is actually stored 
  -            in the connection since $table will be either data or null
  -          -->
  -             
  -          <xsl:if test="not($table)" >
  -          	<xsl:message>Error in Query</xsl:message>
  -            <xsl:copy-of select="sql:getError($db)/ext-error" />
  -          </xsl:if>
  -          
  -          <TR>
  -             <xsl:for-each select="$table/sql/metadata/column-header">
  -               <TH><xsl:value-of select="@column-label"/></TH>
  -             </xsl:for-each>
  -          </TR>
  -          <xsl:apply-templates select="$table/sql/row-set/row"/>
  -        </TABLE>
  -      </BODY>
  -    </HTML>
  -    <xsl:value-of select="sql:close($db)"/>
  -</xsl:template>
  -
  -<xsl:template match="row">
  -  <TR><xsl:apply-templates select="col"/></TR>
  -</xsl:template>
  -
  -<xsl:template match="col">
  -  <TD><xsl:value-of select="text()"/></TD>
  -</xsl:template>
  -
  +<?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="query" select="'SELECT * FROM import1'"/>
  +
  +<xsl:template match="/">
  +    <xsl:variable name="db" select="sql:new()"/>
  +
  +    <!-- Connect to the database with minimal error detection -->
  +		<xsl:if test="not(sql:connect($db, 'extpool'))" >
  +    	<xsl:message>Error Connecting to the Database</xsl:message>
  +      <xsl:copy-of select="sql:getError($db)/ext-error" />
  +    </xsl:if>
  +    
  +
  +    <HTML>
  +      <HEAD>
  +        <TITLE>List of products</TITLE>
  +      </HEAD>
  +      <BODY>
  +        <TABLE border="1">
  +          <xsl:variable name="table" select='sql:query($db, $query)'/>
  +          
  +          <!-- 
  +          	Let's include Error Checking, the error is actually stored 
  +            in the connection since $table will be either data or null
  +          -->
  +             
  +          <xsl:if test="not($table)" >
  +          	<xsl:message>Error in Query</xsl:message>
  +            <xsl:copy-of select="sql:getError($db)/ext-error" />
  +          </xsl:if>
  +          
  +          <TR>
  +             <xsl:for-each select="$table/sql/metadata/column-header">
  +               <TH><xsl:value-of select="@column-label"/></TH>
  +             </xsl:for-each>
  +          </TR>
  +          <xsl:apply-templates select="$table/sql/row-set"/>
  +        </TABLE>
  +      </BODY>
  +    </HTML>
  +    <xsl:value-of select="sql:close($db)"/>
  +</xsl:template>
  +
  +<xsl:template match="row">
  +  <TR><xsl:apply-templates select="col"/></TR>
  +</xsl:template>
  +
  +<xsl:template match="col">
  +  <TD><xsl:value-of select="text()"/></TD>
  +</xsl:template>
  +
   </xsl:stylesheet>
  \ No newline at end of file
  
  
  
  1.7       +3 -3      xml-xalan/java/samples/extensions/sql/ext-connection/ExternalConnection.java
  
  Index: ExternalConnection.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/samples/extensions/sql/ext-connection/ExternalConnection.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- ExternalConnection.java	17 Feb 2004 19:14:20 -0000	1.6
  +++ ExternalConnection.java	28 Jul 2005 00:33:49 -0000	1.7
  @@ -48,8 +48,8 @@
     // Create a connection to the database server
     // Up the connection pool count for testing
     DefaultConnectionPool cp = new DefaultConnectionPool();
  -  cp.setDriver("org.enhydra.instantdb.jdbc.idbDriver");
  -  cp.setURL("jdbc:idb:../../instantdb/sample.prp");
  +  cp.setDriver("org.apache.derby.jdbc.EmbeddedDriver");
  +  cp.setURL("jdbc:derby:sampleDB");
     //cp.setUser("sa");
     //cp.setPassword("");
     cp.setMinConnections(10);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: xalan-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: xalan-cvs-help@xml.apache.org