6 Replies Latest reply on Apr 10, 2004 6:30 AM by frocco

    Looking for small mysql example app

    frocco

      Hello,

      Can someone point me to a small mysql web app that queries & displays info?

      1. Using jsp and/or servlets to talk to mysql
      2. showing how to configure jboss to allow mysql connection

      I'm new to jboss, and am lost.

      Thanks

      Frank

        • 1. Re: Looking for small mysql example app
          camel

          1. Get the latest MySQL JDBC Connector/J driver from www.mysql.com - 3.0.11 works well. Place the JAR driver file in your jboss/server/default/lib directory.

          2. Create a file called mysql-ds.xml (or anything-ds.xml) with the following contents, and drop it in the deploy directory:

          <?xml version="1.0" encoding="UTF-8"?>
          <datasources>
           <local-tx-datasource>
           <jndi-name>MysqlDS</jndi-name>
           <connection-url>jdbc:mysql://localhost/test</connection-url>
           <driver-class>com.mysql.jdbc.Driver</driver-class>
           <user-name>yourusername</user-name>
           <password>yourpassword</password>
           </local-tx-datasource>
          </datasources>
          


          Of course, replace 'yourusername' and 'yourpassword' with a username and password that can access the database.

          As for getting an app to talk to the DB, I recommend the jboss workbook that goes with o'reilly's EJB book, see http://www.oreilly.com/catalog/entjbeans3/workbooks/

          • 2. Re: Looking for small mysql example app
            frocco

            Thanks for teh help. I'll try it.

            Will JSTL work in jboss, where do I put the jstl.jar file?

            Regards,

            Frank

            • 3. Re: Looking for small mysql example app
              frocco

              I managed to get my jsp talking to mysql in jboss 4.0RC3

              I cannot get jboss 3.2.3 working.

              Does anyone know why the 4.0 works and not the 3.2.3?
              Can I unse 4.0 in production?


              Thanks

              Frank

              • 4. Re: Looking for small mysql example app
                camel

                What are you trying to do in JSP? What is the error message you get from JBoss 3.2.3?

                JBoss 3.2.3 defaults to Tomcat 4.1, not 5.0. You may need 5.0 to use parts of the JSTL. You can install Tomcat 5.0 in Jboss 3.2.3 by running the ant script in the jboss\docs\examples\tomcat directory. Also Jboss 3.2.4RC1 defaults to Tomcat 5 and I've used JSTL with it.

                • 5. Re: Looking for small mysql example app
                  frocco

                  Here is the message:
                  org.apache.jasper.JasperException: This absolute uri (http://java.sun.com/jsp/jstl/sql) cannot be resolved in either web.xml or the jar files deployed with this application

                  Here is the jsp file contents
                  <%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>
                  <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>






                  Thanks for the help.
                  Frank

                  • 6. Re: Looking for small mysql example app
                    frocco

                    I replaced the tomcat 4.1 server with the 5.0 version.
                    I get this error message now using the test.jsp file above

                    javax.servlet.ServletException: javax.servlet.jsp.tagext.TagAttributeInfo.(Ljava/lang/String;ZLjava/lang/String;ZZ)V
                    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:256)
                    javax.servlet.http.HttpServlet.service(HttpServlet.java:853)