Old 9th October 2009, 20:08   #41
sgiusto
Member
 
Join Date: Mar 2007
Location: Italy
Posts: 99
I think you should upgrade to version 2.42 at least, since the plugin is written for the new plugin-api

Stefano
sgiusto is offline   Reply With Quote
Old 3rd January 2010, 09:48   #42
Lodester
Junior Member
 
Join Date: Jan 2010
Posts: 19
I'm trying to run a simple test of this in a function, it blows up right after login.

Running the test nsi in the .zip seems to work fine, so I guess I'm doing something wrong/unexpected. I'm just learning NSIS so that seems pretty likely

Here's what I have in the function

Quote:
MSSQL_OLEDB::SQL_Logon "$sqlsvr" "" ;"$8"
pop $0
messagebox MB_OK $0 ; returns 0
pop $0
messagebox MB_OK $0 ; returns 'Login Successful'
MSSQL_OLEDB::SQL_GetError
Pop $0
messagebox MB_OK $0 ; returns 0
Pop $0
messagebox MB_OK $0 ; returns 'SQL State: 0x00e143d8 - Native: 0 - Message:'
MSSQL_OLEDB::SQL_Execute "select @@Version"
Pop $0
messagebox MB_OK $0
Pop $0
messagebox MB_OK $0
MSSQL_OLEDB::SQL_GetError
Pop $0
messagebox MB_OK $0
Pop $0
messagebox MB_OK $0
MSSQL_OLEDB::SQL_GetRow
Pop $0
messagebox MB_OK $0
Pop $0
messagebox MB_OK $0
MSSQL_OLEDB::SQL_GetError
Pop $0
messagebox MB_OK $0
Pop $0
messagebox MB_OK $0
MSSQL_OLEDB::SQL_Logout
[B]

The installer crashes after the MB_OK click with the SQL State: error.

Unhandled exception at 0x00b41be4 in Mongoose.exe: 0xC0000005: Access violation reading location 0x00000000.

The debug break pointer is on MSSQL_OLEDB.dll:
00B41BE4 mov eax,dword ptr [ebp]

This happens consistently whether I'm executing a sql file or just a command. SQLOLEDB works fine, and i see nothing in a trace to indicate a problem with SQL. Nothing suspicious in the event logs otherwise.

I tried redirecting the last popped $0 back to a label, but no dice.

running under:
Windows 2003 SP2, SQL 2005 SP3.
NSIS version 2.46

If anyone has any other ideas for SQL providers in NSIS I'd be greatful; i have an install proejct that needs to use a ton of it.

Thanks in advance for any help.

Update: Adding /NOUNLOAD to all of the MSSQL_OLEDB calls seemes to have resolved the issue.
I thought /NOUNLOAD wasn't needed anymore?
In any case, its working but if anyone has any other ideas or tips for using NSIS with SQL I'd love to hear them.

Last edited by Lodester; 3rd January 2010 at 10:21.
Lodester is offline   Reply With Quote
Old 3rd January 2010, 21:10   #43
sgiusto
Member
 
Join Date: Mar 2007
Location: Italy
Posts: 99
Are you using latest version (2.0.1) of the plugin?
It seems you are using an older version, please check file version of MSSQL_OLEDB.DLL in $PROGRAMFILES\nsis\plugins folder.
I use the plugin for a lot of stuff related to sql server and have no problems.
sgiusto is offline   Reply With Quote
Old 4th January 2010, 02:40   #44
Lodester
Junior Member
 
Join Date: Jan 2010
Posts: 19
It appears that was my problem, or at least partially

The version of MSSQL_OLDEB in Mssql_oledb2.zip on the wiki is 2.0.0 (Aug 1 2009), you mentioned 2.0.1 ?
Where do i get that version?

Also, you might consider taking the old .zip off the wiki or making the distinction between the all-caps MSSQL_OLEDB.zip (version 1.4.0) and Mssql_oledb2.zip (2.0.0) more clear.

It's stuff like this that makes me want to run back in to the cold, uncaring arms of InstallShield......okay not really, but this wiki-and-forum based mess is pretty horrific.

Finding a plugin [that works] is hard enough, finding the right file in the right thread instead of the barely distinguishable files attached all over the wiki (some have multiple wiki pages with multiple versions of files!!) is a train wreck. Get what you pay for i guess?

Sorry for ranting. I do very much appreciate your work, sgiusto. Cheers to you.
Lodester is offline   Reply With Quote
Old 4th January 2010, 10:54   #45
sgiusto
Member
 
