NsODBC plug-in: Difference between revisions

From NSIS Wiki
Jump to navigationJump to search
m (Added category links.)
 
(6 intermediate revisions by 5 users not shown)
Line 1: Line 1:
{|align=right
{{PageAuthor|sl}}
|<small>Author: [[{{ns:2}}:sl|sl]] ([[{{ns:3}}:sl|talk]], [[{{ns:-1}}:Contributions/sl|contrib]])</small>
 
|}
<br style="clear:both;">
== Description ==
== Description ==
  nsODBC is NSIS ODBC Configuration Manager. Works over
nsODBC is NSIS ODBC Configuration Manager. Works over odbcinst32.dll. Based on SQLInstall Win API.
  odbcinst32.dll. Based on SQLInstall Win API.
 
== Download Link ==
<attach>NsODBC.zip</attach><br>
<attach>NsODBC-unicode.zip</attach>
 
== Methods ==
<highlight-nsis>
    ::AddDSN      ;[DriverName] Parameters pairs follows: [DSN=XXX] [UID=0x777] ...
    ::AddSysDSN    ;[DriverName] Parameters pairs follows: [DSN=XXX] [UID=0x777] ...
    ::ConfDSN      ;[DriverName] Parameters pairs follows: [DSN=XXX] [UID=0x777] ...
    ::ConfSysDSN  ;[DriverName] Parameters pairs follows: [DSN=XXX] [UID=0x777] ...
    ::RemoveDSN    ;[DriverName] Parameters pairs follows: [DSN=XXX] [UID=0x777] ...
    ::RemoveSysDSN ;[DriverName] Parameters pairs follows: [DSN=XXX] [UID=0x777] ...
    ::RemoveDefDSN ;[DriverName] Parameters pairs follows: [DSN=XXX] [UID=0x777] ...
</highlight-nsis>


== The Script ==
== Example Scripts ==
<highlight-nsis>
<highlight-nsis>
   ; Create MS Access DSN & Data Base
   ; Create MS Access DSN & Data Base
   nsODBC::AddSysDSN "Microsoft Access Driver (*.mdb)" "DSN=SERVER_${PRJ_NAME}_DB"
   nsODBC::AddSysDSN "Microsoft Access Driver (*.mdb)" "DSN=SERVER_${PRJ_NAME}_DB"
Line 15: Line 28:
   ; Remove DSN
   ; Remove DSN
   nsODBC::RemoveSysDSN "Microsoft Access Driver (*.mdb)" "DSN=SERVER_${PRJ_NAME}_DB"
   nsODBC::RemoveSysDSN "Microsoft Access Driver (*.mdb)" "DSN=SERVER_${PRJ_NAME}_DB"
</highlight-nsis>


  ; Methods:
It is also possible to create, compact, and repair Microsoft Access mdb files with this plugin. A link below explains the syntax for compacting and repairing the database.  
    ::AddDSN      ;[DriverName] Parameters pairs follows: [DSN=XXX] [UID=0x777] ...
'''Notice:''' Be sure to put the path to the database file in escaped quotes as the command will fail if there are spaces in the file name otherwise.
    ::AddSysDSN)  ;[DriverName] Parameters pairs follows: [DSN=XXX] [UID=0x777] ...
<highlight-nsis>
    ::ConfDSN)    ;[DriverName] Parameters pairs follows: [DSN=XXX] [UID=0x777] ...
   ; Create a JetSQL (mdb) file.
    ::ConfSysDSN   ;[DriverName] Parameters pairs follows: [DSN=XXX] [UID=0x777] ...
  nsODBC::AddDSN "Microsoft Access Driver (*.mdb)" "CREATE_DB=$\"$INSTDIR\foo.mdb$\" General"
    ::RemoveDSN    ;[DriverName] Parameters pairs follows: [DSN=XXX] [UID=0x777] ...
    ::RemoveSysDSN ;[DriverName] Parameters pairs follows: [DSN=XXX] [UID=0x777] ...
    ::RemoveDefDSN ;[DriverName] Parameters pairs follows: [DSN=XXX] [UID=0x777] ...
</highlight-nsis>
</highlight-nsis>


[[{{ns:14}}:Plugins]]
== References ==
[http://support.microsoft.com/kb/126606/EN-US/ MS Knowledge base article that demonstrates CREATE_DB, REPAIR_DB, and COMPACT_DB]
 
[[Category:Plugins]]
[[Category:Database Functions]]

Latest revision as of 10:45, 6 December 2023

Author: sl (talk, contrib)


Description

nsODBC is NSIS ODBC Configuration Manager. Works over odbcinst32.dll. Based on SQLInstall Win API.

Download Link

NsODBC.zip (7 KB)
NsODBC-unicode.zip (8 KB)

Methods

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

Example Scripts

  ; Create MS Access DSN & Data Base
  nsODBC::AddSysDSN "Microsoft Access Driver (*.mdb)" "DSN=SERVER_${PRJ_NAME}_DB"
"DBQ=$INSTDIR\${PRJ_NAME}.mdb"
 
  ; Remove DSN
  nsODBC::RemoveSysDSN "Microsoft Access Driver (*.mdb)" "DSN=SERVER_${PRJ_NAME}_DB"

It is also possible to create, compact, and repair Microsoft Access mdb files with this plugin. A link below explains the syntax for compacting and repairing the database. Notice: Be sure to put the path to the database file in escaped quotes as the command will fail if there are spaces in the file name otherwise.

  ; Create a JetSQL (mdb) file.
  nsODBC::AddDSN "Microsoft Access Driver (*.mdb)" "CREATE_DB=$\"$INSTDIR\foo.mdb$\" General"

References

MS Knowledge base article that demonstrates CREATE_DB, REPAIR_DB, and COMPACT_DB