5 Replies Latest reply on Aug 15, 2003 7:00 AM by j.mann

    Mysql and JBossDO

    j.mann Newbie


      I am attempting to connect jbossdo-example to a Mysql database.

      However, I discovered the following calls return an UnsupportedOperationException:

      pmf.setConnectionDriverName("com.mysql.jdbc.Driver");
      pmf.setConnectionURL("jdbc:mysql://localhost/jboss");
      pmf.setConnectionUserName("jboss");

      How do I connect JBossDO to a Mysql database?

      Thanks.
      J. Mann

        • 1. Re: Mysql and JBossDO
          crosscourt Newbie

          can you get the index.jsp to display?

          I am using mysql and i had to change the setup.sql
          (the varchar() to text) to create the tables.

          I can build successfully but i get errors at http://localhost:8080/jbossdo-example/



          javax.jdo.JDOFatalDataStoreException: Failed to execute statement: SELECT COMMENT.OID FROM COMMENT COMMENT ORDER BY COMMENT.PUBLISHDATE ASC
          at org.jboss.persistence.jbossdo.command.JDOAbstractCommand.executeQuery(JDOAbstractCommand.java:178)
          at org.jboss.persistence.jbossdo.JBossQuery.execute(JBossQuery.java:134)
          at org.apache.jsp.index_jsp._jspService(index_jsp.java:191)
          at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:137)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
          at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:210)
          at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
          at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:241)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:247)

          • 2. Re: Mysql and JBossDO
            j.mann Newbie

            > can you get the index.jsp to display?

            Yes, but I am using a simplified version of jbossdo-example.
            I have stripped out everything but the Comment object.

            > I am using mysql and i had to change the setup.sql
            > (the varchar() to text) to create the tables.

            Yes, I encountered this.

            > I can build successfully but i get errors at
            > http://localhost:8080/jbossdo-example/
            >
            > javax.jdo.JDOFatalDataStoreException: Failed to
            > execute statement: SELECT COMMENT.OID FROM COMMENT
            > COMMENT ORDER BY COMMENT.PUBLISHDATE ASC

            The problem is the servlet is still connecting to hsqldb.

            The "build.properties" only configures Ant to connect to Mysql.

            You need something like this, in initdestroy.jsp

            pmf = (PersistenceManagerFactory)ic.lookup("java:/PersistenceManagerFactory");

            pmf.setConnectionDriverName("com.mysql.jdbc.Driver");
            pmf.setConnectionURL("jdbc:mysql://localhost/jboss");
            pmf.setConnectionUserName("jboss");
            ...

            However, they don't seem to be implemented yet...

            http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/jboss/jboss-persistence/src/main/org/jboss/persistence/jbossdo/PersistenceManagerFactoryImpl.java?rev=1.3&content-type=text/vnd.viewcvs-markup

            Cheers,
            J. Mann

            • 3. Re: Mysql and JBossDO
              crosscourt Newbie

              ok, i added the MySql-ds.xml modified with my own settings,

              changed all the java:defaultDS to java:MySqlDS in the .jdo files for the sample app but it still gives:

              javax.jdo.JDOFatalDataStoreException: Failed to execute statement: SELECT COMMENT.OID FROM COMMENT COMMENT ORDER BY COMMENT.PUBLISHDATE ASC

              • 4. Re: Mysql and JBossDO
                crosscourt Newbie

                ok i got the sample working with mysql
                after i studied on datasources

                • 5. Re: Mysql and JBossDO
                  j.mann Newbie

                   

                  "J. Mann" wrote:
                  > ok, i added the MySql-ds.xml modified with my own
                  > settings,
                  >
                  > changed all the java:defaultDS to java:MySqlDS in the
                  > .jdo files for the sample app

                  Yes, I have done this and everything is working fine.

                  Cheers,
                  J. Mann