0
private static String fetchQuery = "select ? from tracker where serialNo = ?"

ps.setString(1,"26-Nov-2014");
ps.setString(2,"1");

I have also tried:

ps.setString(1,"'26-Nov-2014'");
ps.setString(2,"1");

But i did not get the answer....please someone help me out with this one.....

Madhawa Priyashantha
  • 9,633
  • 7
  • 33
  • 60

1 Answers1

0

You have to put a column name(s) after the select keyword in mysql, it seems the "26-Nov-2014" is a value not a column name. But if the "26-Nov-2014" is your column name then try this.

private static String fetchQuery = "select \'?\' from tracker where serialNo = ?"

then

ps.setString(1,"26-Nov-2014");
ps.setString(2,"1");

If it doesn't work try to hardcode and test.

private static String fetchQuery = "select \'26-Nov-2014\' from tracker where serialNo = 1"

and comment out

// ps.setString(1,"26-Nov-2014");
// ps.setString(2,"1");

If it still doesn't work, try to run the query directly on database.

Hovo
  • 790
  • 4
  • 21