aspose file tools*
The moose likes JDBC and the fly likes unable to get column values Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Databases » JDBC
Bookmark "unable to get column values" Watch "unable to get column values" New topic
Author

unable to get column values

madhuri kunchala
Ranch Hand

Joined: Mar 30, 2010
Posts: 350
hi,
i need to get the data which is entered in text field..i had written the query in java..but i m unable to get the values..can you help me out..here is the query.


browseRequest.getTags()--from here i m getting the tag names

any help
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2477
    
    7

Have you tested if browseRequest.getTags() returns the values you expect?
Does that work?
If yes, give us an example of what it returns.
If no, please inform us, and we will move your post to the JSP forum.


OCUP UML fundamental and ITIL foundation
youtube channel
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2477
    
    7

(by the way, you are using a very dangerous mechanism to run queries. A user can corrupt your database by putting a cunningly forged piece of sql in your text box.
What would happen if a user enters "TAG1%'; delete from customers; delete from vendors; select * from dual where x = 'X"

See sql injection
madhuri kunchala
Ranch Hand

Joined: Mar 30, 2010
Posts: 350
if i give only one value i.e., app1 im getting.. the output correct output i.e., the corresponding values ... and the query is

if i give multiple values in text box i.e., app1,app2..im not getting any output.. and the query is showing like this if i give two values.


what goes wrong with my query...
Sean Clark
Rancher

Joined: Jul 15, 2009
Posts: 377

Hey,

Your query needs to be more like:
Sean


I love this place!
madhuri kunchala
Ranch Hand

Joined: Mar 30, 2010
Posts: 350
i tried that one im mysql query editor im getting...but i need to implement that code in java...can you suggest me how..i tried..but unable to get it.
Sean Clark
Rancher

Joined: Jul 15, 2009
Posts: 377

Hey,
I guess you'll need to split your tags and then loop and append each argument to your query string.
I don't think that it is particularly difficult.

Sean
madhuri kunchala
Ranch Hand

Joined: Mar 30, 2010
Posts: 350
i had implemented that one..if i do i m getting all the data irrespective of the condition.here is the code.

what the problem with my code
Sean Clark
Rancher

Joined: Jul 15, 2009
Posts: 377

Hey,
I'm not really sure on your logic of what you are trying to do.
In my opinion this method should return a List<String> tags which you can then use as you wish in your other query. Why have you decided to return comma seperated results?

Sean
madhuri kunchala
Ranch Hand

Joined: Mar 30, 2010
Posts: 350
its my project requirement that i need to enter the values separated by commas..but i m not getting..any help regarding this.
Sean Clark
Rancher

Joined: Jul 15, 2009
Posts: 377

Yes, perhaps the input should come in seperated by commas, but I think when it comes to writing the query surely you should be implementing it by splitting the string on the commas and looking for matches.

Perhaps we should step back a touch and you should explain exactly what you are trying to achieve, how does the user interact with the system, what actions do they need to do and what are they expected to get in return?

Sean
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: unable to get column values
 
Similar Threads
Populating each row of a single column with values from the database in a combo box .
values from users show null when entered into database
SQLException:Invalid column name
XML parse error
Populating each row of a column with a combo box containing values from the database