English 中文(简体)
Automating reverse engineer database model with Visio
原标题:

We develop and maintain our database schema with a custom tool. SQL scripts and runtime files are generated from that tool. However, it does not provide a very good visual representation.

Lately I been using Visio to reverse engineer the schema. This is working great so far. But to be able to do this, I need to:

  1. create an empty database
  2. execute the generated script
  3. start up visio
  4. choose reverse engineering and choose the created database
  5. select all tables, etc
  6. wait for generation

I really want to automate this process. Step 1 and 2 are easy, but how can I automate the other steps.

I ve been looking for a C# library to create Visio diagrams, but they al seem not suitable for this task.

For instance http://visioautomation.codeplex.com/ and http://www.graphviz.org/ look promising, but on a closer look they were not appropriate.

I ve tried to record macro, but the macro recorder does not work in conjuction with the reverse engineering tools.

问题回答

Michiel,

I am using Visio 2007 and SQLite 3.

Tonight I had a crack at reverse engineering my Sqlite3 database with success. The key is to download an ODBC driver for Sqlite. I found some here > http://www.ch-werner.de/sqliteodbc/. I installed the current one at the top of the list "sqliteodbc.exe".

Then the MSVisio set up was a bit muddled so forgive me if I do not explain the details in an exact, repeatable format.

  1. The new installed ODBC driver should appear in Visio when you select: Database > Reverse Engineer > Setup.
  2. Scroll down and check one of the three Sqlite drivers - I chose the "SQLite3 ODBC Driver"
  3. Then click on "New" > Check "System Data Source" > Scroll down select "SQLite3 ODBC Driver" > Click "Finish"
  4. On the dialog that it entitled "ODBC DNS Configuration" is where you enter your Sqlite database settings. The "Database Name" is simply the path and file name of your database. The "Data Source Name" can be anything meaningful to you as it will appear in the Visio dropdown whenever you want to reverse engineer. There are some other settings you can experiment with as well.
  5. When you commence reverse engineering you will be asked to connect to your datasource using your credentials. At this point you will get a warning ...

Warning! You are using a Visio ODBC Generic Driver to connect with a SQLite DBMS datasource. By using an incompatible driver, it is possible that the catalog information retrieved will be incomplete.

Just click OK and ignore this.

Unfortunately, in the next screen the option to select "Views" and "Triggers" are greyed out (you can select Tables: Primary Keys, Indexes, Foreign Keys though). This is a shame as I have defined a lot of these in my schema and I have benefited from rev-enging these in Oracle many times in the past.

That is it. Hope someone can find a fix for rev-enging the views.

Dan

Have you tried using the "Refresh" feature? I m not sure if that is a 2010 thing or if it was always there. You point it at the database and it updates your model with the changes since last time.





相关问题
what is wrong with this mysql code

$db_user="root"; $db_host="localhost"; $db_password="root"; $db_name = "fayer"; $conn = mysqli_connect($db_host,$db_user,$db_password,$db_name) or die ("couldn t connect to server"); // perform query ...

Users asking for denormalized database

I am in the early stages of developing a database-driven system and the largest part of the system revolves around an inheritance type of relationship. There is a parent entity with about 10 columns ...

Easiest way to deal with sample data in Java web apps?

I m writing a Java web app in my free time to learn more about development. I m using the Stripes framework and eventually intend to use hibernate and MySQL For the moment, whilst creating the pages ...

join across databases with nhibernate

I am trying to join two tables that reside in two different databases. Every time, I try to join I get the following error: An association from the table xxx refers to an unmapped class. If the ...

How can I know if such value exists in database? (ADO.NET)

For example, I have a table, and there is a column named Tags . I want to know if value programming exists in this column. How can I do this in ADO.NET? I did this: OleDbCommand cmd = new ...

Convert date to string upon saving a doctrine record

I m trying to migrate one of my PHP projects to Doctrine. I ve never used it before so there are a few things I don t understand. In my current code, I have a class similar to this: class ...

热门标签