完整错误:
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
%>
由于显而易见的原因删除了值。
答案 0 :(得分:2)
结束需要在MySQL服务器所在的防火墙上允许IP地址。谢谢大家。