• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

DB schema from src

 
Ranch Hand
Posts: 296
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Partners!
I have and application which uses database internally without any ORM (plain old sql-scripts against JDBC).
But the problem is I don't have actual database.
Is it possible to reconstruct database schema based on this SQL-scripts? The tool that will parse the source code, find SQL-scripts, determine which table contains which datatype and output a script to create database.
I know that it looks not real, but maybe someone stumbled upon the tool like this. Thanks!
 
Ranch Hand
Posts: 119
Hibernate Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not sure if a tool exists for this kind of task. I guest you have to do it manually. How many tables you have to create for this program?
 
Bartender
Posts: 3323
86
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If the sql scripts are all selects, inserts, updates etc rather than creates etc then no you almost certainly won't be able to create an exact schema.
For a start how do you know if the sql scripts you have cover every field and every table in the schema. And even if they do, you may be able to get some of the information required to construct some of the tables but you will be hard pressed to get the exact data type/field widths etc for every field in every table.
 
surlac surlacovich
Ranch Hand
Posts: 296
Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Wayan Saryada wrote:How many tables you have to create for this program?


~15 tables with ~10 fields each. It's not precise values because as Tony mentioned, the scripts may not cover all the fields.

Tony Docherty wrote:you may be able to get some of the information required to construct some of the tables but you will be hard pressed to get the exact data type/field widths etc for every field in every table.


So the best solution would be to run the app, see what fields are required, modify schema, drop-create table, run again to see if the script run successfully? That's crazy, but the only way I see to solve this problem.
 
reply
    Bookmark Topic Watch Topic
  • New Topic