“Data source name not found and no default driver specified” connecting mysql

不羁岁月 提交于 2019-12-11 08:43:48

问题


Due to some technical reasons, I had to change my database from sql server to MySQL. But I am getting the following error, I cannot connect to the database..!

Microsoft OLE DB Provider for ODBC Drivers error '80004005'

[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified

Set ObjConn = CreateObject("ADODB.Connection")
ObjConn.Open ("DRIVER={MySQL ODBC 5.0.96 Driver};SERVER=68.128.172.38;DATABASE=xxx;UID=xxx;PWD=xxx")

回答1:


here you go with a sample connection string

Server_Name = "localhost" 'connect to the local  remort database server

databseName = "db" 'database name
mySQLUser = "root" 'user name
mysqlPassword = "admin" 'passwrd of the db user

ConStr= "Driver={MySQL ODBC 5.1 Driver};SERVER=" & Server_Name  & ";DATABASE=" & databseName & ";UID=" & mySQLUser & ";PWD=" & mysqlPassword & ";PORT=3306;OPTION=67108864;" ' Connection string

if that doesn't work, try installing the relevent connector for mysql Select and download the connector



来源:https://stackoverflow.com/questions/14862777/data-source-name-not-found-and-no-default-driver-specified-connecting-mysql

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!