No!,

because if the string contains a single quote there will be an error. You
have to build
a function to make double single quote, or a function that will cheange all
escape characters (more complete)
Bye.

-----Messaggio originale-----
Da: A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]Per conto di Mike
Markovich
Inviato: marted� 23 maggio 2000 16.39
A: [EMAIL PROTECTED]
Oggetto: Re: Escaping for MySQL


Hi Tim, I think this is an example of what you want.   The single quote
serves as the escape symbol.  Hope this helps...

Mike

          ResultSet rs = stmt.executeQuery("INSERT INTO employees SET
FirstName = '" + empFirstName + "', LastName =   '" + empLastName + "',
Department = '" + empDepartment + "', Id =  " + id);


>>> Tim Stoop <[EMAIL PROTECTED]> 05/23/00 06:58AM >>>
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

___________________________________________________________________________
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