Hello Kamlesh

For the same problem I wrote one method which replaces all single quote to
'||chr(39)||' before inserting into database.This works fine.

 public String returnSQ(String s)
 {
    int j=0;
    while(s.indexOf("'",j)!=-1)
    {

s=s.substring(0,s.indexOf("'",j))+"'||chr(39)||'"+s.substring(s.indexOf("'",
j)+1);
      j=s.indexOf("'",j)+13;
    }
    return s;
 }

I think Ankur has given a very simple solution
Rgds
Anant
----- Original Message -----
From: "Ankur Jain" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, February 07, 2002 1:46 PM
Subject: Re: JBBC sql statement problem


> Hi Kamlesh.
>
> The escape sequence in SQL is '  hence you can have '' (i.e. two
> apostrope's to put one apostrophe in the DB)
>  hope this helps.
>
> Regards,
> Ankur
>
>
>
>
>                     k a m l e s h
>                     <[EMAIL PROTECTED]       To:
[EMAIL PROTECTED]
>                     ET.IN>                      cc:
>                     Sent by: "A mailing         Subject:     JBBC sql
statement problem
>                     list for discussion
>                     about Sun
>                     Microsystem's Java
>                     Servlet API
>                     Technology."
>                     <SERVLET-INTEREST@JAV
>                     A.SUN.COM>
>
>
>                     02/07/02 01:35 PM
>                     Please respond to "A
>                     mailing list for
>                     discussion about Sun
>                     Microsystem's Java
>                     Servlet API
>                     Technology."
>
>
>
>
>
>
> Hi all,
> i have problem while sending query to database if somehow the data filled
> in by user in the html form contains words of type hon's as ( ' ) is
> delimiter for any char value and sql takes it as delimiter and it creates
> problem , please if somebody knows how to solve this do help me
>
> Regards
> kamlesh
> PS: i want to insert the string in database as it is.
>
>  +-------------0000ooo()ooo0000--------------+
>  |                                           |
>  | Kamlesh Kr. Sharma Dept. CSA              |
>  | IISc Bangalore-12                         |
>  | Http://www2.csa.iisc.ernet.in/~kamlesh    |
>  | Contact Hostel 80-3092453 Room No. M-111  |
>  | Contact Dept. 80-3092368. Ext 102 or 115  |
>  +-------------------------------------------+
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>
>
>
>
>
> -----------------------Disclaimer------------------------
>
> The views of the author may not necessarily reflect those
> of the Company. All liability is excluded to the extent
> permitted by law for any claims arising as a result of the
> use of this medium to transmit information by or to
> IT Solutions (India) Pvt. Ltd.
>
> We have taken precautions to minimize the risk of
> transmitting software viruses, but we advise you to
> carry out your own virus checks on any attachment to
> this message.  We cannot accept liability for any loss or
> damage caused by software viruses.
>
> ------------------------Disclaimer------------------------
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
>

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to