JDBC - escaping quotes? - Mailing list pgsql-general

From lloyd
Subject JDBC - escaping quotes?
Date
Msg-id 1020806474.4189.16.camel@twilight
Whole thread Raw
List pgsql-general
Using a PreparedStatement under pgjdbc2.jar, shouldn't the driver escape
quotes in Strings?

If I try something like this:

  String sql = "insert into book_list (name) values ? ";
  PreparedStatement stmt = cn.prepareStatement(sql);

  String name = "\"Media Unlimited\", by Todd Gitlin";
  stmt.setString(1, name);
  stmt.addBatch();
  stmt.execute();

I would expect a row in the db with a name column of:

   "Media Unlimited", by Todd Gitlin

Instead, though the row is added, the column is blank.




pgsql-general by date:

Previous
From: "Booth, Robert"
Date:
Subject: NOT IN query issues
Next
From: Randall Perry
Date:
Subject: Can this be done in one query?