• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 220
  • Last Modified:

XSLT and mysql connection problem STILL

I have the following code

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"  xmlns:sql="org.apache.xalan.lib.sql.XConnection" extension-element-prefixes="sql">
      <xsl:output method="xml" indent="yes" encoding="UTF-8"/>
      <xsl:output version="1.0"/>
      <xsl:output doctype-public="ISO//Web3D//DTD X3D 3.0//EN"/>
      <xsl:output doctype-system="http://www.web3d.org/specifications/x3d-3.0.dtd"/>
      <!-- parameter setting to connect to MySQL -->
<xsl:param name="driver" select="'com.mysql.jdbc.Driver'"/>
<xsl:param name="datasource" select="'jdbc:mySQL://localhost/environment'"/>
<xsl:param name="query" select="'SELECT * FROM sample'"/>
<xsl:param name="username" select="'root'"/>
<xsl:param name="passwd" select="'*****'"/>

<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, $driver, $datasource, $username, $passwd))" >
         <xsl:message>Error Connecting to the Database</xsl:message>
      <xsl:copy-of select="sql:getError($db)/ext-error" />
      <!-- 3. Close the connection -->
      <xsl:value-of select="sql:close($db)"/>

I have made sure the password is correct and the database name.

I had this working only yesterday but running the script again it does not work.

1 Solution
adam391Author Commented:
the error message i get is No suitable driver
You may want to double check your environment and make sure that the
jdbc-driver jar file is inside %mySQL_Home%/bin directory. And the param
$database should be case sensitive, right? :
<xsl:param name= "datasource " select= " 'jdbc:mySQL://localhost:3306/test ' "/ >

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now