Hi Friend,

Here i'm sending a code for escaping the character in java. You will find
this function very usefull.

public String change(String  str){

  String st;
  st="";

    StringTokenizer t=new StringTokenizer(str,"'");
    if(str==null)
 {
  st="";
 }
 else
 {
  int i =t.countTokens();
  while(t.hasMoreTokens()){
  if(st.compareTo("")==0)
  st=t.nextToken();
  else
   st=st + "\\'" + t.nextToken();

  }
 }
return st;
 }



You can use this code like this:

           String s;
           s=theResult1.getString(k1);
         if(s==null)
         {
         ssql=ssql + "','";
         }
         else
         {
         ssql=ssql + change(s) + "','";
         }



In future if you find and problem you can contact me
at [EMAIL PROTECTED]

I have developed very good program in java that uploads a large number of
records on web directly in MySQL Database. I have very good experience
in JDBC programming.

Best Regards,

Deepak Kumar
http://jdbc.virtualave.net
http://208.56.183.203


----- Original Message -----
From: Tim Stoop <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, May 23, 2000 7:28 PM
Subject: Escaping for MySQL


> Hi there,
>
> I'm writing a function in Java to be used by my servlets, but I was
> wondering if Java has it's own function to escape characters in en
> MySQL-string. Anyone?
>
> Kind regards,
> Met vriendelijke groet,
> Tim Stoop
>
>
___________________________________________________________________________
> 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