This week's book giveaway is in the Design forum.
We're giving away four copies of Building Microservices and have Sam Newman on-line!
See this thread for details.
The moose likes JDBC and Relational Databases and the fly likes Please give me suggestion Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Building Microservices this week in the Design forum!
JavaRanch » Java Forums » Databases » JDBC and Relational Databases
Bookmark "Please give me suggestion" Watch "Please give me suggestion" New topic

Please give me suggestion

Deepa Balasubramanayam
Ranch Hand

Joined: Mar 29, 2001
Posts: 39
I am working on a page that does job search.
I have created a textbox and search button. If i type JAVA in the textbox and press search all the jobs available in java is to displayed. The code i used in the resultset is:
ResultSet rs = statement.executeQuery("Select * "+
"From JobTable " + "Where skills like "+ "'%" +variable+"%'");
Variable stores the field that i pass in the textbox.
Now that if i type JAVA,HTML,JAVASCRIPT in the text box. All the jobs available has to be displayed. I wanted to know the code that i can use in my where clause.
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Try the StringTokenizer and create multiple like statements separated by "or"

Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Raja Shekhar
Ranch Hand

Joined: Apr 02, 2001
Posts: 49
Hi !!
jsut try this...
StringTokenizer stn=new StringTokenizer(textbox,",")
ResultSet rs = statement.executeQuery("Select * "+
"From JobTable " + "Where skills like "+ "'%"

if (rs != null)
while(int i=1;i<=no.of column in the table;i++)
Please let me know the o/p....

Deepa Balasubramanayam
Ranch Hand

Joined: Mar 29, 2001
Posts: 39
Hi Raja Shekhar,
My program is working fine when I used StringTokenizer class.

I agree. Here's the link:
subject: Please give me suggestion
It's not a secret anymore!