Topic
  • 5 replies
  • Latest Post - ‏2013-12-25T08:03:43Z by Venkateswararao Mudili
SystemAdmin
SystemAdmin
6772 Posts

Pinned topic DataPower and SQL

‏2009-02-02T11:24:29Z |
Does anyone know how to select records from database table using stylesheet? i have created the following xsl file and add it to the policy of xml firewall. When I try the same sql statement using a static approach in the sql action I get right results, but when I select this style sheet it logs an error message saying: sql cannot generate output text. Any idea of this problem.

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:dp="http://www.datapower.com/extensions"
extension-element-prefixes="dp "
exclude-result-prefixes="dp">

<xsl:output method="xml" />

<xsl:template match="/">
<xsl:variable name="query">SELECT * FROM ADMINISTRATOR.EMPLOYEE</xsl:variable>
<xsl:variable name="result" select="dp:sql-execute('db2datasource',$query)" />
<xsl:copy-of select="$result" />
</xsl:template>

</xsl:stylesheet>

Updated on 2009-02-10T12:14:50Z at 2009-02-10T12:14:50Z by BobCallaway
  • rrwood
    rrwood
    79 Posts

    Re: DataPower and SQL

    ‏2009-02-02T20:20:11Z  
    Is your SQL data source set up correctly?
    The latest firmware docs (3.7.2-Extensions-Common.pdf) have greatly improved SQL examples, compared to the earlier docs.
    There is also a great article here:

    http://www.ibm.com/developerworks/websphere/library/techarticles/0812_callaway/0812_callaway.html
  • SystemAdmin
    SystemAdmin
    6772 Posts

    Re: DataPower and SQL

    ‏2009-02-05T07:59:30Z  
    • rrwood
    • ‏2009-02-02T20:20:11Z
    Is your SQL data source set up correctly?
    The latest firmware docs (3.7.2-Extensions-Common.pdf) have greatly improved SQL examples, compared to the earlier docs.
    There is also a great article here:

    http://www.ibm.com/developerworks/websphere/library/techarticles/0812_callaway/0812_callaway.html
    The data source is working fine, i can validate that by using static sql statements. I was trying the same article when I got the errors from my xsl; are the source files for this article available for download somewhere; because the problem may be in one of the policy or rules settings.

    Thanks
  • SystemAdmin
    SystemAdmin
    6772 Posts

    Re: DataPower and SQL

    ‏2009-02-05T08:00:46Z  
    The data source is working fine, i can validate that by using static sql statements. I was trying the same article when I got the errors from my xsl; are the source files for this article available for download somewhere; because the problem may be in one of the policy or rules settings.

    Thanks
  • BobCallaway
    BobCallaway
    1 Post

    Re: DataPower and SQL

    ‏2009-02-10T12:14:50Z  
    If you are using the "stylesheet" approach in an SQL action, it is expecting the XSLT to output the SQL statement as text to be executed against the database (can be achieved with the following XSLT):

    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:output method="text" />

    <xsl:template match="/">
    SELECT * FROM ADMINISTRATOR.EMPLOYEE
    </xsl:template>

    </xsl:stylesheet>

    This provides you flexibility to utilize all of the DP XSLT functions in crafting an SQL statement to be executed.
  • Venkateswararao Mudili
    2 Posts

    Re: DataPower and SQL

    ‏2013-12-25T08:03:43Z  
    If you are using the "stylesheet" approach in an SQL action, it is expecting the XSLT to output the SQL statement as text to be executed against the database (can be achieved with the following XSLT):

    <?xml version="1.0" encoding="utf-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:output method="text" />

    <xsl:template match="/">
    SELECT * FROM ADMINISTRATOR.EMPLOYEE
    </xsl:template>

    </xsl:stylesheet>

    This provides you flexibility to utilize all of the DP XSLT functions in crafting an SQL statement to be executed.

    I''m also facing the same issue ...Thankq so much for ur help