• 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

Different ways of assigning table name dynamically into the code....?

 
Ranch Hand
Posts: 296
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear all

I had made one small appication in that i want to assign the table name in the queries i had written now im using hard coded i want to get it by dynamically one way i know that through properties files . and another way is that i can use java class's . so please tell me the other way's and which one will be more suitable (like wat we are assigning driver Name,URL username ,Password through server.xml and web.xml (JNDI)) so please tell like this so that when i change in server files it should get reflected
 
author
Posts: 4335
39
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Unless you're using Object-Relational mapping tools, its pretty hard not to hard-code SQL statements and most solutions that get around this do so in an un-manageable way. For example, you can have every query in a single properties file and/or attached to a stored procedure but the long term maintenance tends to lead to out-of-date and confusing code. Why do you want the table names to be dynamic? In practice, database changes are significantly less common than code changes.
 
reply
    Bookmark Topic Watch Topic
  • New Topic