NSIS 安装 ODBC 驱动


安装 ODBC 驱动

Section -RegODBC SEC02
  ReadRegStr $0 HKLM "SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers" "MySQL ODBC 3.51 Driver"
  StrCmp $0 "Installed" OK    #判断MySQL ODBC 3.51 Driver是否安装
  SetOutPath "$SYSDIR"
  SetOverwrite ifnewer
  File  "F:\setup\myodbc3.dll"
  File  "F:\setup\myodbc3S.dll"
  File  "F:\setup\msvcr71.dll"
  
  WriteRegStr HKLM "SOFTWARE\ODBC\ODBCINST.INI\MySQL ODBC 3.51 Driver" Driver "$SYSDIR\myodbc3.dll"
  WriteRegStr HKLM "SOFTWARE\ODBC\ODBCINST.INI\MySQL ODBC 3.51 Driver" Setup "$SYSDIR\myodbc3S.dll"
  WriteRegDWORD HKLM "SOFTWARE\ODBC\ODBCINST.INI\MySQL ODBC 3.51 Driver" UsageCount "00000001"
  WriteRegStr HKLM "SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers" "MySQL ODBC 3.51 Driver" "Installed"
OK:
nsODBC::AddSysDSN "MySQL ODBC 3.51 Driver" "DSN=testdb" "Description=testdb" "Server=localhost" "User=root" "Password=root" "Database=testdb"
SectionEnd



卸载 ODBC 驱动

Section Uninstall
nsODBC::RemoveSysDSN "MySQL ODBC 3.51 Driver" "DSN=testdb" "Description=testdb" "Server=localhost" "User=root" "Password=root" "Database=testdb"
  Delete "$SYSDIR\myodbc3.dll"
  Delete "$SYSDIR\myodbc3S.dll"
  Delete "$SYSDIR\msvcr71.dll"
  DeleteRegKey HKLM "SOFTWARE\ODBC\ODBCINST.INI\MySQL ODBC 3.51 Driver"
  DeleteRegValue HKLM "SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers" "MySQL ODBC 3.51 Driver"
  SetAutoClose true
SectionEnd

使用 NSIS 的 NsODBC 插件,其地址是 http://nsis.sourceforge.net/NsODBC_plug-in



注:本文转载自:http://blog.csdn.net/z3642214/article/details/6800723


你可能感兴趣的:(NSIS 安装 ODBC 驱动)