Inserting String into a database that contains the single quote character
From: Joe Ray (raymis_at_hotmail.com)
Date: 07/15/04
- Next message: Lee Fesperman: "Re: Inserting String into a database that contains the single quote character"
- Previous message: IchBin: "Re: Java conneciont string question..."
- Next in thread: Lee Fesperman: "Re: Inserting String into a database that contains the single quote character"
- Reply: Lee Fesperman: "Re: Inserting String into a database that contains the single quote character"
- Reply: Tony Morris: "Re: Inserting String into a database that contains the single quote character"
- Reply: Leon Bullock: "Re: Inserting String into a database that contains the single quote character"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 15 Jul 2004 14:47:46 -0700
Hi,
I am trying to insert String data into a MySQL database. However the
data contains single quotes in it.
con.executeUpdate("INSERT INTO DB VALUES("It's a crappy day")");
which gives me an SQL Syntax error. So what I did is to use a regular
expression to go through my text to replace ' with \'. I search for
"\'" and replace with "\\\'". However, that doesn't do any difference.
Any clues or different ways to attack this problem. Thanx
Joe
- Next message: Lee Fesperman: "Re: Inserting String into a database that contains the single quote character"
- Previous message: IchBin: "Re: Java conneciont string question..."
- Next in thread: Lee Fesperman: "Re: Inserting String into a database that contains the single quote character"
- Reply: Lee Fesperman: "Re: Inserting String into a database that contains the single quote character"
- Reply: Tony Morris: "Re: Inserting String into a database that contains the single quote character"
- Reply: Leon Bullock: "Re: Inserting String into a database that contains the single quote character"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|