Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa WebSevices need search query

Have Programming Question? Ask it here!
 
 
 


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



Advertisement
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 Tutorials/Questions & Answers:
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
Advertisements
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
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
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
Search
Search   Hi, I have a project in which I am trying to enter "Marathi" (Indian local language) data in JSP using JSTL and trying to search data... and tries to search then It shows no data from database
search
search  how to develop search box and how to retrive data from database..   Please visit the following link: Search box
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
urgent need for jsp code with mysql query for uploading and downloading file - JSP-Servlet
urgent need for jsp code with mysql query for uploading and downloading file  can anyone tell me how to upload and download a doc file using jsp with mysql as the back end... and kindly help me to create the table too
need
need  i need a jsp coding based project plz help me
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
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
Search index
Search index  how to write code for advanced search button
query string
query string  Need some examples of query strings.send me as soon as possible. Regards, R.Santhosh
query optimization
query optimization  hai ! i need a code in java for database query optimization.plz help
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
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
Hibernate Search
Hibernate Search  Where to learn Hibernate Search module? Thanks   Hi, Check the tutorial: Hibernate Search - Complete tutorial on Hibernate Search Thanks
linear search
linear search  write a program to find string using linear search
Hibernate Criteria Query Example
Hibernate Criteria Query Example In this Example, We will discuss about hibernate criteria query, The interface org.hibernate.Criteria is used to create the criterion for the search. In this example we create a criteria instance
SEARCH AND SORT
SEARCH AND SORT  Cam any one provide me the code in java that : Program to search for MAX,MIN and then SORT the set using any of the Divide and conquer method
SEARCH PAGE
SEARCH PAGE  search page:option for search criteria like name and DOB will be asked.on entering the detail,data matching search criteria will be displayed..criteria can be both or any one of them.. can you send code
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
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
search program
search program  i m writing program which takes company names from databse...serch on google...n try to find the best match WEBSITE...of company name... links after google search...plzz help
Search Engine
Search Engine  I have gone through the below mentioned link document to create search engine and fetch the data from mysql database.But i am getting errors. http://www.roseindia.net/sql/mysql-table/sql-search.shtml Error: Notice
search for a name
search for a name  Search for a name Write a program to accept an array of names and a name and check whether the name is present in the array. Return the count of occurrence. Use the following array as input {?Dave?, ?Ann
Hibernate Criteria restrictions Query Example
Hibernate Criteria restrictions Query Example In this Example, We will discuss about hibernate criteria query, The interface org.hibernate.Criteria is used to create the criterion for the search. In this example we create
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
AJAX Search
($queryString) >0) { $query = $db->query("SELECT country FROM countries WHERE country LIKE '$queryString%' LIMIT 10"); if($query) { echo '<ul>'; while ($result = $query
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
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
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
php search variable
php search variable  Search variable in PHP
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
sql query - JDBC
sql query  I need a SQL query to add data into database
query in JDBC
query in JDBC  What are the steps required to execute a query in JDBC
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
SQL QUERY
Gopal oracle C Now i need to write a query "which
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
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
email search code in php
email search code in php  email search with multiple option in php
Query Question
Query Question  How would I write a query to display the name, department of the employee that earns the highest salary in the Employees table
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
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
Advertisements
 

 

 

DMCA.com