1 Reply Latest reply on Apr 17, 2006 11:57 AM by knightfire

    Trouble Configuring a Data Source for MySQL using JSTL

    mike.r.anderson

      I have a web app, deployed to JBoss and I'm trying to configure a data source. The latest error I'm getting, on attempting to access a page is:

      Unable to get connection, DataSource invalid: "java.sql.SQLException: No suitable driver"

      The web app is deployed to the 'smt' context:

      Here's my code:

      smt-ds.xml:


      <local-tx-datasource>
      <jndi-name>jdbc/smt</jndi-name>
      <connection-url>jdbc:mysql://localhost:3306/smt</connection-url>
      <exception-sorter-class-name>org.jboss.resource.adapter.jdbc.vendor.MySQLExceptionSorter</exception-sorter-class-name>
      <driver-class>com.mysql.jdbc.Driver</driver-class>
      <user-name>smt</user-name>
      pass

      <type-mapping>MySQL</type-mapping>

      <new-connection-sql>select count(*) from quote_of_the_day</new-connection-sql>
      <check-valid-connection-sql>select count(*) from quote_of_the_day</check-valid-connection-sql>
      </local-tx-datasource>


      web.xml (relevant part anyway):

      <?xml version="1.0" encoding="UTF-8"?>
      <web-app version="2.4"
      xmlns="http://java.sun.com/xml/ns/j2ee"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
      http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
      <display-name>smt</display-name>

      <resource-ref>
      DB Connection
      <res-ref-name>jdbc/smt</res-ref-name>
      <res-type>javax.sql.DataSource</res-type>
      <res-auth>Container</res-auth>
      </resource-ref>

      <serv...

      jboss-web.xml:

      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE jboss-web PUBLIC "-//JBoss//DTD Web Application 2.3//EN"
      "http://www.jboss.org/j2ee/dtd/jboss-web_3_0.dtd">

      <jboss-web>

      <resource-ref>
      <res-ref-name>jdbc/smt</res-ref-name>
      <jndi-name>java:jdbc/mysql</jndi-name>
      </resource-ref>

      </jboss-web>

      qotd.jsp (excerpt):

      <sql:query var="rs" dataSource="jdbc/smt">
      select quote, submitted_by, author, date_submitted
      from quote_of_the_day
      where id = ?
      <sql aram value="${maxid.rows[0].id}" />
      </sql:query>


      Change the Quote of the Day


      ${param.message}

      <!-- spacer -->

      Quote:

      ${rs.rows[0].quote}