• 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

Sql query in java running with dynamic value

 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 79179
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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...
 
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic