用的win2003+iis6.0系統(tǒng),運(yùn)行的asp+access網(wǎng)站,一直都正常著了,用網(wǎng)上那個(gè)垃圾清理程序清了一下垃圾,結(jié)果就不能運(yùn)行asp程序了。報(bào)錯(cuò)誤“數(shù)據(jù)庫(kù)連接出錯(cuò)[代碼:01],請(qǐng)檢查數(shù)據(jù)庫(kù)鏈接文
他執(zhí)行的清理垃圾代碼為以下批處理文件:
@echo off
echo 正在清除系統(tǒng)垃圾文件,請(qǐng)稍等......
del /f /s /q %systemdrive%*.tmp
del /f /s /q %systemdrive%*._mp
del /f /s /q %systemdrive%*.log
del /f /s /q %systemdrive%*.gid
del /f /s /q %systemdrive%*.chk
del /f /s /q %systemdrive%*.old
del /f /s /q %systemdrive% ecycled*.*
del /f /s /q %windir%*.bak
del /f /s /q %windir%prefetch*.*
rd /s /q %windir% emp & md %windir% emp
del /f /q %userprofile%cookies*.*
del /f /q %userprofile% ecent*.*
del /f /s /q "%userprofile%Local SettingsTemporary Internet Files*.*"
del /f /s /q "%userprofile%Local SettingsTemp*.*"
del /f /s /q "%userprofile% ecent*.*"
echo 清除系統(tǒng)LJ完成!
echo. & pause
問(wèn)題出在rd這句上面,這一句上。將臨時(shí)文件夾Temp用RD命令刪除,再用MD創(chuàng)建臨時(shí)文件夾,這樣會(huì)導(dǎo)致權(quán)限問(wèn)題!而如果分區(qū)格式是NTFS格式,這樣做,Temp目錄的權(quán)限肯定會(huì)改變,由于數(shù)據(jù)庫(kù)操作時(shí)需要使用Temp目錄作緩存進(jìn)行數(shù)據(jù)交換,當(dāng)權(quán)限不足時(shí)就出現(xiàn):“數(shù)據(jù)庫(kù)連接出錯(cuò),請(qǐng)檢查連接字串?!钡腻e(cuò)誤提示。
解決的辦法為:
windows 文件夾,右擊點(diǎn)temp文件夾選屬性,選擇安全
users
給這個(gè)用戶(hù)組特別權(quán)限和寫(xiě)入讀取權(quán)限。
這樣問(wèn)題就解決了!