This week's book giveaway is in the Java in General forum. We're giving away four copies of Think Java: How to Think Like a Computer Scientist and have Allen B. Downey & Chris Mayfield on-line! See this thread for details.
Hi, the name of tables in the My database change at runtime so i want to pass the values of tables as parameters at runtime, i cannot do it with "PreparedStatement", is there any efficient way. thanks in advance, regards, Shahabuddin.
Hi Shahabuddin, As you have discovered, you cannot use the "?" parameter place-holders in a "PreparedStatement" for database table names (nor column names, for that matter), only for literal values (like strings, numbers, dates, etc.) The only way is to build up the SQL string in your java class, for example (note: uncompiled and untested)