Introduction
In the thick of converting from a legacy database to a new system and thank goodness the legacy system has well defined relationship mappings (Primary Key and Foreign Keys).
And, this will help my familiarization.
It always helps to look at a diagram and make sure that my relationships are maintained in the new DB.
Potential Problem
The in-built tool that comes with SQL Server Management Studio is just not cutting it for me. There some important pieces missing. And, so looked on the .Net for free Data Modeling tools.
Oracle SQL Developer Data Modeler
Kent Graziano talked a good game about “Oracle SQL Developer Data Modeler” in his web post (http://kentgraziano.com/2012/02/20/the-best-free-data-modeling-tool-ever/) and so I think I will give it a good look).
Download – Oracle SQL Developer Data Modeler
Downloaded the v3.3 tool from http://www.oracle.com/technetwork/developer-tools/datamodeler/data-modeler-releasenotes33-1869517.html
Download – Microsoft JDBC Driver
Downloaded the latest Microsoft JDBC Driver (v 4.0 ) from http://www.microsoft.com/en-us/download/confirmation.aspx?id=11774.
Extract – Oracle SQL Developer Data Modeler
Extract the compressed file.
Extract – Extract Microsoft JDBC Driver
Extract Microsoft JDBC Driver. The files we really want are the jar files named sqljdbc.jar and sqljdbc4.jar and they are in the sqljdbc_4.0\enu folder.
Copy Extracted Microsoft JDBC Jar files to Tools (jdbc\lib) folder
Copy the extracted jar files from \sqljdbc_4.0\enu to the tool’s jdbc-lib path (jdbc\lib)
Aware Oracle SQL Developer of location of MS SQL Server JDBC Jar files
- In SQL Developer, access the menu Item Tools/Preferences/
- Access Data Modeler/Third Party JDBC Drivers
- Depending on the version of Java JRE bin, indicate SQL Server Jar file. If you chose to the download SQL Developer with the bundled JRE, then please choose sqljdbc4.jar
Reverse Engineer
To reverse engineer an existing database, please do the following:
- On the main menu, select File\Import\Data Dictionary
- On the “Connect to Database” Tab, click the “Add” button
- Enter Database specific connection detail
- Connection Name: Any name you like
- Username: Database user name
- Password: Database User Password
- For anything other than Oracle, please select the JDBC Tab
- JDBC URL :- jdbc:sqlserver://<hostname>:<portNumber>;database=database
- Driver Class :- com.microsoft.sqlserver.jdbc.SQLServerDriver
- From the Database Type drop-down, select the Database Type
- Verify your connection data, by pressing on the Test button
- Click Save once verified
- Ensure that the right Connection Item is selected and click on the Next button
- On the “Select Schema/Database”, select the Database Name
- On the “Select Objects to Import” screen, please select the objects you want
- On the “Generate Design” screen, please review the summary per how many objects will be imported
- Click the Finish button to generate your model
Sample
Here is sample model from the ASP.Net Membership Database.
Error
A quick round-up of possible errors:
Error – Status : Failure -Test failed: Java Runtime Environment (JRE) version 1.6 is not supported by this driver. Use the sqljdbc4.jar class library, which provides support for JDBC 4.0.
Get Java JRE Version#
Using GUI
The relative path to the bundled JRE is datamodeler\jdk\jre\bin and the file’s name is java.exe.
Get the file’s property by right clicking on the file in Windows Explorer.
Using OS Cmd Line
java -version
Result
java version "1.6.0_35"
Java(TM) SE Runtime Environment (build 1.6.0_35-b10)
Java HotSpot(TM) Client VM (build 20.10-b01, mixed mode)
Adjust Third Party JDBC Drivers
- Access Menu Item Tools/Preferences/
- Access Data Modeler/Third Party JDBC Drivers
Incorrect
Correct:
Error – Status : Failure -Test failed: Driver class not found. Verify the Driver Location
Please ensure that you have entered the Driver Class exactly as “com.microsoft.sqlserver.jdbc.SQLServerDriver”. I had an extra space before the Driver Class (on the screen dump above).
Oracle Dev Modeler is v4 now. I have sucessiful reversed the database model, but I can’t publish the changes I do back to the SQL Server.
Any Ideas ?
Fernando:
I have yet to attempt a re-synch.
Please permit me a couple of days to download v4 and attempt to do so.
Thanks,
Daniel
Ok, thank you.
I was able to bring to the model changes from database again, but not to put model changes back to database.
Still trying, this is a very valuable modeling tool.
Fernando:
Have you had a chance to read
Synchronize Data Dictionary With Model (SQL Server 2008) (https://community.oracle.com/thread/2564578)
The little exchange reads:
Hi Marc,
I’m afraid generation of change scripts is only supported for Oracle databases.
David
————————————————————–
Do you think 4.0 now supports said functionality.
Hello Daniel
Just saw your link. Yes I is what I was afraid, they import lots of formats and export only to Oracle. Make sense to be a free software, to migrate databases to oracle.
Thank you
Fernando