Join Date: Mar 2007
Location: Italy
Posts: 99
Thank you for ranting!
I updated the plugin page. Now the download section should be easier to understand.
The dll in the zip file is version 2.0.1. I updated only the 'product version' field in the resource file and not the 'file version' field.
Please check if 'product version' is 2.0.1.
I will fix this in a future release.
sgiusto is offline   Reply With Quote
Old 8th February 2010, 02:54   #46
dgrinberg
Junior Member
 
Join Date: Aug 2009
Posts: 8
I really like the MSSQL_OLEDB plugin, I use it to build the application DB from SQL scripts.

However my application is quite large and has heaps of stored procedures. I dont really want to put each stored proc in its own file - it's too much of a maintenance overhead.

What I have dont instead is:
1. get NSIS to open the file
2. iterate through the file line by line, creating an SQL string
3. When the loop hits a "GO", run the script then continue iterating

See here for an example:
http://ontheperiphery.veraida.com/co...tiple-commands

This seems to have worked quite well for me. I dont know if this is the preferred method, but as a few people has asked about it I thought I's share!
dgrinberg is offline   Reply With Quote
Old 9th February 2010, 20:42   #47
sgiusto
Member
 
Join Date: Mar 2007
Location: Italy
Posts: 99
I use similar approach.
I store each long statement in a separate file, then I parse a text file like this:
X <path to script to execute>
I <short sql statement to be executed>
X <path to other script>
I <sql command>
I <sql command>
....


Each version of the application has its own text file with scripts specific to that version:
20091012.txt
20100101.txt
and so on.

So a fresh installation will execute all the scripts, an update will execute scripts from previous version up to current.
sgiusto is offline   Reply With Quote
Old 11th February 2010, 15:00   #48
mongi
Junior Member
 
Join Date: Feb 2010
Posts: 2
Angry Access violation bug

Hello.

Did anybody try to run this plugin using Unicode build of nsis? I've tried to make it work for 2 days but failed due to installer crush on ExecuteScript function. All other functions work almost well, but when I call "ExecuteScript" I just get AV exception.

The same project runs perfectly under ANSI build.

It's good that source code is included, but not all files are present, so I couldn't fix this bug:
You're allocating memory:
Quote:
line 356: Command=(TCHAR *)HeapAlloc(heap,0,fileLen+1);
and then you insert last '\0'
Quote:
line 376: Command[pos]=_T('\0');
but in Unicode it inserts 2(!) chars and you run out of borders of "fileLen+1". The best practice is to allocate +10 bytes(or to use +sizeof(TCHAR)) to avoid such "bugs".

Sample installer fails also.

P.S. Why you are so stingy when allocating
Quote:
line 208: TCHAR command[1024];
for SQL query? 1024 is not enough for good script of procedure creation. Why it's not mentioned in wiki about this hidden restriction which causes 100% AV on large queries?
mongi is offline   Reply With Quote
Old 11th February 2010, 20:33   #49
sgiusto
Member
 
Join Date: Mar 2007
Location: Italy
Posts: 99
Hello,
I will check and correct this issue, when I checked the test installer in unicode I didn't got any error...
I will add the 1024 limit to the documentation. If you need longer commands I suggest to use ExecuteScript (if it works... )
I provide the whole source code with the plugin. The files you are missing are prolly part of nsis sources.

Regards
Stefano
sgiusto is offline   Reply With Quote
Old 11th February 2010, 21:12   #50
mongi
Junior Member
 
Join Date: Feb 2010
Posts: 2
Thanks for fast reply.

This kind of errors may happen and may not depending on variety of conditions, starting from complier and ending up with irregular sun activity.
I use this config:
Quote:
NSIS v.2.45.1-Unicode
UMSSQL_OLEDB 2.0.1.0
Testing on Windows 7 and Windows Server 2003
Moreover, on Win2k3 installer had three types of behavior:
1) autoclose on error without any messages (~80%)
2) proposal to start debagger(~19%)
3) "as supposed to run" (~1%, 1 or 2 lucky cases)
Quote:
If you need longer commands I suggest to use ExecuteScript
I tried to, but failed. I began a search for solution towards "Execute" and was very disappointed, when it couldn't stand my 16KB SQL script
mongi is offline   Reply With Quote
Old 10th May 2010, 19:45   #51
chivalri
Junior Member
 
Join Date: Apr 2007
Location: Houston
Posts: 20
I have been using this plug in for two years and have been very pleased with the results. My installer setups up our customer with SQL 2005 Express and then loads the database.

Recently, more of our customers have started using SQL 2008 Express. I have also decided that as most of our customers are now using Server 2008 and Windows 7, I need to switch to installing SQL 2008 Express as 2005 generates Known Comparability messages that in turn create tech support calls.

