This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: I can't connect to SQL after I istall it
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 14, 2013
07:56 AM
I can't connect to SQL after I istall it
Hi,
I am doing an installation of SQL Server Express 2008 R2 from my installscript project. After this installation I need to connect to my installed database instance and run some sql scripts.
I execute a batch file which connects to the database via sqlcmd. This does not work. However, if I run the batch file after the installshield has exited, everything is fine and my sql scripts are executed.
I think the installshield is somehow holding an open connection - because I can connect after it finishes. But why is that? I am not using any SQL functionality in my project (instead I use my own batch file to do the database work).
Hope you can help. Thanks in advance.
I am doing an installation of SQL Server Express 2008 R2 from my installscript project. After this installation I need to connect to my installed database instance and run some sql scripts.
I execute a batch file which connects to the database via sqlcmd. This does not work. However, if I run the batch file after the installshield has exited, everything is fine and my sql scripts are executed.
I think the installshield is somehow holding an open connection - because I can connect after it finishes. But why is that? I am not using any SQL functionality in my project (instead I use my own batch file to do the database work).
Hope you can help. Thanks in advance.
(5) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 15, 2013
04:17 AM
Hi,
How are you trying to run the batch file. Is it through a custom action. If yes, please make sure that the action is sequenced properly.
Thanks.
How are you trying to run the batch file. Is it through a custom action. If yes, please make sure that the action is sequenced properly.
Thanks.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 15, 2013
09:29 AM
Thank you for your reply.
I execute bat file after SQL Installation using a custom action. The problem is not the sequentiality...
I execute bat file after SQL Installation using a custom action. The problem is not the sequentiality...
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 15, 2013
11:06 AM
rossellag wrote:
Thank you for your reply.
I execute bat file after SQL Installation using a custom action. The problem is not the sequentiality...
I wouldn't be to hasty to dismiss the sequentiality.
You should probably be using a deferred custom action... which means you need to take special care if you are expecting properties to be available to it.
Remove the LAAW_OPTION_HIDDEN option if you are using it to launch the bat file and put some ECHO and PAUSE statements in the bat file to see what is going on.
1. Are the arguments (if any) being passed to it correctly.
2. Is there some redirection (64 bit) taking place for folders and/or registry?
3. Is it being launched 'As administrator' and thereby the current directory is getting changed under you?
Can you look into this and then post the results and the bat file?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 18, 2013
07:58 AM
The problem is that SQLCMD is not recognized as command.
Probably the environment variables are updated only when the installation finishes. I think this because when I restart the setup, the batch file works fine.
The batch file works only if it is not executed immediately after the installation of SQL Server
Probably the environment variables are updated only when the installation finishes. I think this because when I restart the setup, the batch file works fine.
The batch file works only if it is not executed immediately after the installation of SQL Server
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Feb 18, 2013
10:18 AM
You are correct... the environment variables are updated when the installation finishes.
You can do something like below in your bat file (after installing SQL).
Be a little careful with this. I think it will work for SQL 2008... not sure about SQL 2012 (\100).
You may want something different IF ERRORLEVEL 1... or you may just delete all of that.
SQLCMD /? > nul 2> nul
IF NOT ERRORLEVEL 1 GOTO :eof
SETX Path "%path%;%ProgramFiles%\Microsoft SQL Server\100\Tools\Binn" 2>nul
IF ERRORLEVEL 1 (
COLOR E0
ECHO.
ECHO.On this OS you must manually set the Path environment variable to include
ECHO.%ProgramFiles%\Microsoft SQL Server\100\Tools\Binn
ECHO.Edit that as follows:
ECHO.Right click on 'My Computer'
ECHO. Properties
ECHO. Advanced
ECHO. Environment Variables
PAUSE
)
GOTO :eof
You can do something like below in your bat file (after installing SQL).
Be a little careful with this. I think it will work for SQL 2008... not sure about SQL 2012 (\100).
You may want something different IF ERRORLEVEL 1... or you may just delete all of that.
SQLCMD /? > nul 2> nul
IF NOT ERRORLEVEL 1 GOTO :eof
SETX Path "%path%;%ProgramFiles%\Microsoft SQL Server\100\Tools\Binn" 2>nul
IF ERRORLEVEL 1 (
COLOR E0
ECHO.
ECHO.On this OS you must manually set the Path environment variable to include
ECHO.%ProgramFiles%\Microsoft SQL Server\100\Tools\Binn
ECHO.Edit that as follows:
ECHO.Right click on 'My Computer'
ECHO. Properties
ECHO. Advanced
ECHO. Environment Variables
PAUSE
)
GOTO :eof