Kathy, You shouldn't have a problem here--it's Java, not MySQL, that requires the doubled '\' in a string literal.
In Java, the string literal: "INSERT INTO files (filepath) VALUES ('c:\\Repository\\Pack\\' )" represents the string whose content is INSERT INTO files (filepath) VALUES ('c:\Repository\Pack\' ) so what gets inserted is, in fact, c:\Repository\Pack\ > Subject: About escape character '\' > Date: Wed, 10 Apr 2002 19:44:21 -0400 > From: "Kathy Sung" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > > Hi all, > > I want to insert the string 'c:\Repository\Pack\' into a mysql table > using java and I did it as follows: > > sql =3D "INSERT INTO files (filepath) VALUES ('c:\Repository\Pack\' )"; > insertStmt.execute(sql); > > I got an error and I know I should add an extra '\' to escape each of > the '\' in the above sql statement. But, the problem is MS SQL and > Oracle do not treat '\' as an escape character in sql statements, and I > want to keep my Java program as database-independent as possible. (and I > don't want the whole string 'c:\\Repository\\Pack\\' to be stored in the > database when I use MS SQL server or Oracle) > > Any suggestion to my problem will be greatly appreciated. > > Thanks, > Kathy --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php