create mysql odbc connection through batch script

戏子无情 提交于 2019-12-11 17:17:18

问题


Is there anyway to create a System DSN enter for MYSQL database (windows OS), with silent installation of MySQL ODBC Drivers programatically either through batch script or any other language?

If drivers installation is not possible , atleast automatic DSN entery would be helpful.

Thanks,


回答1:


On the command line, run odbcconf.exe with appropriate parameters. For example

ODBCConf ConfigSysDSN "SQL Server" "DSN=LocalODBCConnection|SERVER=(local)"

for MySQL

ODBCConf ConfigSysDSN "MySQL" "DSN=LocalODBCConnection|SERVER=MySQL_ServerName"



回答2:


Dim ad
ad = CreateObject("ADODB.Connection")      'create and open ODBC connection 
ad.ConnectionString = ("Driver={MySQL ODBC 5.2w Driver};Server=localhost;Database=db;UID=root;PWD=xxxxxx;option=3")
ad.Open()


来源:https://stackoverflow.com/questions/1792034/create-mysql-odbc-connection-through-batch-script

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