Syntax of LIKE in PreparedStatement - Mailing list pgsql-jdbc

From Mihai Gheorghiu
Subject Syntax of LIKE in PreparedStatement
Date
Msg-id 000f01c1dceb$c1ac3bc0$6e646464@New6.Travel
Whole thread Raw
Responses Re: Syntax of LIKE in PreparedStatement
List pgsql-jdbc
When I need to translate a PostgreSQL query such as:
SELECT * FROM tbl WHERE name = 'Smith';
into a PreparedStatement, I use something such as:
sql = con.prepareStatement("SELECT * FROM tbl WHERE name = ?");
sql.setString(1, myVariable);

How do I translate
SELECT * FROM tbl WHERE name LIKE '%Smith%';
I'm not sure what happens to ' and %.

Thank you all.



pgsql-jdbc by date:

Previous
From: Dave Cramer
Date:
Subject: Re: JDBC Driver Problem
Next
From: Dave Cramer
Date:
Subject: Re: Syntax of LIKE in PreparedStatement