• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
santhosh.R gowda
Ranch Hand
Posts: 296
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Scott Selikoff
author
Saloon Keeper
Posts: 3890
15
Eclipse IDE Flex Google Web Toolkit
  • 0
  • Mark post as helpful
  • send pies
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic