Re: Sql Server express 2005 deployment

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance




Hi,

Thank you for the detailed steps. From your answer I infer that the client
will need to manually do things which is not my intention. I remember doing
it in an easier way where I did not even need to do anything manually except
for installing the .msi package that had the database .mdf files along with
all the other components like .net 2 framework besides the actual
application. Also since the connection string was relative and I am using
"localhost" instead of my machinename, I had no problems installing and
running the application. I remember I had used the "Publish" wizard in VS.NET
2005.

However, since now I am having connection string problems when I am using
|DataDirectory| in the connection string to access .mdf file... I thought
that the solution you were giving would not require the client to do anything
once I attached .mdf files.

Is there any way besides the custom dLL solution where we can do it without
having to restore the database or do anything manually on the clients
computer?

Thanks



"Adrian Voicu" wrote:


Ok, that's good. You can now attach the database bak file to your
installation package. To make an installation package use the build in setup
& deployment install wizard that steps through all the settings. When
prompted to select what additional files to bundle up with the package,
select your SQL database backup file.

If size is an issue, you can also create a script file of your database. Use
SQL Server Management Studio to log in and right click on the database you
want to deploy. Select "Script Database As"->"Create To"->"File" and then
save the file. This file contains the code to recreate your database and
takes less space than the previous method. Add the file to your install
wizard by using the same steps as above.

Ok, now that you have an installation package you can now install your
program + database file to the host computer. Obviously the client will need
SQL Server 2005 installed on their end for this to work. With the database
bak or script file on the client computer you need to log into SQL Server
Management Studio on the client and either use the bak file to restore the
database from the backup or run the script file to produce a new database.
Both options are manual. When done, update you application's config file to
point to the new database server - you only need to change the "Data Source"
string in the connection string. That's it.

To make this automatic, I think you need to make a custom dll that launches
during installation and runs the script to create the database. This might
run into security problems though and you would also need to know the name of
the database server to install to and at the end change the application
config file.

Adrian.
--
[Please mark my answer if it was helpful to you]




"Punit Kaur" wrote:


Alright , I have connected to the actual database and I also made a backup.
The backup generates a .bak file. The mdf and ldf files were already created
when I created the database. Back up created only one .bak file. What do I do
now?

Also can you please tell me about any free installer package where I could
include these files. Or does one come with the VS 2005? If yes, where can I
find it. Any tutorial on how to proceed with this?

Thanks a lot.




"Adrian Voicu" wrote:


You don't have to create a local database in this case. In the connection
string you should only specify the name of the server where the database is
and not the path to the mdf. So connect to the actual database when you
develop your code. When you are done, make a backup of your sql database,
take the mdf + ldf files that you created with the backup and attach them to
your installation package.

Adrian.
----
[Please mark my answer if it was helpful to you]



"Punit Kaur" wrote:


Thanks for the suggestion. I created a local database using Add new item in
VS .NET and created a table. Now I am having trouble with the Connection
String.

When I used the following connection string which has the relative path to
the file:

public const string DB_CONN_STRING = "Data
Source=.\\SQLEXPRESS;AttachDbFilename=|DataDirectory|\\MonitorApp.mdf;Integrated Security=True;User Instance=True";

and try to insert into the table.. it does not do anything. It also does not
throw any exception when I execute the following stmt:

myCommand.ExecuteNonQuery();

which is enclosed within a try block

When I hard coded the connection string to point to the .mdf file by giving
the exact path..

Data
Source=.\SQLEXPRESS;AttachDbFilename=C:\current_working\RM\MonitorApp\MonitorApp\MonitorApp.mdf;Integrated Security=True;User Instance=True

I was able to succefully insert in to the table.

So It means there is something wrong in the relative path that uses
|DataDirectory|.

Can someone please point out if you see anything wrong....

The path of my VS.NET project's solution is C:\current_working\RM\MonitorApp\


I think I need to make sure that the relative path works fine... so as to be
able to correctly deploy sql server express.

Please suggest.

Thanks a lot.





C:\current_working\RM\MonitorApp\MonitorApp\


"Mr. Arnold" wrote:



Do I have to create a .mdf file or does SQL Sever 2005 automatically
create
one when I create a database. If yes where does it save the file. And then
what are the next steps after having an existing .mdf file...


The MDF and LDF files are going to be located at Program Files/Microsoft Sql
Server/MSSQL.1/MSSQL/DATA.

As far as the rest of the stuff about deployment of a .Net solution using MS
Sql Server Express, I ran across articles out there on Google showing the
how to.


.



Relevant Pages

  • Re: Cluster will not fail over.
    ... > As far as the TCP/IP issue goes, you had to rebuild the cluster and were ... > able to restore the master database. ... > a cluster installation you'll have to revisit. ... >> This worked bringing up the sql server in minimal mode. ...
    (microsoft.public.sqlserver.clustering)
  • Re: Reaching Access 2003 datas via SQL Server 2005 64 bits
    ... even with the procedure to create the invoice number I still ... One client enters in the store and asks for a product. ... formats of Access database files known as MDB and ACCDB and/or Access JET. ... (I have no problem to reach Sql Server 2005 tables from Microsoft ...
    (microsoft.public.access.adp.sqlserver)
  • Re: Access 2007->SQL Server2005 "connection was forcibly closed",G
    ... an Access database in former times this was a lot of work which took me ... closed connections - but all of these errors are in the version which used ... the SQL Server 2000 and everything worked ... client for programming easy, fast and good applications. ...
    (microsoft.public.sqlserver.connect)
  • Re: installing help for sql 2005
    ... you have database users that are not mapped correctly to logins. ... SQL Server Documentation Team ... installation help with snap shots because i installed the sql server ... remote connections are disabled by default. ...
    (microsoft.public.sqlserver.setup)
  • Re: SQL SERVER 2008 Express + SP1
    ... I installed the SQLXPR_X64, and before I attempted the SP1, SQLEXPRESS database was 64bit for the configuration, better yet the repair do work anymore because SP1 changed them somehow to 32 and the original install was 64 ... If the error happened during upgrade of the 'master' database, it will prevent the entire SQL Server instance from starting. ... And regarding your sql server installation, ...
    (microsoft.public.sqlserver.setup)