Does the global dimension gldim R equal the projective dimension of R as bimodule over its enveloping algebra? I know that generally the answer is no, for example the weyl algebra。
But is this true for commutative algebra？ or we may restrict to affine commutative algebras。 
Maybe ，it is a classical result. So, please let me know the reference. Thanks a lot.
 A: Suppose $A$ is non-negatvely graded and connected, with $A_0=k$ your base field. Then the same is true of the enveloping algebra $A^e$. 
As with all algebras, we have $\def\gldim{\operatorname{gldim}}\def\pdim{\operatorname{pdim}}\gldim A\leq\pdim_{A^e}A$.
Suppose $\pdim_{A^e}A=n<\infty$. By taking a minimal resolution of $A$ as an $A$-bimodule of length $n$ to compute, we see that $\def\Ext{\operatorname{Ext}}\Ext^n_{A^e}(A,k)\neq0$. Now $k\cong\hom_k(k,k)$ as a bimodule, and $\Ext^\bullet_{A^e}(A,\hom_k(k,k))\cong\Ext^\bullet_A(k,k)$: this tells us that $\gldim A\geq n$, so your equality holds in this case. If the dimension is infinite, the same works.
Something similar can be done if $A$ is local noetherian with the base field as residue field.
On the other hand, the equality does not hold always, even in the affine commutative case. For example, suppose $L/k$ is a finite field extension of your ground field $k$ which is not separable. Since separability of $L/k$ is the same thing as $L$ being a separable $k$-algebra, we have that $L$ is not a projective $L$-bimodule and therefore $$\pdim_{L^e}L\geq1>0=\gldim L.$$
