MySQL ODBC 5.1 Driver Installation-free script

Source: Internet
Author: User

When using MySQL, you need to use the ODBC data source to connect to MySQL. Therefore, you often need to use a driver without installation. Please refer to the script on the official website,

 

I modified a practical script and shared it with you:

 

Install MySQL ODBC 5.1 Driver

@ Echo off <br/> set installdir = none <br/> If exist % WINDIR %/system/NUL set installdir = % WINDIR %/System <br/> If exist % Windir %/system32/NUL set installdir = % WINDIR %/system32 <br/> If % installdir % = none Goto: doerror5 <br/> If exist % installdir %/myodbc-installer.exe Goto: doerror4 <br/> REM *** <br/> REM * Find out the bin/lib directory, or use default <br/> REM **** <br/> set libdir = lib <br/> set bindir = bin <br/> If exist lib/release/mydbc5.lib set libdir = lib/release <br/> If exist lib/relwithdebinfo/mydbc5.lib set libdir = lib/relwithdebinfo <br/> If exist bin/release/myodbc-installer.exe set bindir = bin/release <br/> If exist bin/relwithdebinfo/myodbc-installer.exe set bindir = bin/relwithdebinfo <br/> REM ***** <br/> REM * copying myodbc libraries and executables to install dir. .. <br/> REM **** <br/> echo copying installation files <br/> if not exist % libdir %/mydbc5.lib Goto: doerror2 <br/> if not exist % libdir %/mydbc5s. lib Goto: doerror2 <br/> if not exist % bindir %/myodbc-installer.exe Goto: doerror2 <br/> copy % libdir %/mydbc5s. dll % installdir % <br/> copy % libdir %/mydbc5s. lib % installdir % <br/> copy % libdir %/mydbc5.dll % installdir % <br/> copy % libdir %/mydbc5.lib % installdir % <br/> copy % bindir %/myodbc-installer.exe % installdir % <br/> copy DOC /*. HLP % installdir % <br/> REM *** <br/> REM * registering driver... <br/> REM * We can do this with myodbc-installer.exe or the MS windows odbcconf.exe. it <br/> REM * may be safer to use the odbcconf.exe when we think about such things <br/> REM * as 64bit windows. <br/> REM **** <br/> echo registering driver <br/> myodbc-installer-D-a-n "MySQL ODBC 5.1 Driver"-T "driver = mydbc5.dll; setup = mydbc5s. DLL "<br/> echo" + ------------------------------------------------- + "<br/> echo" | done | "<br/> echo" + response + "<br/> echo" | "<br/> echo" | hopefully things went well; the connector/ODBC | "<br/> echo" | files have been copied to the system directory | "<br/> echo" | and the driver has been registered. | "<br/> echo" | "<br/> echo" | connector/ODBC is ready to use. | "<br/> echo" | "<br/> echo" | the most common thing to do next is to go to the | "<br/> echo" | Control panel and find the ODBC Administrator-| "<br/> echo" | then use it to create a data source name (DSN) | "<br/> echo" | so you (and your application) can connect to a | "<br/> echo" | MySQL server. | "<br/> echo" | "<br/> echo" + ----------------------------------------------------- + "<br/> exit/B 0 <br/>: doerror2 <br/> echo "+ response +" <br/> echo "| error |" <br/> echo "+ ------------------------------------------------- +" <br/> echo "|" <br/> echo "| connector/ODBC not built. | "<br/> echo" | "<br/> echo" + ----------------------------------------------------- + "<br/> pause <br/> exit/B 1 <br/>: doerror4 <br/> echo "+ response +" <br/> echo "| error |" <br/> echo "+ ------------------------------------------------- +" <br/> echo "|" <br/> echo "| existing connector/ODBC installed. request ignored. | "<br/> echo" | "<br/> echo" + ----------------------------------------------------- + "<br/> pause <br/> exit/B 1 <br/>: doerror5 <br/> echo "+ response +" <br/> echo "| error |" <br/> echo "+ ------------------------------------------------- +" <br/> echo "|" <br/> echo "| can't find the Windows System directory |" <br/> echo "|" <br/> echo "+ ----------------------------------------------------- +" <br/> pause <br/> exit/B 1 <br/> 

 

Detach part

@ Echo off <br/> REM ################################ ######################## <br/> REM/brief uninstall myodbc. <br/> REM this exists for those working with the Windows source <br/> REM distribution. <br/> REM use this to remove the driver and supporting files <br/> REM from the system directory and deregister the driver. <br/> REM/SA readme. win <br/> REM ############################# ########################### <br/> set installdir = none <br/> if exist % WINDIR %/system/NUL set installdir = % WINDIR %/System <br/> If exist % WINDIR %/system32/NUL set installdir = % WINDIR %/system32 <br /> If % installdir % = none Goto: doerror4 <br/> if not exist % installdir %/myodbc-installer.exe goto doerror2 <br/> REM *** <br/> REM * deregistering driver... <br/> REM ***** <br/> myodbc-installer-d-r-n "MySQL ODBC 5.1 Driver" <br/> REM ***** <br/> REM * removing files... <br/> REM **** <br/> Del/Q/F % installdir %/mydbc5s. DLL <br/> Del/Q/F % installdir %/mydbc5s. lib <br/> Del/Q/F % installdir %/mydbc5.dll <br/> Del/Q/F % installdir %/mydbc5.lib <br/> Del/Q/F % installdir %/myodbc-installer.exe <br/> Del/Q/F % installdir %/mydbc3 *. HLP <br/> echo "+ response +" <br/> echo "| done |" <br/> echo "+ ------------------------------------------------- +" <br/> echo "|" <br/> echo "| hopefully things went well; the connector/ODBC | "<br/> echo" | files have been removed from the system directory | "<br/> echo" | and the driver has been deregistered. | "<br/> echo" | "<br/> echo" + ----------------------------------------------------- + "<br/> exit/B 0 <br/>: doerror2 <br/> echo "+ response +" <br/> echo "| error |" <br/> echo "+ ------------------------------------------------- +" <br/> echo "|" <br/> echo "| connector/ODBC does not appear to be installed. | "<br/> echo" | "<br/> echo" + ----------------------------------------------------- + "<br/> pause <br/> exit/B 1 <br/>: doerror4 <br/> echo "+ response +" <br/> echo "| error |" <br/> echo "+ ------------------------------------------------- +" <br/> echo "|" <br/> echo "| can't find the Windows System directory |" <br/> echo "|" <br/> echo "+ ----------------------------------------------------- +" <br/> pause <br/> exit/B 1 <br/> 

 

The key parts are annotated. If you have any questions, please join us.

 

The installation package for MySQL ODBC 5.1 Driver is also provided.

 

MySQL ODBC 5.1 Driver

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.