完整错误:
Microsoft OLE DB Provider for ODBC Drivers error '80004005'
[MySQL][ODBC 3.51 Driver]Can't connect to MySQL server on 'IP' (10065)
/test.asp, line 17
尝试使用 ASP 连接到 MySQL 数据库。收到上述错误,我不知道为什么。显然错误号意味着数据无法访问,但并没有说明原因。
有人对此有经验吗?
<%
Dim oConn, oRs
Dim qry, connectstr
Dim db_name, db_username, db_userpassword
Dim db_server
db_server = "IP"
db_name = "DBNAME"
db_username = "USERNAME"
db_userpassword = "PASS"
fieldname = "FIELDNAME"
tablename = "TABLENAME"
connectstr = "Driver={MySQL ODBC 3.51 Driver};SERVER=" & db_server & ";DATABASE=" & db_name & ";UID=" & db_username & ";PWD=" & db_userpassword
Set oConn = Server.CreateObject("ADODB.Connection")
oConn.Open connectstr
qry = "SELECT * FROM " & tablename
Set oRS = oConn.Execute(qry)
if not oRS.EOF then
while not oRS.EOF
response.write ucase(fieldname) & ": " & oRs.Fields(fieldname) & "<br>"
oRS.movenext
wend
oRS.close
end if
Set oRs = nothing
Set oConn = nothing
%>
出于明显的原因删除了值。