I have an ASP MVC-application that uses a SQL server express for and Forms authentication. The server I'm using does not have enough memory to run SQL Server express stably and I was thinking about migrating to SQLite instead.
Is it possible to just migrate the existing aspnetdb-database from SQL Server to SQLite so that all my user accounts will be kept?
These shall help you perform such task:
SQLite Converter Tools
SQL Maestro (This one's not free though)
A good migrating tool project from Code Project
SO: convert sql-server *.mdf file into sqlite file
So, I guess that if such tools exist, it will then be possible to keep your data.
For security, perform a backup from your DB first!
Related
I've begin the development of my Umbraco Website. I've forgot to include a database on the setup so I think that all my stuff is in the cache. Am I right ?
However, I've tried to include a connection string, all is fine, Umbraco can connect to my database, but now Umbraco is looping on the Installation page and do nothing.
My database is empty and on any url Umbraco is trying to install.
I'm using Umbraco 7.6.3
How can i add my database so all the stuff I've made is not lost ?
Thanks !
Alex,
when you use the default settings during installation of Umbraco, then it wil use SQL CE.
This method will save all data not in SQL server but in a local sdf file which is located in the App_Data folder.
If you want to change this, then the best way will be to start over the entire installation incase you haven't add any elements to your existing version.
Then during installation you can choose to specify other options for the database, like adding the database to your Sql Server instance.
If you want to convert your existing SQL CE database to sql server, have a look here:
https://our.umbraco.org/forum/umbraco-7/using-umbraco-7/53818-Convert-Umbraco-SQL-CE-database-to-SQL-Express
Aimed to link my pages to an existing db from SQL Server Express. There are only one table is gonna select. Followed NerdDinner tutorial, using LINQ-to-SQL designer to do this.
However the result does not overcome what it suppose, my table Dinner can not be called directly, what would be the mistake I make?
The result return *.dbml and NerdDinner with *.edmx. What are their different?
You must set your connection string to store database in sql server express.Note that the *.edmx database type will store in local file system maybe at App-Data folder in your project as a database object. but another type, say, *.dbml is for using at DBMS system ,here SQL server Express. Also you can convert the *.edmx type to *.dbml type via SQL server tool.
Look at your web.config file at root of project.At the configurations, you will see that the connection string is setted to store at local file system of type .edmx. try to change it.
Built an app locally with an EF code-first database - not sure how to upload it to a shared hosting environment such as GoDaddy. It makes sense that something would be amiss because on the shared hosting your code can't just go create a database, but on the flip side I can't find anything to copy the CREATE sql and create it on the server like you would with MySQL
Feel a little silly because I've been using .NET for over a year now but at work the databases are already set up and we have full control over our environments.
If the database has no data that you need to preserve the easiest method is just to install the app on the new host and set the connection string to your new database on the host. On the first attempt to load a page accessing the database, the database will automatically be created (note that you need to load a page which hits the database - sometimes the home page is not sufficient).
This method is a lot more straightforward than generating SQL and then executing it on the production database.
If there is data that you need to preserve then the best method will be taking a backup and installing the backup on the host. In SSMS simply right-click the database in the left pane, then Tools > Backup... To restore on the server connect to the server in SSMS and right-click the 'Database' node in the left panel and select 'Restore Database...' I'm not sure if the host provides a direct connection from SSMS but they should at a minimum have a mechanism to restore a .bak file.
Going forward you should ensure that you can execute SQL on your database as a very convenient method for deploying EF Migrations is to generate the SQL update script on the development server and then deploy this by executing it in production.
Depending on your web host, you may be able to restore the database. If this is an option, simply back up your database on your local machine and restore it on the server via the management console.
You can back up your local database using SQL Server Management Console. This works well even for larger databases as you can directly restore all your data, your schema, etc.
I've had experience with three different hosts so far and all of them have this as an option. You'll usually find this under the Database tab for the web site. The rest from there is up to you because it's usually different across the various hosts.
was wondering if it's possible to point the visual web express to a specific folder when it builds the database using entity framework code first. this question stemmed from this one:
mvc connection string code first
anyway, i was able to successfully build the dbase using code first but sql server management studio is looking at a diff folder. is it possible to piont the web express to that folder when creating the database or is it better to just point the sql server management studio to where it's building it to? (does that make sense?) i tried fiddling with the ssms properties but it still won't look at that folder..
It whole depends on the connection string. If you are using default connection string for web application it always creates database in App_Data folder - it is specified by AttachDbFilename=|DataDirectory|DatabaseFileName.mdf. Using this is recommended way if you want your web app to create database because it should have necessary privileges by default.
If you want to place the database "elsewhere" you should not use attached db file and instead let SQL server create database in its default location by calling omitting AttachDbFilename part of the connection string. This can require additional security configuration to allow web application to create the database.
I am currently going through the MvcMusicSore tutorial (MVC 3). I have full sql server 2008 installed and created a local database by running the SqL scripts included in the MvcMusicStore-Assets data folder. However when trying to add the mdf to the AppFolder in Visual Studio 2010 I get the error Access Denied. I am completely stuck at this point and would appreciate any help to resolve this.
Most probably the mdf file is locked by some other process, not allowing the application to read it. If you mounted the database on SQL Server you need to use a connection string with the machine name instead of specifying the mdf file directly.
You can't copy or modify a live working database. And I don't see why you should.
You need connecting to it? Pick a way. LINQ to SQL, Entity Framework, NHibernate, ADO.NET...
If you really want to copy the database file for some reason, you must first stop the MSSQL Service (or detach the database), then do that.
Like others have said, you shouldn't need to add the actual .mdf into your project. If you have it running on your local SQL Server instance, you should be able to add it via Visual Studio's Server Explorer (plus that gets you your connection string).