• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Sql query in java running with dynamic value

 
premchand Singh
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Can any body help me to resolve the problem...

i am running a sql query where i have to get the dynamic value from the java program, but in that it is giving the error that syntax is not correct...

this is the query i am trying.....

String quer="SELECT RESOURCEID from AVAILRESOURCE where SDATE<=" +sdate+ "";


here sdate value is the dynamic value, at this poing it is giving the error like...

org.hibernate.exception.SQLGrammarException: could not execute query
please tell me the solution...


regards:
Premchand singh
 
Campbell Ritchie
Sheriff
Posts: 51467
87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What format is SDATE in? Can you apply the <= operator to it?
Do you have the correct number of quotes in that String?

Moving to our database forum, too.
 
premchand Singh
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi i have got the solution of the previous problem..by using setParameter..

now the problem is it is saying the table where the values are being fetched is not mapped...
but i have mapped the both class from where the values are being fetched.
please tell some solution...
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
premchand Singh wrote:Hi i have got the solution of the previous problem..by using setParameter..

now the problem is it is saying the table where the values are being fetched is not mapped...
but i have mapped the both class from where the values are being fetched.
please tell some solution...


The error message is not lying. If it says it's not mapped, then it's not mapped.

However, we can't see your code, or the exact, complete error message, and don't know what database or other tools you're using, it's impossible to tell you where you're making your mistake.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic