PDA

View Full Version : MSSQL 2005 express installation & creation of a DB



NewsArchive
01-07-2010, 04:23 AM
I need to make an installation of a program for IT non professionals, that:

Installs a named SQL 2005 express with a given SA password
Creates an empty DB with a given name
Installs the db (run a FM3 app)
Installs some basic values in given tables (Run a SQL script)

All silent.

I have added MSSQL2005 as Core PreRequisites

Is there an/several example script(s) - An answer on this NG says something
like it.

Hopeful regards

Edvard Korsbæk

NewsArchive
01-08-2010, 02:59 AM
Hi Edvard

Theres a couple of ways you can create a MS SQL with SB.

In the attached you can see two different ways to create a SQL db with
everything to go with it.

Perhaps quickest way is to create a SQL script to create your DB, users,
table etc and then just call the script.

This works with MSSQL 2008 but should still work with earlier versions of
SQL server.

HTH

Cheers

Richard

NewsArchive
01-08-2010, 02:59 AM
Very, very nice Richard
Thanks!

Somebody, perhaps you Richard:
How to create the MSSQL server 'BBSOFT' with SA login 'SAPASWORD'?

Edvard Korsbæk

NewsArchive
01-08-2010, 03:00 AM
Edvard,

google on SQL CREATE A USER and you will find all you need .... ;)

CREATE USER user_name
[ { { FOR | FROM }
{
LOGIN login_name
| CERTIFICATE cert_name
| ASYMMETRIC KEY asym_key_name
}
| WITHOUT LOGIN
]
[ WITH DEFAULT_SCHEMA = schema_name ]


CREATE LOGIN loginName { WITH <option_list1> | FROM <sources> }

<option_list1> ::=
PASSWORD = { 'password' | hashed_password HASHED } [ MUST_CHANGE ]
[ , <option_list2> [ ,... ] ]

<option_list2> ::=
SID = sid
| DEFAULT_DATABASE = database
| DEFAULT_LANGUAGE = language
| CHECK_EXPIRATION = { ON | OFF}
| CHECK_POLICY = { ON | OFF}
| CREDENTIAL = credential_name

<sources> ::=
WINDOWS [ WITH <windows_options> [ ,... ] ]
| CERTIFICATE certname
| ASYMMETRIC KEY asym_key_name

<windows_options> ::=
DEFAULT_DATABASE = database
| DEFAULT_LANGUAGE = language

or this MSDN page on ALL CREATE syntax maybe ? ;)

http://msdn.microsoft.com/en-us/library/cc879262.aspx




Merci

Cordialement - Best regards
Jean-Pierre GUTSATZ

CGF

DMC - Data Management Center
A tool to let you Migrate Import Export Transfer your Data
www.dmc-fr.com
Certified by Microsoft : "Works with Vista" &
"Works with Windows Server 2008"

NewsArchive
01-08-2010, 03:01 AM
Edvard

Assuming you have SB Developer, you should have, or be able to get the runtime scripts
to help with this.

Then, here are a few hints for you.

You need a runtime variable for the command line params you want to pass to the SQL
Installer
Here I am using %MYSQLCMDLINE% and I build it up over several lines like this

!I have shown it setting the DB Instance to BBSOFT and the SA Password to
SAPASSWORDEdv
!Also I have several other options set the way I want them....

Set Variable %MYSQLCMDLINE% to "-q /norebootchk /qn reboot=ReallySuppress ADDLOCAL"
Set Variable %MYSQLCMDLINE% to "=ALL instancename=BBSOFT SECURITYMODE=SQL SAPWD"
[Append Value]
Set Variable %MYSQLCMDLINE% to "=SAPASSWORDEdv DISABLENETWORKPROTOCOLS=0
SCCCHECKLEVEL" [Append Value]
Set Variable %MYSQLCMDLINE% to "=IncompatibleComponents:1;MDAC25Version:0
SQLAUTOSTART=1" [Append Value]

!Next, you need to install the SQL installer somewhere, or you need to know where it
is.
Install File "[SB_RUNTIMES]\sql2005expr\SQLEXPR32.EXE" to "%SQL2005%\SQLEXPR32.EXE"
(Always Install) [Permanent]

