首页 > 编程知识 正文

odbc驱动程序管理器,sql连接odbc

时间:2023-05-04 22:10:52 阅读:117607 作者:2231

如果使用Mysql,则需要使用ODBC数据源连接到Mysql,因此经常需要使用无需安装的驱动程序,您可以自行浏览官网上的脚本

修改了实用的脚本,大家一起分享了:

安装MySQL odbc 5.1驱动程序

@ECHO OFF

设置安装dir=none

if exist % windir %/system/nulsetinstalldir=% windir %/system

if exist % windir %/system32/nulsetinstalldir=% windir %/system32

if % install dir %==none goto : do error 5

if exist % install dir %/myodbc-installer.exe goto : do error 4

zxdxh***

zxdxhfindoutthebin/lib directory,or use default

zxdxh***

SET libdir=lib

SET bindir=bin

ifexistlib/release/myodbc5. libsetlibdir=lib/release

ifexistlib/relwithdebinfo/myodbc5. libsetlibdir=lib/relwithdebinfo

ifexistbin/release/myodbc-installer.exesetbindir=bin/release

ifexistbin/relwithdebinfo/myodbc-installer.exesetbindir=bin/relwithdebinfo

zxdxh***

zxdxhcopyingmyodbclibrariesandexecutablestoinstalldir .

zxdxh***

ECHO Copying installation files

if not exist % libdir %/myodbc5. lib goto : do error 2

if not exist % libdir %/myodbc 5s.lib goto : do error 2

if not exist % bindir %/myodbc-installer.exe goto : do error 2

复制% libdir %/myodbc 5s.dll % install dir %

复制% libdir %/myodbc 5s.lib % install dir %

复制% libdir %/myodbc5. dll % install dir %

复制% libdir %/myodbc5. lib % install dir %

复制% bindir %/myodbc-installer.exe % install dir %

复制doc/*.hlp % install dir %

zxdxh***

zxd xh注册驱动程序.

zxdxh

zxdxhwecandothiswithmyodbc-installer.exeorthemswindowsodbcconf.exe.it

zxdxhmaybesafertousetheodbcconf.exewhenwethinkaboutsuchthings

zxd xh as 64位windows。

zxdxh***

ECho注册驱动程序

myodbc-installer-d-a-n ' MySQL odbc 5.1驱动程序'-t '驱动程序=myodbc5. dll; SETUP=myodbc5S.dll '

Echo--------------------------------------------------------------------------------------

ECHO '| DONE |'

Echo--------------------------------------------------------------------------------------

ECHO '| | '

ECHO '| Hopefully things went well; the Connector/ODBC |'

echo '|fileshavebeencopiedtothesystemdirectory|'

echo '|andthedriverhasbeenregistered.| '

ECHO '| | '

ECHO '疏忽的人生/ODBC is ready to use. | '

欧洲央行

"| |"

ECHO "| The most common thing to do next is to go to the |"

ECHO "| Control Panel and find the ODBC Administrator - |"

ECHO "| then use it to create a Data Source Name (DSN) |"

ECHO "| so you (and your application) can connect to a |"

ECHO "| MySQL server. |"

ECHO "| |"

ECHO "+-----------------------------------------------------+"

EXIT /B 0

:doError2

ECHO "+-----------------------------------------------------+"

ECHO "| ERROR |"

ECHO "+-----------------------------------------------------+"

ECHO "| |"

ECHO "粗心的人生/ODBC not built. |"

ECHO "| |"

ECHO "+-----------------------------------------------------+"

PAUSE

EXIT /B 1

:doError4

ECHO "+-----------------------------------------------------+"

ECHO "| ERROR |"

ECHO "+-----------------------------------------------------+"

ECHO "| |"

ECHO "| Existing Connector/ODBC installed. Request ignored. |"

ECHO "| |"

ECHO "+-----------------------------------------------------+"

PAUSE

EXIT /B 1

:doError5

ECHO "+-----------------------------------------------------+"

ECHO "| ERROR |"

ECHO "+-----------------------------------------------------+"

ECHO "| |"

ECHO "| Can't find the Windows system directory |"

ECHO "| |"

ECHO "+-----------------------------------------------------+"

PAUSE

EXIT /B 1

@ECHO OFF

SET installdir=none

IF EXIST %windir%/system/nul SET installdir=%windir%/system

IF EXIST %windir%/system32/nul SET installdir=%windir%/system32

IF %installdir%==none GOTO :doError4

IF NOT EXIST %installdir%/myodbc-installer.exe GOTO doError2

zxdxh***

zxdxh Deregistering driver...

zxdxh***

myodbc-installer -d -r -n "MySQL ODBC 5.1 Driver"

zxdxh***

zxdxh Removing files...

zxdxh***

ECHO "+-----------------------------------------------------+"

ECHO "| DONE |"

ECHO "+-----------------------------------------------------+"

ECHO "| |"

ECHO "| Hopefully things went well; the Connector/ODBC |"

ECHO "| files have been removed from the system directory |"

ECHO "| and the driver has been deregistered. |"

ECHO "| |"

ECHO "+-----------------------------------------------------+"

EXIT /B 0

:doError2

ECHO "+-----------------------------------------------------+"

ECHO "| ERROR |"

ECHO "+-----------------------------------------------------+"

ECHO "| |"

ECHO "粗心的人生/ODBC does not appear to be installed. |"

ECHO "| |"

ECHO "+-----------------------------------------------------+"

PAUSE

EXIT /B 1

:doError4

ECHO "+-----------------------------------------------------+"

ECHO "| ERROR |"

ECHO "+-----------------------------------------------------+"

ECHO "| |"

ECHO "| Can't find the Windows system directory |"

ECHO "| |"

ECHO "+-----------------------------------------------------+"

PAUSE

EXIT /B 1

关键部分都带有注释,如有问题欢迎大家一起讨论。

同时附已经做好的mysql odbc 5.1 Driver免安装包

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。