0

I am developing a web application in which a user can Create a table in data base. I am thinking on taking the attribute names and table description from user and put them into SQL query and execute it. But the drawback is that if this application is installed somewhere else all the db connection parameters have to be changed secondly it will be hard coded. Or is this the approach in software industry?

Another approach I can think of is taking all the information about creating a new table from user and inserting them into one table and have some kind of trigger on this table which creates a new table everytime when insertion is performed into the first table.What would be the SQL Script for such thing if my approach is correct?

I am using SPRING - MVC, Hibernate, MySQL, REST web service

Please correct me if I am thinking in wrong direction. TO be honest I am not clear on how I am going to do this. Thanks

Dhruv
  • 1,668
  • 9
  • 29
  • 40
  • I wouldn't go down this route... it means that the your code has to deal with any table with any structure, which may quickly become a massive headache... – Ben Mar 08 '12 at 20:40

1 Answers1

0

This is risky, since a database schema with a vague and ever-expanding schema will become difficult to manage. Your problem isn't how to manage the credentials, which you would have to handle securely whether users were creating tables or not. Your problem is why it seems necessary for users to create tables.

Are you building an interface to manage arbitrary databases? Maybe phpmyadmin would give your users everything they need.

Or are you doing something not quite so general purpose and open ended? Perhaps with a sufficiently rich table design, you can give the users what they want without requiring that they build their own tables. What information do users have to put in a table that it looks like they need to build their own?

If you are more specific with your objectives, we could be more helpful.

D Mac
  • 3,727
  • 1
  • 25
  • 32
  • Actually I am developing a web application for a system which was earlier a standalone application. Where a user starts the concerned server and access it via .net gui and perform certain DB tasks, whole working of system is confidential. A person can add data into the database in that system via csv file or directly create database table into data base.That server engine gives a Java API to connect. I want to replicate that scenario over web adding dynamic features to the existing one. Does this make sense? – Dhruv Mar 14 '12 at 16:58
  • is there a way I can atleast upload .csv or excel files via hibernate? – Dhruv Mar 14 '12 at 17:03