Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   Seaching the data (http://www.velocityreviews.com/forums/t621481-seaching-the-data.html)

KK 06-21-2008 06:50 AM

Seaching the data
 
hello everyone..

i want to search the data in my database word by word. I mean if i put
the something like this in the search textbox "age cellphone date" i
get the list of the every column n row containing the words "age
cellphone date"

is it possible to write such query, plz help me on this and tell me
what things are feasible and if this is not feasible wat are its
alternatives?

My database is MS- Access and the frontend is JSP

Thanks
K

Roedy Green 06-21-2008 04:38 PM

Re: Seaching the data
 
On Fri, 20 Jun 2008 23:50:56 -0700 (PDT), KK
<Kartikeya.Karnatak@gmail.com> wrote, quoted or indirectly quoted
someone who said :

>My database is MS- Access and the frontend is JSP


Access is toy freebie database, so I don't hold out much hope for it,
but any serious SQL database will give you a way of querying to find
strings inside text. Unfortunately I don't think the syntax for this
is standard yet.

You strongly want to avoid reading every record into the client and
searching the strings in Java. You want the server to send you just
the hits. Otherwise it might take hours to satisfy a single query.

If you were using MySQL, for example, it supports full text searching,
the ability to find records that contain a word anywhere in the key.
Simply declare an index of type FULLTEXT on the TEXT/CHAR/VARCHAR
table columns which contains the text you want to search, then query
the table using the "MATCH()… AGAINST" syntax. There’s a manual
section which describes this facility.
http://dev.mysql.com/doc/refman/5.0/...xt-search.html
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Arne Vajhøj 06-21-2008 08:07 PM

Re: Seaching the data
 
KK wrote:
> i want to search the data in my database word by word. I mean if i put
> the something like this in the search textbox "age cellphone date" i
> get the list of the every column n row containing the words "age
> cellphone date"
>
> is it possible to write such query, plz help me on this and tell me
> what things are feasible and if this is not feasible wat are its
> alternatives?
>
> My database is MS- Access and the frontend is JSP


Depending on what you want:

SELECT * FROM tbl WHERE fld = 'age cellphone date'

SELECT * FROM tbl WHERE fld LIKE '%age cellphone date%'

SELECT * FROM tbl WHERE fld LIKE '%age%cellphone%date%'

SELECT * FROM tbl WHERE fld LIKE '%age%' AND fld LIKE '%cellphone%' AND
fld LIKE '%date%'

Note that the JDBC ODBC bridge is not very good - among other things it
has problems in a multithreaded environment. And JSP pages are a
multithreaded environment. I suggest you switch to one of the free
embedded Java databases like HSQLDB.

Arne






All times are GMT. The time now is 06:01 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.