Let $(Z,\mathcal O_Z)$ be a closed subscheme of a Noetherian scheme $(X,\mathcal O_X)$. Then there is an ideal sheaf $\mathcal J$ on $X$ such that $i_*(\mathcal O_Z) \cong \mathcal O_X/\mathcal J$ , where $i:Z\to X$ is the inclusion and $\mathcal J$ is the kernel of $i^{\#}: \mathcal O_X \to i_*(\mathcal O_Z) $.

Let $\mathcal F$ be a quasi-coherent sheaf of $\mathcal O_X$-modules on $X$.

Now if $X$ is affine, then it is known that $\inf \{n |$ Ext$^n(\mathcal O_X/\mathcal J,\mathcal F)\ne 0\}=\inf\{n | H^n_Z(X,\mathcal F)\ne 0\}$

My question is: In general, when $X$ is not affine, is there any relation between the integers defined by the two sides of the above equality ? Also, is there any general cases known where the above equality or some analogue of it holds when $X$ is not necessarily affine ? (If needed, assume $\mathcal F$ is coherent)

EDIT: From Proposition 3.7 and 3.8 of R. Hartshorne, Local Cohomology, A seminar given by A. Grothendieck, Harvard University. Fall, 1961. Lecture Notes in Mathematics, 41. Springer, 1967. http://link.springer.com/book/10.1007%2FBFb0073971, it follows that if $Z$ is a closed subscheme of a Noetherian scheme $(X,\mathcal O_X)$ and $\mathcal J$ is the ideal sheaf defining $Z$ as above, then for any coherent sheaf $\mathcal F$ of $\mathcal O_X$-module , one has

$\inf \{n | \mathcal Ext^n(O_X/\mathcal J, \mathcal F)\}=\inf \{n| \underline{H^n_Z}(\mathcal F)\ne 0\}=\inf_{x\in Z}$ depth$_{O_{X,x}} \mathcal F_x$

where $\underline {H^n_Z}$ is the Local Cohomology sheaf as Mohan alluded to in the comments and are the derived functors of the functor which takes a sheaf of abelian groups $\mathcal G$ to the sheaf $U\to \Gamma_{U\cap Z}(U,\mathcal G|_U)$ and moreover $\underline {H^n_Z}(\mathcal F)$ can also be thought of as the sheaf associated to the pre-sheaf

$U \to H^n_{U\cap Z}(U,\mathcal F|U )$ (Proportion 1.2 in the above reference) .

The question I originally asked, which still stands, is a global version of this.