views:

247

answers:

2

Hi there!

First off I´m new here, so, I'd say HELLO EVERYONE and thanks for years of helping.

I have the following problem:

I need create a installation of a C# app that uses SQL Server 2008. I am using InnoSetup Installer because I thought it could be the best choice, but I have no clue how to install SQL Server 2008, and several databases (.mdf, .ldf or .bak) which should be installed on the local machine.

So my task is, having the C# app and the SQL Server 2008 engine + tools in my computer, to distribute it to my clients in a unattended manner (because the fact that they're using a database should be transparent to the end user).

I´m sure it is possible, actually I install the C# app, and the SQL Server engine (downloaded SQLEXP32_x86_ENY.exe), but what about the databases? That is my problem, as well as a correct configuration of SQL SERVER: because as you probably know, it is not so trivial make it work properly (Access control problems, Administrator Rights, and so on).

For example in order to install SQL Server I do it in console mode, as Microsoft blesses, doing:

SQLEXP32_x86_ENY.exe /ACTION=install /FEATURES=SQL,Tools
/INSTANCENAME=SQLExpress
/SECURITYMODE=SQL /SAPWD=****
/SQLSYSADMINACCOUNTS="Builtin\Administrators"
\ENABLERANU /SQLSVCACCOUNT=""
/SQLSVCPASSWORD=""

What should I write in /SQLSVCACCOUNT /SQLSVCPASSWORD, for example?

What should I do to import my existing databases I provide? Until lately people used to use SQLDMO CMO object, but I read that that is not longer supported.

How do you do that? That's the question, at least dome tips could be useful.

My client needs a database locally, but at the beginning they need to have created some databases as well as some initial data in.

Thanks in advance!!!

+1  A: 

First off, you are aware that the file SQLEXP32_x86_ENY.exe you downloaded is the SQL Server Express edition - right? It's free, even for commercial purposes, but it does have a few limitations (only uses 1 CPU, max. DB size limited to 4 GB and a few more).

Second, for your SQLSVCACCOUNT - best practice for a production environment is to have a special system account for running SQL Server under - something like a "artificial" user called SQLServerUser or whatever you want to call it. This account has a password, and those are the two things you would have supply for SQLSVCACCOUNT and SQLSVCPASSWORD.

For a development environment, those settings are typically set to something like SYSTEM\NETWORK SERVICE or NT AUTHORITY\LOCAL SYSTEM something similar (for the account).

As for attaching existing databases to the new SQL Server instance - you have several options:

  • if you can do it interactively, download and install the SQL Server Management Studio Express edition and attach your databases in that tool

  • if you need to do it during install, you can e.g. use sqlcmd - the command line SQL tool - to execute a SQL statement like ATTACH DATABASE ...... directly from the command line. sqlcmd is installed with SQL Server (including Express editions)

  • if you need to have full control, you could use the SMO - SQL Server Management Objects - that get installed with SQL Server 2008 to automate your task (instead of the legacy SQL-DMO which is no longer supported)

marc_s
Should/Can the artificial SQLServerUser user and associated password be created automatically and transparently by the InnoSetup installation program?
ChrisW
Yes, it definitely could - there's plenty of API's to create a new user in Windows and setting properties for it
marc_s
A: 

Finally I will work with SQL SERVER COMPACT 3.5 ... It gieves me enough resources for my proposes, and is kinda easier to deploy. As well, I will be sure my users don´t user the database in bad manner... thanks!!!!! Anyway, I will continous trying to deploy correctly an SQL SERVER 2008, but Vista is a pain in the arse!hahaah

Thanks marc_s!!!!!!!!!!