如评论中所述,您应该删除?中的引号。
另外,在中
rs.getString(i),
i应为正。从1开始循环计数。
总结一下:
public ArrayList<String> findPath(String roomName) throws SQLException, IOException, InstantiationException, IllegalAccessException, ClassNotFoundException{ ArrayList<String> path = new ArrayList<String>(); connection = getConnection(); String queryPattern = "SELECt Livello_1, Livello_2, Livello_3, Livello_4 FROM Camera WHERe Camera.Nome = ?"; PreparedStatement queryStatement = connection.prepareStatement(queryPattern); queryStatement.setString(1, roomName); ResultSet rs = queryStatement.executeQuery(); if(rs.next()) { for(int i = 1; i < 4; i++) { path.add(rs.getString(i)); } } return path;}

![java.sql.SQLException:参数索引超出范围(1>参数数量,为0)。在使用PreparedStatement时[重复] java.sql.SQLException:参数索引超出范围(1>参数数量,为0)。在使用PreparedStatement时[重复]](http://www.mshxw.com/aiimages/31/454015.png)