! And lastly, have SB run the MS installer with your command line
Run Program %SQL2005%\SQLEXPR32.EXE %MYSQLCMDLINE% (Always Install) [Wait]


There is much more to it, such as managing pre-requisites. But this should get you on
the way.

John Griffiths


>How to create the MSSQL server 'BBSOFT' with SA login 'SAPASWORD'?
>
>Edvard Korsbæk

NewsArchive
01-09-2010, 03:10 AM
This seems to be a very good starting point - Thanks!

Edvard Korsbæk

NewsArchive
01-09-2010, 03:12 AM
> There is much more to it, such as managing pre-requisites. But this should
> get you on
> the way.

Yep, if its a virgin pc then what about windows updates that might be needed
or separate installations/updates needed that dont appear in windows update
like the Windows MSI installer 3.1.

Lots of bases to cover.

Richard Rose

NewsArchive
01-09-2010, 03:13 AM
I think that I do not explain clearly enough my problem.
Starting point:
Virgin PC, just with standard windows installation, could be XP, Vista,
Windows 7.
I come with my program.
My program should have a MSSQL database.
How to install that on this 'Virgin' PC?

Starting point - Set MSSQL 2005 EXPRESS up as 'Core Prerequisites' in a SB7
install
When SB7 finds, that there is no MSSQL 2005 Express installed, SB does it
job.
My concern is to do this
1: Silent
2: With a given name - Say 'MyProgrammeSQL'
3: With a given sa login.
If i just run the MSSQL install, i can set all theese values, but my
customers has no chance of understanding. It shoulds be done automatically,
and in the background without user interfernce.

Best Regards
Edvard Korsbæk

NewsArchive
01-09-2010, 03:14 AM
Edvard,

> My concern is to do this
> 1: Silent
> 2: With a given name - Say 'MyProgrammeSQL'
> 3: With a given sa login.

I am not a SQL expert. But try the following:

Right-click the following line in your main project:

#include script "rt_sql2005expr.sbi" [Custom Configuration]

and select "Details".

[SQL2005EXPR_INSTANCENAME] allows you to set the instance name (e.g.
MyProgrammeSQL)

To set the password, add SAPWD=TopSecret (or a runtime variable or compiler
variable as password) to the "Command Line" field in the Run Program
%SQL2005EXPR_REDIST%\SQLEXPR.EXE function (rt_sql2005expr.sbi include
script).

Does this help?

--
Friedrich Linder
Lindersoft
www.lindersoft.com
+1.954.252.3910

SetupBuilder is Windows 7 installation -- "point. click. ship"

-- Official Comodo Code Signing and SSL Certificate Partner

NewsArchive
01-19-2010, 02:45 AM
Basically I have used your suggestion in the SB7 script rt_2005expr.sbi
script.
I use:
Set Variable %INSTANCENAME% to "[SQL2005EXPR_INSTANCENAME]"
Set Variable %MYSQLCMDLINE% to "-q /norebootchk /qn reboot=ReallySuppress
ADDLOCAL=ALL"
Set Variable %MYSQLCMDLINE% to " instancename=%INSTANCENAME%
SECURITYMODE=SQL" [Append Value]
Set Variable %MYSQLCMDLINE% to " SAPWD=<My Stromg Password>
DISABLENETWORKPROTOCOLS=0" [Append Value]
Set Variable %MYSQLCMDLINE% to "
SCCCHECKLEVEL"=IncompatibleComponents:1;MDAC25Version:0" [Append Value]
Set Variable %MYSQLCMDLINE% to " SQLAUTOSTART=1" [Append Value]

But when i try to connect with the sa password, i get the attached error. I
belive the error is in SECURITIMODE=SQL, which shold be something giving
both possibilities instead (Windows/SQL Server Autofication), but I cannot
find the documentation for it

Edvard Korsbæk

NewsArchive
01-22-2010, 02:41 AM
Check your Password value.
If your strong password contains brackets ([]), percent signs (%) or pound
signs (#), you may be getting a truncated pwd.
I hit that issue once.

Easiest way to verify, is set your pwd to something simple, and see if you
are getting in.

Hope that helps.
-Glenn.