你把pwd username的引号都去掉

解决方案 »

  1.   

    faint
    select语句你都是错的
      

  2.   

    那些引号都是系统自动生成的,只是为了显示而用的.具体代码如下:
     public String ejbFindByPrimaryKey(String pwdKey) throws ObjectNotFoundException {
        Connection connection = null;
        PreparedStatement statement = null;
        try {
          connection = dataSource.getConnection();
          statement = connection.prepareStatement("SELECT \"username\" FROM \"pwd\" WHERE \"username\" = ?");
          statement.setString(1, pwdKey);
          ResultSet resultSet = statement.executeQuery();
          if (!resultSet.next()) {
            throw new ObjectNotFoundException("Primary key does not exist");
          }
          return pwdKey;
        }
        catch(SQLException e) {
          throw new EJBException("Error executing SQL SELECT \"username\" FROM \"pwd\" WHERE \"username\" = ?: " + e.toString());
        }
        finally {
          closeConnection(connection, statement);
        }
      }我试着改过了,去掉引号,也还是报错,怎么办?
      

  3.   

    SELECT \"username\" FROM \"pwd\" WHERE \"username\" = ?
    username是否是字段名称还是变量?若是字段名称就没有必要加上\",若是变量你的语句就是错误的。同样对于后面的pwd也一样。
    将去掉\"后报错信息贴出来看看