Q:

Are Prepared Statements JDBC JAVA requests similar to those of PHP?

For example, this query is similar in two languages :
    "SELECT District FROM City WHERE Name=?"

But in JAVA following query is not working :
    "SELECT District FROM City WHERE Name=:name"

Are there a more friendly way than using a suite of interrogation points in JAVA ?

A:

JDBC PreparedStatement is similar (but not identical to) PHP PreparedStatement, when using JDBC bind parameters (parameterIndex) is an int. See Using Prepared Statements and the PreparedStatement Javadoc. Assuming you have a Connection conn and a String name, it might be done with something like
String sql = "SELECT District FROM City WHERE Name=?";
try (PreparedStatement ps = conn.prepareStatement(sql)) {
    ps.setString(1, name);
    try (ResultSet rs = ps.executeQuery()) {
        while (rs.next()) {
            System.out.println(rs.getString("District"));
        }
    }
} catch (SQLException e) {
    e.printStackTrace();
}

