Announcement Announcement Module
Collapse
No announcement yet.
Reverse engineering a MySQL database from STS using Roo Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Reverse engineering a MySQL database from STS using Roo

    It's been a while since I've touched STS or Roo, but with the addition of the reverse engineering feature I thought it was time to take them for another test drive. I need to be able to reverse engineer an existing MySQL database to get going, but seem to be having a bit of trouble.

    All I've done is created a new Spring Roo project in STS and set up persistence with the Roo command:
    Code:
    persistence setup --provider HIBERNATE --database MYSQL --userName root
    I then modified the database.properties file and configured the database URL to point to a valid database server.

    When I move on to database introspection or reverse engineering, all I get is:
    Code:
    roo> database introspect --schema test
    Unable to get connection from driver
    roo> database reverse engineer --schema test
    Unable to get connection from driver
    I should note that I have installed the MySQL driver addon, so that shouldn't be causing the problem either.

    I'm sure that I've probably missed some interim steps here that are preventing me from getting connected, but I haven't been able to figure out what they are. Any help would be greatly appreciated!

  • #2
    I think I've managed to solve my own problem. Since MySQL doesn't support schemas, the command I should have been using was:
    Code:
    database introspect --schema no-schema-required
    A combination of that and actually being in the office instead of over VPN or locally connecting to my MySQL 5.5 installation seems to have solved the problem.

    Comment


    • #3
      database introspect problem

      I created a running application that is connected to a MySql database.

      I too wanted to try database introspect as I have some other projects that would use it.

      Here is my roo.log...I did manually setup database.properties the same as my running application, so I know they are right. The maven pom has the mysql jdbc driver too.

      Code:
      roo> persistence setup --database MYSQL --provider HIBERNATE 
      Created SRC_MAIN_RESOURCES\META-INF\spring\database.properties
      Please update your database details in src/main/resources/META-INF/spring/database.properties.
      Updated ROOT\pom.xml [added dependencies mysql:mysql-connector-java:5.1.13, org.hibernate:hibernate-core:3.6.3.Final, org.hibernate:hibernate-entitymanager:3.6.3.Final, org.hibernate.javax.persistence:hibernate-jpa-2.0-api:1.0.0.Final, org.hibernate:hibernate-validator:4.1.0.Final, javax.validation:validation-api:1.0.0.GA, cglib:cglib-nodep:2.2, javax.transaction:jta:1.1, org.springframework:spring-jdbc:${spring.version}, org.springframework:spring-orm:${spring.version}, commons-pool:commons-pool:1.5.4, commons-dbcp:commons-dbcp:1.3; added repository https://repository.jboss.org/nexus/c...ries/releases]
      Updated SRC_MAIN_RESOURCES\META-INF\spring\applicationContext.xml
      Created SRC_MAIN_RESOURCES\META-INF\persistence.xml
      roo> database introspect --schema no-schema-required --enableViews false 
      Located add-on that may offer this JDBC driver
      1 found, sorted by rank; T = trusted developer; R = Roo 1.1 compatible
      ID T R DESCRIPTION -------------------------------------------------------------
      01 Y Y 5.1.13.0010 #jdbcdriver driverclass:com.mysql.jdbc.Driver. This...
      --------------------------------------------------------------------------------
      [HINT] use 'addon info id --searchResultId ..' to see details about a search result
      [HINT] use 'addon install id --searchResultId ..' to install a specific search result, or
      [HINT] use 'addon install bundle --bundleSymbolicName TAB' to install a specific add-on version
      JDBC driver not available for 'com.mysql.jdbc.Driver'
      roo>addon install id --searchResultId 01
      roo> Target resource(s):
      -------------------
         Spring Roo - Wrapping - mysql-connector-java (5.1.13.0010)
      
      Optional resource(s):
      ---------------------
         slf4j-api (1.6.1)
         jcl-over-slf4j (1.6.1)
         slf4j-nop (1.6.1)
      
      Deploying...done.
      So now it works just fine.
      Last edited by MikeOliverAZ; May 24th, 2011, 11:15 PM. Reason: Missed a few lines in my copy and paste.

      Comment


      • #4
        Nullpointer for database

        Hello when i use this command
        database introspect --schema no-schema-required
        i get this :
        NullPointerException at java.util.Hashtable.put(Hashtable.java:394)
        I am using MySql also
        I have the connector dependency already in the pom

        Comment


        • #5
          Hi!

          This sounds like a general Roo problem/question to me.
          Do you see those problems only when executing the command from the Roo shell within STS or also when running Roo from the command line?
          If you see this when running Roo from the command line, you should ask this in the Roo forum. There are more Roo experts reading your questions... :-)

          Cheers,
          -Martin

          Comment


          • #6
            Hello thanks yes i am actually using sts with spring roo but i have created the entities finally rather than using the engineering having too much trouble to use it

            Comment


            • #7
              I face the same issue

              Hi

              I am trying to reverse engineer my schema using spring roo, I am using STS 2.8.1 and the roo version that comes with it.I also tried roo 1.2.1 along with STS 2.8.1.Basically when I try to reverse engineer using the following command, thats what I see

              database reverse engineer --package ~.domain --schema ibx
              Located add-on that may offer this JDBC driver
              1 found, sorted by rank; T = trusted developer; R = Roo 1.2 compatible
              ID T R DESCRIPTION -------------------------------------------------------------
              01 Y Y 5.1.17.0020 #jdbcdriver driverclass:com.mysql.jdbc.Driver. This...
              --------------------------------------------------------------------------------
              [HINT] use 'addon info id --searchResultId ..' to see details about a search result
              [HINT] use 'addon install id --searchResultId ..' to install a specific search result, or
              [HINT] use 'addon install bundle --bundleSymbolicName TAB' to install a specific add-on version
              JDBC driver not available for 'com.mysql.jdbc.Driver'


              Now I try to install mysql driver using addon like that

              roo> addon install id --searchResultId 01

              Every sngle time I either get a connection reset exception or roo takes forever.Sometimes I do see a message saying Deployment done...but that dosent fix the issue.If I go back and reverse engineer, I get the same message mentioned above.

              Whats going wrong? I am on windows 7 professional. Could anybody help me?

              Thanks
              Venky

              Comment


              • #8
                I have the same problem too. I am using Roo 1.2.1 release and there is no way it understand the driver even if the mysql connector jar is present in project. Is it known bug?

                Comment


                • #9
                  Have you tried to run your script from Roo directly, without using STS? Does it give you problems downloading the JDBC driver? I'm trying to get a sense of whether this is an issue with the STS integration, or if it's Roo that's hanging.

                  Comment


                  • #10
                    Reverse engineer command do not provide driver hint for mysql

                    Hi, i am using STS latest version. for doing database reverse engineer, i searched driver using below command from roo shell

                    roo> addon search --requiresDescription driverclass
                    and it gives...
                    1 found, sorted by rank; T = trusted developer; R = Roo 1.2 compatible
                    ID T R DESCRIPTION -------------------------------------------------------------
                    01 - Y 9.0.0.801_jdbc4_0001 PostgreSQL #jdbcdriver
                    driverclass:org.postgresql.Driver. This bundle wraps the standard...
                    --------------------------------------------------------------------------------
                    [HINT] use 'addon info id --searchResultId ..' to see details about a search result
                    [HINT] use 'addon install id --searchResultId ..' to install a specific search result, or
                    [HINT] use 'addon install bundle --bundleSymbolicName TAB' to install a specific add-on version

                    But in my pom.xml i already added the dependency for mysql driver as

                    Code:
                    <dependency>
                    	<groupId>mysql</groupId>
                    	<artifactId>mysql-connector-java</artifactId>
                    	<version>5.1.18</version>
                    </dependency>
                    I could not understand why it is searching for postgresql driver which is no where in my class path or pom.xml, plus how could i install mysql driver as it is not coming in the search result?

                    Comment


                    • #11
                      got the solution in another thread
                      i used osgi start command and to worked fine...

                      Comment


                      • #12
                        Good news, thanks for letting us know!

                        Cheers,
                        -Martin

                        Comment

                        Working...
                        X