NSIS SQL Connection

When installing using my NSIS script installer, I need to run multiple script on SQL Server: select, update, build and paste.

How can I do this without having a SQL Server engine on the computer running the NSIS installer?

I thought about packing SQL Server Compact Edition into my installer so I can use it to connect to SQL Server. So should I go?


source to share

2 answers

I found a plugin for NSIS that can connect to MS SQL database: MSSQL_OLEDB_plug-in

It can be used like this:

${OLEDB}::SQL_Execute  "$SQLQUERY"
Pop $0
DetailPrint $0
Pop $0
DetailPrint $0




You don't need a SQL Server engine to run queries on a remote machine, you need a driver.

One approach is to use a command line client, which also requires a built-in driver. You probably want to link or find the driver that your application uses in your installer.

In SQL Server 2005 or later, the command line client is called sqlcmd . It can be downloaded from the Feature Pack download pages ( 2005 2008 2008R2 2012 ).

So, this is just a question with a bundled SQL script with an installer and executing the script by calling sqlcmd with ExecWait .

You can run your script over a reliable connection with:



Or using SQL Login:



A SQL 2000 version of this approach can be found here on the nsis wiki .



All Articles