It cannot be opened within a certain time period of the day. After waiting for several minutes, it will say that the asp script has timed out, but FTP can log in. When checking the database directory, I found a record lock information file with the same name as the database (my database is an access database) ( .ldb file) was always there, so I logged into the host's management panel and restarted the website service. The ldb file disappeared and the website opened normally. However, a few hours later, the above situation appeared again on the website. This situation lasted for a long time. The website was later blocked by the virtual host provider. The feedback was given to me. It is said that because my website consumes a lot of CPU resources when running, it is temporarily blocked so that I can optimize the website program or database.
I searched for this situation on Baidu and found a lot of results. In summary, it is mainly because after accessing the database, the record set was not released in time and the database connection was not disconnected. Let's talk about the standard method of operating the Access database:
1. Database connection method: Conn.asp
<%
dim conn
dim connstr
dimdb
db=database/data.mdb
Set conn = Server.CreateObject(ADODB.Connection)
connstr=Provider=Microsoft.Jet.OLEDB.4.0;Data Source= & Server.MapPath(&db&)
conn.Open connstr
If Err Then
err.Clear
SetConn=Nothing
Response.Write The server is under maintenance, please try again later.
Response.End
End If
SubCloseConn()
'The following is the statement to disconnect the database
conn.close
set conn=nothing
End Sub
%>
2. Close the release record set
rs.close
set rs=nothing
3. Disconnect the database connection
conn.close
set conn=nothing
Combining the above three contents, the following standard method for operating Access database Test.asp is obtained
<!--#include file=conn.asp -->
<%
sql=select * from table order by id
set rs=server.createobject(adodb.recordset)
rs.open sql,conn,1,1
if not rs.eof then
tel=rs(tel)
fax=rs(fax)
end if
'The following closes and releases the recordset statement
rs.close
set rs=nothing
'Call the sub-function to disconnect the database
Call CloseConn()
%>
Based on this standard, I conducted thorough checks and corrections on my website program. Finally, my website was finally accessible normally, and the previous database deadlock situation no longer occurred.