0

Can anybody suggest a good way to visualize schemacrawler output in a webapplication. I need the output as ER diragram. is there any good javascript or jquery plugin which uses DOT format? One more thing when i try to get the output in the dot format it is giving the output as

System Information

SchemaCrawler Information -=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=-

product name SchemaCrawler
product version 12.04.02

Database Information -=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=-

database product name MySQL
database product version 5.6.19-0ubuntu0.14.04.1
database user name demo@localhost

JDBC Driver Information -=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=-

driver name MySQL Connector Java
driver version mysql-connector-java-5.1.34 ( Revision: jess.balint@oracle.com-20141014163213-wqbwpf1ok2kvo1om ) driver class name com.mysql.jdbc.Driver
url jdbc:mysql://localhost:3306/demodb is JDBC compliant false

Tables

demodb.dbconnection

                                                             [table]

id INT NOT NULL
auto-incremented
dbmsType VARCHAR(100)
ipAddress VARCHAR(100)
port VARCHAR(10)
username VARCHAR(100)
This table is used to store database connections password VARCHAR(100)
databaseName VARCHAR(100)

                                                       [primary key]

id ascending
auto-incremented

demodb.roles

                                                             [table]

roleId INT NOT NULL
roleName VARCHAR(45) NOT NULL

                                                       [primary key]

roleId ascending

demodb.userdetails

                                                             [table]

id INT NOT NULL
auto-incremented
name VARCHAR(45)
dob DATE
sex VARCHAR(1)
bloodgroup VARCHAR(5)
address VARCHAR(45)
place VARCHAR(45)
city VARCHAR(45)
state VARCHAR(45)
country VARCHAR(45)
zipcode VARCHAR(45)
mobile VARCHAR(45)
email VARCHAR(45)
occupation VARCHAR(45)

                                                       [primary key]

id ascending
auto-incremented

                                       [foreign key, with no action]

id <-- demodb.user.userDetailsId

demodb.userroles

                                                             [table]

id INT NOT NULL
auto-incremented
username VARCHAR(45) NOT NULL
roleName VARCHAR(45) NOT NULL

                                                       [primary key]

id ascending
auto-incremented

demodb.user

                                                             [table]

username VARCHAR(100) NOT NULL
password VARCHAR(300) NOT NULL
userDetailsId INT NOT NULL
active INT NOT NULL

                                                       [primary key]

username ascending

                                       [foreign key, with no action]

userDetailsId --> demodb.userdetails.id

                                                  [non-unique index]

userDetailsId ascending

                                                      [unique index]

username ascending

and my schemacrawler-context.xml is like

<bean id="outputOptions" class="schemacrawler.tools.options.OutputOptions">
    <property name="outputFormatValue" value="DOT" />
    <!-- <property name="outputFile" value="scOutput.txt" /> --><!-- This should be given(writer not file) given from the program. -->
</bean>

it is not working for DOT as well as dot

Khader M A
  • 5,423
  • 3
  • 19
  • 19

1 Answers1

1

Khader,

For web output, you have a few output options available out of the box from SchemaCrawler. One option is to generate output in "htmlx" format, which will give you an ER diagram embedded in HTML, in a single file. Another option is to use "png" format to generate a PNG file. It is hard to see what executable you have in the Spring context, since you have not included this key information in your question. I would advise you to use the GraphExecutable.

Please note that in order to generate the ER diagram, you will need GraphViz installed on the web server. GraphViz will always generate a file, and cannot use a Java writer. So, please use the most appropriate constructor for OutputOptions.

If you like, you can have SchemaCrawler generate DOT format. Again, please use the most appropriate constructor for OutputOptions. You do not need GraphViz for this. You can use viz.js to visualize the DOT file using JavaScript.

Hope this helps.

Sualeh Fatehi, SchemaCrawler

Sualeh Fatehi
  • 4,700
  • 2
  • 24
  • 28
  • Thanks sualeh for you comment. My spring context is available in a post that you answered. Please refer this. http://stackoverflow.com/questions/29118381/schemacrawler-returning-tables-from-all-available-databases. In that i am using SchemaTextExecutable and provided output format as DOT but is is giving an output as above. Should i use Graph executable in order to generate DOT format? Our preference is viz.js as we need to add operations on the generated ER diagram like selecting table from Diagram etc. Also can you please provide a link to get Java docs for schemacrawler? – Khader M A Mar 25 '15 at 03:47
  • I have one more doubt, while i am using GraphExecutable there is a .dot file always created in temp folder even though output file is provided via OutputOptions. Is there any way to avoid the temp file creation and to get the dot file in a string or byte[] format? – Khader M A Mar 25 '15 at 07:44
  • I don't have your email with me. Please send me you email ID. – Khader M A Mar 26 '15 at 04:41