Problem of linking MySQL 8.0 database with VBScript script

I tried to connect and access MySQL database with VBScript script,

<%
rem ASP link mySQL DATABASE:
dim mysqlConn,mysqlodbc,conn,adoconn,sqlcmd,objrs,theDriver,isCharSet
dim iporUrl,dataName,admYouid,strPaswd,opeKey

isCharSet = "gb2312"
'theDriver = "driver={MySQL ODBC 3.51 Driver };"
'theDriver = "driver={MySQL ODBC 8.0 Unicode Driver };"
theDriver = "driver={MySQL ODBC 8.0 ANSI Driver };"

dnsStr = "dns='mysqlodbc';"
driverStr = theDriver
iporUrl = "server=localhost;"
portVal = "port=3306;"
dataName = "database='db';"
admYouid = "uid='root';"
strPaswd = "password='root333';"
opeKey = "option=3;"
setAnsi = "set names '"&isCharSet&"'"

mysqlConn =dnsStr&driverStr&iporUrl&portVal&admYouid&strPaswd&dataName&opeKey&setAnsi

set conn = Server.CreateObject("ADODB.Connection")
conn.open mysqlConn

sqlcmd = "select name,age from nhtab"
set objrs = conn.execute(sqlcmd)

While Not objrs.EOF
Response.Write objrs.Fields("Name") & "," & objrs.Fields("age") & "
"
objrs.MoveNext
Wend

objrs.Close
Set objrs = Nothing
Conn.Close
Setconn = Nothing
%>

but the results are as follows:

Microsoft OLE DB Provider for ODBC Drivers 错误 '80004005'
[Microsoft][ODBC 驱动程序管理器] 未发现数据源名称并且未指定默认驱动程序

Obviously, various versions of the drivers have been configured and tested properly.
So it's strange why VBScript scripts can't link to the database?

0 answers