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!
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.
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?