Home Answers Viewqa WebSevices need search query

 
 


kathiresan
need search query
1 Answer(s)      4 years and 4 months ago
Posted in : WebSevices

View Answers

March 19, 2009 at 12:32 AM


Hi Friend,

Please try the following code. It will be helpful in solving your problem.


/* For Working code use these sql queries

create database komal;

use komal;

create table stu(name varchar(10), dob date);

insert into stu values('komal','1984,10,27');

*/

import java.sql.*;

public class NewClass {

public static void main(String args[]) {

int date = 27;
int month = 10;
int year = 1984;

Connection con = null;
String url = "jdbc:mysql://localhost:3306/";;
String db = "komal";
String driver = "com.mysql.jdbc.Driver";
String user = "root";
String pass = "root";

Date dob = new Date(1);

try {
Class.forName(driver);
con = DriverManager.getConnection(url + db, user, pass);

String sql = "select * from stu where name ='komal'";
Statement st = con.createStatement();
ResultSet rs = st.executeQuery(sql);

while (rs.next()) {
dob = rs.getDate("dob");
}
} catch (Exception e) {
e.printStackTrace();
}
System.out.println(dob);

if (dob.compareTo(new Date(year - 1900, month - 1, date)) == 0) {
System.out.println("search sussesfull...");
} else {
System.out.println("Record not found");
}
}
}

Thanks









