3 Replies Latest reply on May 1, 2013 5:16 PM by Lincoln Baxter III

    How do I configure a forge prj for using mysql ?

    thorman Newbie

      I haven't found any examples on how to configure a forge project to connect to an actual database.

       

      I tried the following to connect to my MySql database ab_log

       

       

      new-project --named test2 --topLevelPackage se.miman.t2 --projectFolder test2

       

      persistence setup --provider HIBERNATE --container JBOSS_AS7 --database MYSQL5_INNODB --jdbcURL jdbc:mysql://devdb:3306/ab_log --jdbcUsername root --jdbcPassword passw --named AbLogDbPu --driver com.mysql.jdbc.Driver

       

      But I get the following error:

      ***SUCCESS*** Installed [forge.spec.jpa] successfully.

      ***INFO*** Setting transaction-type="JTA"

      ***INFO*** Using example data source [java:jboss/datasources/ExampleDS]

      Wrote D:\/code/t2/test2/src/main/resources/META-INF/persistence.xml

      Wrote D:\/code/t2/test2/pom.xml

      ***ERROR*** Exception encountered: Cannot specify jdbc connection info when using container managed datasources [, jdbc:

      mysql://devdb:3306/ab_log, root, passw] (type "set VERBOSE true" to enable stack traces)

       

      I would greatly appreciate any link to how I do this or an example on how to create a project connecting to an actual database.

       

      // Mikael

        • 1. Re: How do I configure a forge prj for using mysql ?
          Lincoln Baxter III Master

          Hey!

           

          Sorry for the confusion.

           

          This exception means you cannot specify a container if you are also specifying a direct JDBC connection. Remove the "--container JBOSS_AS7 " from your command and you should have better luck.

           

          Let me know how that goes.

          ~Lincoln

          • 2. Re: How do I configure a forge prj for using mysql ?
            thorman Newbie

            Hello & thanks for the reply.

             

            I tried this and get the following response:

            [test2] test2 $ persistence setup --provider HIBERNATE --database MYSQL5_INNODB --jdbcURL jdbc:mysql://devdb:3306/ab_log

            --jdbcUsername root --jdbcPassword passw --named AbLogDbPu --driver com.mysql.jdbc.Driver

            ***INFO*** The command [setup] takes [0] unnamed argument(s), but found [1].

            ***INFO*** Swallowed unknown token [--driver] for command [setup].

            ***INFO*** Swallowed unknown token [com.mysql.jdbc.Driver] for command [setup].

            ? [container=ARG (of type org.jboss.forge.spec.javaee.jpa.api.JPAContainer)]:

             

            it seems as it requires a container to be set.

             

            If I tab at the container question I get the following alternatives:

            JBOSS_AS6         JBOSS_AS7         JBOSS_EAP6        GLASSFISH_3       WEBLOGIC_12C      CUSTOM_JDBC

            CUSTOM_JTA        CUSTOM_NON_JTA    TOMEE             SAP_LJS

             

            // Mikael

            • 3. Re: How do I configure a forge prj for using mysql ?
              Lincoln Baxter III Master

              Ah, right, I forgot...

               

              Use

              --container CUSTOM_JDBC