code: protected String internalReadParentId(CmsDbContext dbc, CmsUUID projectId, String resourcename)
      throws CmsDataAccessException {
  
          if ("/".equalsIgnoreCase(resourcename)) {
              return CmsUUID.getNullUUID().toString();
          }
  
          String parent = CmsResource.getParentFolder(resourcename);
          parent = CmsFileUtil.removeTrailingSeparator(parent);
  
          ResultSet res = null;
          PreparedStatement stmt = null;
          Connection conn = null;
          String parentId = null;
  
          try {
              conn = m_sqlManager.getConnection(dbc);
              stmt = m_sqlManager.getPreparedStatement(conn, projectId, "C_RESOURCES_READ_PARENT_STRUCTURE_ID");
              stmt.setString(1, parent);
              res = stmt.executeQuery();
  
              if (res.next()) {
                  parentId = res.getString(1);
                  while (res.next()) {
                      // do nothing only move through all rows because of mssql odbc driver
                  }
              } else {
                  throw new CmsVfsResourceNotFoundException(
                      Messages.get().container(Messages.ERR_READ_PARENT_ID_1, dbc.removeSiteRoot(resourcename)));
              }
          } catch (SQLException e) {
              throw new CmsDbSqlException(
                  Messages.get().container(Messages.ERR_GENERIC_SQL_1, CmsDbSqlException.getErrorQuery(stmt)),
                  e);
          } finally {
              m_sqlManager.closeAll(dbc, conn, stmt, res);
          }
  
          return parentId;
      }
docs: Returns the parent id of the given resource.<p>
  
  @param dbc the current database context
  @param projectId the current project id
  @param resourcename the resource name to read the parent id for
  
  @return  the parent id of the given resource
  
  @throws CmsDataAccessException if something goes wrong