I have run into a problem with this plug in when trying to access a SQL 2008 Express server. It fails with this message.

Could not connect to SQL Server : SQL State: 0x80004005 - Native: 0 - Message: [DBNETLIB][ConnectionOpen (Invalid Instance()).]Invalid connection.

The same code works fine with SQL 2005 and MSDE.

Has anyone else been having this issue?
chivalri is offline   Reply With Quote
Old 10th May 2010, 21:00   #52
sgiusto
Member
 
Join Date: Mar 2007
Location: Italy
Posts: 99
Hello,
I ran the example given with the plugin against a windows 7 ultimate 64bit with SQL 2008 express using SQL security and got no problems.

I am using the plugin to deploy my application with sql2008 without problems.

From the error code you posted it seems you have some kind of problem with a named instance.
Hope this helps
Stefano
sgiusto is offline   Reply With Quote
Old 27th May 2010, 19:02   #53
jck77
Junior Member
 
Join Date: May 2010
Posts: 1
SQLServer 2008

Hello, I tried it with a SQLServer 2008 (default instance) and was not able to connect to SQLServer. (No problem with SQLServer 2005 upgraded to 2008...)
Does any body have the same problem? Does anybody know how to workaround or if a fix is needed in the plugin? (Or if I'm missing any special configuration of the plugin needed for SQLServer 2008...)

Many thanks!
jck77 is offline   Reply With Quote
Old 28th May 2010, 20:37   #54
sgiusto
Member
 
Join Date: Mar 2007
Location: Italy
Posts: 99
Hello,
what error code is returned upon failure?
please read my previous post. I use sql 2008 without any problem.
Regards
Stefano
sgiusto is offline   Reply With Quote
Old 19th February 2011, 13:18   #55
swordd
Junior Member
 
Join Date: Feb 2011
Posts: 3
Timeout

Hello there,

i use your plugin in my installer and most of the time it works really great.
Thanks for your great work!

My installer installs a local MS SQL Server 2008 Express R2 during setup.
Later in the installation process i use your plugin to do a connection test
against the (already restarted and fully running) DB using named pipes.

MSSQL_OLEDB::SQL_Logon "127.0.0.1\InstanceName" "user" "password"

On a small number of machines im getting a sql timeout from your plugin when doing this.
I've made a loop around the logon part and let the user repeat the connection test.
Sometimes it works on the third or fourth attempt.

What timeout do you use internally in your plugin for the logon cmd?
Is there a way to increase the timeout?
Is it maybe possible that you expose the timeout parameter in your plugin?

Regards
Swordd
swordd is offline   Reply With Quote
Old 21st February 2011, 04:52   #56
dgrinberg
Junior Member
 
Join Date: Aug 2009
Posts: 8
Logon Timeout

Hi,

I have been using this plugin for a couple of years and I am really happy with the results thus far.

However, I have been getting some issues similar to the previous post.

My installer creates a new named instance of SQLServer 2005 Express, connects and runs scripts to create the applications database.

This had been all working fine, until a client tried installing it on a box with SQLServer 2008. It is now timing out, trying to connect to the database.

I have not yet tried a loop, as per the previous post.
dgrinberg is offline   Reply With Quote
Old 21st February 2011, 21:15   #57
sgiusto
Member
 
Join Date: Mar 2007
Location: Italy
Posts: 99
Hello,
connection timeout could be set before opening the connection, I will consider adding such a feature in future.
A little research on google show that connection timeout problems with sql2008 are no so infrequent. Changing the timeout value could not fix the problem.
Are you using SQL Express, Standard, Enterprise?
Are you using default instance or named instance?
What is your default protocol?
Is the sql box local or remote?
My tests are negative so far (the connections are working as expected).
Give me some more details, so I can make more focused tests.
Regards
Stefano
sgiusto is offline   Reply With Quote
Old 21st February 2011, 22:37   #58
dgrinberg
Junior Member
 
Join Date: Aug 2009
Posts: 8
Hi Stefano,

In my situation, the answers to your questions are as follows:
* SQLExpress
* Named Instance
* Shared Memory (but network protocols are all switched on)
* Local Box

Some other details
* oSQL worked fine
* ODBC connection (using SQL Native Client) testd successfully

I am also doing some more testing to see if there is some specific combination that sets this off. I will post as soon as I have more information.

As an aside, could the OLEDB driver be simply interchanged with SQL Native client?
If so, could that be made parameter?

David
dgrinberg is offline   Reply With Quote
Old 22nd February 2011, 08:22   #59
swordd
Junior Member
 
Join Date: Feb 2011
Posts: 3
Quote:
Originally Posted by sgiusto View Post
Hello,
Are you using SQL Express, Standard, Enterprise?
Are you using default instance or named instance?
What is your default protocol?
Is the sql box local or remote?
Stefano
- SQL Server 2008 Express R2
- named instance
- default protocol is named pipe (IP also switched on)
- sql box is local

i tried various sql tools (osql, ems,...) no timeout problems there.
As a workaround i wrote a simple commandline tool in .Net to do all my database related stuff now. I call it from the installer with execwait and some params.
Works like a charme.

Regards
swordd is offline   Reply With Quote
Old 22nd February 2011, 09:22   #60
MSG
Major Dude
 
Join Date: Oct 2006
Posts: 1,892
Quote:
Originally Posted by swordd View Post
As a workaround i wrote a simple commandline tool in .Net to do all my database related stuff now. I call it from the installer with execwait and some params.
Works like a charme.
Rather off-topic, but: Note that your users may not all have .NET installed.
MSG is offline   Reply With Quote
Old 22nd February 2011, 09:54   #61
swordd
Junior Member
 
Join Date: Feb 2011
Posts: 3
Quote:
Originally Posted by MSG View Post
Rather off-topic, but: Note that your users may not all have .NET installed.
thx for that hint my installer takes care of that part anyway because the app is .net based.
swordd is offline   Reply With Quote
Old 1st April 2011, 18:34   #62
loyalp
Junior Member
 
Join Date: Jan 2011
Posts: 2
Thumbs up

Hi there,

I am also experiencing this logon timeout issue on 2008 R2 Server.

I'm using Standard Edition with a default instance, on a local box. It has failed with both Mixed Mode authentication and Windows Authentication only.

Let me know if you need any more information to help diagnose the issue.

Thanks.
loyalp is offline   Reply With Quote
Old 24th August 2011, 11:33   #63
isawen
Junior Member
 
Join Date: Jan 2010
Posts: 39
Login to localhost\sqlexpress doesn't work on some machines

Quote:
Originally Posted by njpride View Post
First, great! Really useful, thanks for all your effort!

Now to my issue, if I try to logon to a server at localhost\instanceName it doesn't login however if I try machineName\instanceName it does connect without any problems.

Any idea how to get around this? Using other tools I can connect via the localhost.

Thanks

------
Seems to have been some interference between keyboard and chair.

Right way to do it : "(local)\instanceName"
Another way that works but is pointless! Look up the machine name in registry and use that.

Thanks for being a sounding board

I'm encountering the same problem. On my Windows XP SP3 VMWare Virtual Machine with only SQL Server 2008 Express installed and .NET 3.5 the plugin example fails to log-in on localhost\sqlexpress.

What could be the real reason for such log-in fail message?
"SQL State: 0x80004005 - Native: 0 - Message: [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied."

isawen is offline   Reply With Quote
Old 6th November 2012, 12:03   #64
SRINIVAS_hp
Junior Member
 
Join Date: Nov 2012
Posts: 3
Not able to login with different windows user id. How to give different windows useid

Quote:
Originally Posted by sgiusto View Post
Try the attached installer, on my pc works fine
Regards
Stefano
Not able to login with different windows user id. How to give different windows useid
SRINIVAS_hp is offline   Reply With Quote
Old 7th November 2012, 05:58   #65
SRINIVAS_hp
Junior Member
 
Join Date: Nov 2012
Posts: 3
Not able to login with different windows user id. How to give different windows useid

[QUOTE=SRINIVAS_hp;2896183]Not able to login with different windows user id. How to give different windows useid[/QUOTE

LogOn how i can give different user id info.?
SRINIVAS_hp is offline   Reply With Quote
Old 7th November 2012, 07:10   #66
SRINIVAS_hp
Junior Member
 
Join Date: Nov 2012
Posts: 3
in windows,
i have logged in as say user, "ABC"
But "ABC" user does not have the permission to access sql agent. SO i have to give another user say "def",
Like ${OLEDB}::SQL_Logon "$SQLSERVER" "def" "$SQLPASSWORD".

But i am getting

Loggin on to SQL server RAJATSSRS.qa.englab.local\GRYSQL2008
1
Error initializing OLEDB Connection (Initialize)
0
SQL State: 0x80040e4d - Native: 0 - Message: Login failed for user 'englab\rnair'.

But it works with "sa" user.

Kindly help me in solving this issue
SRINIVAS_hp is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Developer Center > NSIS Discussion

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump