NsODBCext plug-in

From NSIS Wiki
Jump to navigationJump to search
Author: Outtay (talk, contrib)


Description

nsODBCext is an NSIS ODBC Configuration Manager. Works using odbcinst32.dll. Based on SQLInstall Win API. This plugin is based on NsODBC.
The main way it differs is by changing the parameter format, such that the whole stack isn't read in and by also retrying the SQLInstall call with a multistring format, which is required for the SQL Server driver.

Download Link

NsODBCext.zip (8 KB)

Methods

The plugin was not tested with all functions. Only AddDSN was required for my use case. Source Code is attached. Please modify as you see fit.

    ::AddDSN       ;[DriverName] [DSN=XXX;UID=0x777] ...
    ::AddSysDSN    ;[DriverName] [DSN=XXX;UID=0x777] ...
    ::ConfDSN      ;[DriverName] [DSN=XXX;UID=0x777] ...
    ::ConfSysDSN   ;[DriverName] [DSN=XXX;UID=0x777] ...
    ::RemoveDSN    ;[DriverName] [DSN=XXX;UID=0x777] ...
    ::RemoveSysDSN ;[DriverName] [DSN=XXX;UID=0x777] ...
    ::RemoveDefDSN ;[DriverName] [DSN=XXX;UID=0x777] ...

Example Scripts

  ; Create MS Access DSN & Data Base
  nsODBC::AddSysDSN "Microsoft Access Driver (*.mdb)" "DSN=MyDSN;DBQ=C:\Dev\MyAccess.mdb"
 
  ; Create SQL Server DSN
  nsODBC::AddDSN "SQL Server" "DSN=MyDSN;SERVER=127.0.0.1,1433;Trusted_Connection=Yes;DATABASE=myDB"
 
  ; Remove DSN
  nsODBC::RemoveSysDSN "Microsoft Access Driver (*.mdb)" "DSN=MyDSN"