Related Pages:
need search query - WebSevices
need search query  I have a field in database as DOB. But I want to search recrods as per "fromage" to "toage". I dont know how to compare the ages...) { System.out.println("search sussesfull..."); } else
need query
need query  hi sir , i am beginner to sql.i need a query so that it can be helpful to my project. i have four tables each containing different fruits with different amounts. i need a query in such a way that when i say some
sql query search function
sql query search function  i have a textbox on a form , i like a search a data in the form, when i give whatever name and id or etc..its will search and show the same form , so help me using jsp
search query - SQL
. i have to search? how to do query for this? any one can help me...search query  hi anyone can help me? i have four textfield...) 4)Age From and Age to ((drop down list box) i have to search the result
Need a query to run in db2
Need a query to run in db2  hi all, I need a query to run in DB2...; Table 2- ACCOUNTS Fields-LEDGERCODE,ACCOUNTNUMBER,BALANCE FROM THE ABOVE I NEED A QUERY TO RETRIEVE ONLY THE ACCOUNTYPE=AFFILIATE FOR ACCOUNTNUMBERS FROM TABLE
multiple keyword search - SQL
can n't guess which textfield they give and search. i need query... and city and click search button or user may type in country and genderand click search button or user may type in country and age and click search button
Case-insensitive search using Hibernate Query Language(HQL).
Case-insensitive search using Hibernate Query Language(HQL).  What is Case-insensitive search using Hibernate Query Language
How can i search and insert within a query
How can i search and insert within a query  if it is possible that for eg: Retrieve seat numbers sql tables bases of some conditions eg batch semester and degree if i search batch 2008 , semester first and degree bscs then search
how to show search results in the same panel of jframe to where search field and button is present..
application i need to show search results in the same panel of jframe to where...how to show search results in the same panel of jframe to where search field and button is present..  Hello Sir, Sir i do have one more query
Need query for rollup based on month and category
Need query for rollup based on month and category   Hi, Here is my question.. I have a table as below. trans_date,cateory,amount 1-1-11,1,10 2-1-11,2,20 3-2-11,3,15 23-2-11,4,12 13-5-11,4,19 Need a query to get result like
Google Search
Google Search  I have a textbox and submit button in my JSP page. On giving word in the textbox and click submit it should redirct to google search... code I need. Anyone can help me with explanation
Writing to be located through the Search Engine
Writing to be located through the Search Engine       The majority of web users depend upon search... for the web you need to concentrate on the fact that when a user performs
Writing to be located through the Search Engine
Writing to be located through the Search Engine  ... search engines of all kind to locate and navigate web pages. While writing text material for the web you need to concentrate on the fact that when a user performs
Array search
Array search  Need a program which performs a searching operation on a one dimensional array called NUM, which is an N-element array stored in a file... for the search operation. he value with one or more of the array items. Search begins
AJAX Search
($queryString) >0) { $query = $db->query("SELECT country FROM countries WHERE country LIKE '$queryString%' LIMIT 10"); if($query) { echo '<ul>'; while ($result = $query
query optimization
query optimization  hai ! i need a code in java for database query optimization.plz help
query string
query string  Need some examples of query strings.send me as soon as possible. Regards, R.Santhosh
NSMutableArray Search String
NSMutableArray Search String  Hi all, In my iPhone SDK application.. i wanted to search from the table data. My question is ..do i need to innsert the table data into search array? thanks
Query in jsp
Query in jsp  I have one textbox in jsp. when i will write any letter in that textbox i want all values which are starting from that letter in option from database. same as we are getting in google search textbox. Thank
search feature - JSP-Servlet
search feature  i need help to do a search feature servlet to search for employees from the database. the search will be done by search by employee name, department and email  Hi friend, As per your problem
sql query
numbers of sids.i want to delete the sid based on the mid.for that i need sql query plz help to me
sql query
numbers of sids.i want to delete the sid based on the mid.for that i need sql query plz help to me
sql query
numbers of sids.i want to delete the sid based on the mid.for that i need sql query plz help to me
SQL QUERY
Gopal oracle C Now i need to write a query "which
Search Engine - Java Beginners
Search Engine  Hello Sir, I am new jsp, also i need search engine coding from the local computer or database only.pls send the jsp with mysql codes.I dont know how to create a search engine(like google) in local computer
jtable displays search results
jtable displays search results   hi sir can u send me full source code for displaying search results into jtable from database n jtable n search... must not be default. plz sir help me i have a urgent need
linear search - Java Beginners
linear search  How do i use a linear search for a 2 dimensional hard coded array? I need to check the first 2 letters in an item number and if it's not in the list i need to show an error message to the user.  Hi
Hibernate Search - Hibernate
with that site whenever need to know some java related technology or on other topics... these dayes i am working in "Hibernate Search" it is new and i can't... and offcourse to others who are new and want to integrate Hibernate Search
Displaying search results in same panel of gridview in same jframe window.
query.... But when we execute search for the second time database table columns...Displaying search results in same panel of gridview in same jframe window.  Hello Sir, I have a search frame window from which we can
Displaying search results in same panel of gridview in same jframe window.
query.... But when we execute search for the second time database table columns...Displaying search results in same panel of gridview in same jframe window.  Hello Sir, I have a search frame window from which we can
php query
php query  i have a basic index and a login.php page in the web root , but i would like to place it in some other folder .. what modifications do i need to do in index page
Frame query
Frame query  Hi, I am working on Images in java. I have two JFrame displaying same image. We shall call it outerFrame and innerFrame.In innerFrame i am rotating the image.After all the rotations i need to display this image
jtable query
jtable query  I need a syntax...where i could fetch the whole data from the database once i click the cell in jtable...and that must be displayed in the nearby text field which i have set in the same frame
how to search - WebSevices
how to search  how can I write mysql query for the following search format? Search By:(this have following options)(name,username,email... problem then send me code and explain in detail, what's your proper query. import
SQL query
SQL query  I need to combine two tables in order to get the values. As an example we have three tables having namely usertable,job table... this how can get the employee name having access to the jobs. I need to have
datagrid search - Hibernate
datagrid search  Hi friend, i have displayed a datagrid using jsp but i need a search option in that which is used to display and sort it in a alphabetical order.... pls help me... Thanks in advance...   
search and sort techniques in java
search and sort techniques in java  Hi i attened an interview recently... they asked to write all searching and sorting technique codes in java.. i... any utility methods .....i could answer few but not all..i need datalied code
JAVA: Recusrion, Binary Search
JAVA: Recusrion, Binary Search  I want to learn about Binary Search and Recursion but I'm confused on how to do it. I know that I also need arrays... is resolved, it is removed from the list. Search appointments by owner and by date
jdbc query
details but not with Access database. Plz help me its urgent I need your help
jdbc query
details but not with Access database. Plz help me its urgent I need your help
jdbc query
details but not with Access database. Plz help me its urgent I need your help
jdbc query
details but not with Access database. Plz help me its urgent I need your help
search
search  how to develop search box and how to retrive data from database..   Please visit the following link: Search box
Hibernate Search
Hibernate Search       In this section we will learn about Hibernate Search, which is used create... to run the full text search. Introduction to Hibernate Search Hibernate
SEARCH
SEARCH  how can we do search in jsp...? option for search criteria like name and DOB...   Please visit the following links: http://www.roseindia.net/jsp/user-search.shtml http://www.roseindia.net/servlets/search.shtml
sql query - JDBC
sql query  I need a SQL query to add data into database
Form with a search filter in spring mvc?
into my jsp page, Now in the same jsp page at the right hand corner I have a search filter where I need to search by transaction id which is one of the field...Form with a search filter in spring mvc?  Hi I am new to Spring MVC
Form with a search filter in spring mvc?
into my jsp page, Now in the same jsp page at the right hand corner I have a search filter where I need to search by transaction id which is one of the field...Form with a search filter in spring mvc?  Hi I am new to Spring MVC
search bar - Java Server Faces Questions
search bar  pleas can u show me how to use unblock sites to search by them  can describe ur query properly
php show last query
php show last query  How to show the last updated record from the database in PHP? Is there any query that i need to write in the php script

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.