Seaching the data

Discussion in 'Java' started by KK, Jun 21, 2008.

  1. KK

    KK Guest

    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
     
    KK, Jun 21, 2008
    #1
    1. Advertising

  2. KK

    Roedy Green Guest

    On Fri, 20 Jun 2008 23:50:56 -0700 (PDT), KK
    <> 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/en/fulltext-search.html
    --

    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com
     
    Roedy Green, Jun 21, 2008
    #2
    1. Advertising

  3. KK

    Arne Vajhøj Guest

    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
     
    Arne Vajhøj, Jun 21, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. imran
    Replies:
    2
    Views:
    12,818
    Rhino
    Mar 3, 2005
  2. LittlePython

    Seaching Active Directory via ADO

    LittlePython, Feb 16, 2006, in forum: Python
    Replies:
    10
    Views:
    990
    LittlePython
    Feb 19, 2006
  3. bruce

    seaching a list...

    bruce, Aug 10, 2006, in forum: Python
    Replies:
    4
    Views:
    373
    Gabriel Genellina
    Aug 11, 2006
  4. ruds

    seaching a file

    ruds, Jul 13, 2007, in forum: Java
    Replies:
    6
    Views:
    377
    Andrew Thompson
    Jul 14, 2007
  5. hgbso

    seaching a txt file

    hgbso, Sep 6, 2008, in forum: C Programming
    Replies:
    0
    Views:
    328
    hgbso
    Sep 6, 2008
Loading...

Share This Page