ASP连接到MYSQL错误80004005“无法连接到'IP'上的MySQL服务器”

时间:2022-06-29 05:31:02

Full error:

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 

Attempting to connect to a MySQL database using ASP. Getting the above error, I'm not sure why. Apparently the error number means data not accessible, but it's not saying why.

尝试使用ASP连接到MySQL数据库。得到上述错误,我不知道为什么。显然错误号意味着数据无法访问,但它没有说明原因。

Anyone have any experience with this?

有人对此有经验吗?

<%
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

%> 

Values removed for obvious reasons.

删除值的原因很明显。

1 个解决方案

#1


2  

Ended up needing to allow the IP address on our firewall where the MySQL server is. Thanks all.

结束需要在MySQL服务器所在的防火墙上允许IP地址。谢谢大家。

#1


2  

Ended up needing to allow the IP address on our firewall where the MySQL server is. Thanks all.

结束需要在MySQL服务器所在的防火墙上允许IP地址。谢谢大家。