Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

using a session value on sql query

 
Eduardo Ponce de Leon
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am getting a value from a drop down menu and storing it in the sessions bean. However when I try to get that value to use it on a query i am getting an error. That value is the DB that i am going to use for my query...

these are my values...what am i doing wrong?

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64967
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eduardo Ponce de Leon wrote: i am getting an error.

Keeping the error a secret isn't going to help us help you.
 
Eduardo Ponce de Leon
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The erros is saying that the DB does not exist...and its true the database "db" is not the name of my databes, my problem is that i dont know how to set the value of the stored value of my bean in the sql query.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64967
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sigh. Show the entire error message.
 
Eduardo Ponce de Leon
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok...so this is my query...

SELECT
"JUN_F1"."Renta"
FROM
public."JUN_F1"
WHERE
"JUN_F1"."Telefono" = '9717029902';

JUN_F1 is the name of my table but that name, however this name is formed by JUN (variable) and _F1 (text)...I cant write my query to store in a string variable to do what i need to do, the problem is the quotes..basically my query will look like this...



remember... month is the value stored in another variable and _F1 is plain text
This is what i want to do..

String query = "SELECT "month+_F1"."Renta" FROM public."month+_F1" WHERE "month+_F1"."Telefono" = '9717029902';";

any help with the quotes!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic