I have a project (say project1) which runs with the following SQL Azure connection string:
Server=tcp:....database.windows.net,1433;Database=project1;User ID=...
The database project1 exists and everything on project1 runs fine.
Then I was working on a second project (project2), and uploaded it as a second Cloud Service in Azure. I intended to store its data in the database project1 under a different schema (since there is a plan to merge the two projects), but accidentally I deployed the project with the following connection string:
Server=tcp:....database.windows.net,1433;Database=project2;User ID=...
Everything on project2 was working fine, but then I noticed that project2's tables in the database project1 were empty, although I have entered data in the cloud service. Then I noticed that the connection string pointed to a database project2.
To make it clear, there is no SQL database with the name project2. I checked in SQL Management Studio, as well as in the Silverlight SQL Azure database client.
I cannot explain this. Somehow Windows Azure or SQL Azure must have implicitly created a database project2, since I was able to work on the Cloud Service. There must be some 'hidden place', where project2 had stored its data.
Is this a bug, or am I missing something?
If you try to connect to a database that does not exist, you will automatically be connected to the master database, at least that was the case last time I tried. However master is read-only in the cloud, so I would expect most apps to fail when connecting to master. SQL Database will not create a database automatically for you, so that can't be it either. Could it be that you are trapping/silencing errors in your code and as a result you could not tell you were really connected to master?
Related
I have a backup file that came from Server A and I copied that .bak files into my local and setup that DB into my Sql Server Management Studio. Now After setting it up I deployed it in Azure Sql Database. But now there were change in the Data in Server A because it's still being used, so I need to get all those changes to the Azure SQL Database that I just deployed. How am I going to do that?
Note: I'm using Azure for my server and I have a local copy of Server A database. So basically in terms of data and structure my local and the previous Server A db is the same. But after a few days Server A data is now updated and my local DB is still the same as when I just backup the db in Server A.
How can I update the DB in Azure to take all the changes in Server A and deploy it in Azure?
You've got a few choices. It's just about migrating data. It's also a question of which data you're going to migrate. Let's say it's a neat, complete replacement. Then, I'd suggest looking at the bacpac mechanism. That's a way to export a database, it's structure and data, then import it into a new location. This is one mechanism of moving to Azure.
If you can't simply replace everything, you need to look at other options. First, there's SSIS. You can build a pipeline to move the data you need. There's also export and import through sqlcmd, which can connect to Azure SQL Database. You can also look to a third party tool like Redgate SQL Data Compare as a way to pick and choose the data that gets moved. There are a whole bunch of other possible Extract/Transform/Load (ETL) tools out there that can help.
Do you want to sync schema changes as well as Data change or just Data? If it is just Data then the best service to be used would be Azure Data Migration Service, where this service can help you copy the delta with respect to Data to Azure incrementally, both is online and offline manner and you can also decide on the schedule.
I am trying to create a free SQL Database in Azure under my DreamSpark subscription but I repeatedly receive the following error:
When you start an SQL Database creation, Azure lets you choose or create an SQL Server:
Since I don't currently have an Azure SQL Server I have to create one. I figured my error could be isolated to the server creation and effectively, while trying to create only the server, the error still rises.
I think that, even if Dreamspark subscription allows for a free small SQL Database, it does not allow for a free SQL Server. But this does not make any sense because I think there is no way to have an SQL Database without an SQL Server... So my questions:
Could you please confirm or refute my suspicion about Azure not permitting a free SQL Server in DreamSpark subscription?
In case it is not allowed, is there a way to create an SQL database without an SQL Server in Azure?
In case it is indeed allowed, why do I have this error then?
Thanks in advance.
I ended up circumventing this problem by using visual studio 2017 to create DB and DB Server for me. So we can be sure that DreamSpark subscription allows for a small DB AND a DB Server creation, which makes sense.
Still, don't know why I was getting that weird error though.
While creating the db, visual studio changed the name I provided by concatenating "dbserver" and "_db" to the server and db respectively. Perhaps, there was a naming issue that VS solved automatically, and that Azure is not reporting correctly.
I'm having what I hope is a simple problem.
I've published an API to an Azure Web App, which should fetch data from an Azure SQL database, but I'm getting a 500 error, which of course isn't helpful. Checking the logs in Azure doesn't give anything more useful to me.
I've added the connection string to the connection strings in the Web App. I have also created a method which returns the connection string from the repository class that's using it, so I know it's definitely seeing the correct connection string; so this means it's an issue connecting to the database with that connection string.
I have ensured that 'Allow access to Azure Services' is switched on, and when I use the query editor I can successfully pull data from the database.
I've also connected to the database using SQL management studio so I know the database can be reached.
What am I doing wrong?
As usual it turns out to be my stupidity, but I'll answer here in case it helps someone else...
I just updated my local app to use the Azure db connection string so I could get a more detailed error and it said the keyword was not supported 'initial catalog'.
This is when I realised that I developed this locally using Postgresql but couldn't justify the costs of that on Azure so switched to Sql Server but didn't change my connections to SqlConnection types!
I am sort of new to MVC, as it has been a few years since I used it.
I created a new site with individual passwords option selected. The wizard created a local database for me, and uses code first to create the database and table for identity management.
I tried changing the connection string to be the same as my entityframework connection string, and that did nothing, even after I ran the app. In fact, it seemed to have no effect, and somehow it still had access to the local db version.
How do I point the existing code first tables to build a new set of tables on my existing azure database, and then use those tables going forward?
My website is a .net 4.5 mvc site built with VS 2012. I have a SQL Server Compact DB in my app_data folder. All works great on my localhost. I deploy to Azure website and get this error?
Unable to find the requested .Net Framework Data Provider. It may not be installed.
I've googled it and get lots of possible answers, but none specific to Azure and SQL server compact. So my question is simple. Does a windows Azure Website which is deployed to an Azure shared hosting server support SQL Server Compact? If so, what do I need to do to eliminate the aforementioned error and make it work?
It certainly is possible to use SQL Server Compact on Windows Azure. However, you need to ask yourself:
Will I change anything in database?
This includes adding, updating and removing data. If you do, you should not use SQL Server Compact on Windows Azure. Because, if you use SQL Server Compact on Windows Azure and change anything in the database, you'll run into two problems:
Data is not replicated.
You risk losing data.
Data is not replicated
If you change anything in the database, the changes stays local. This means that if you have multiple instances running your web application, then each web application will have their own database, and if you change something in one of them, the change won't be replicated to other instances, which will result in unpredictable behaviour in your application.
You risk losing data
If you change anything in the database after deployment, you risk losing data, because Windows Azure might decide to redeploy your instance to another virtual or physical machine. When this happens, the new instance will be setup with the deployment package you originally uploaded to Windows Azure, and this package does not contain any changes you make to the database. And this redeployment can happen at any time for several reasons.
Conclusion
So, SQL Compact on Azure? Sure, no problem if your data is read-only. However, note that you won't get the performance you would with SQL Azure. But if your need changes down the road, you can always migrate your application from SQL Server Compact to SQL Azure.
If you want to use SQL Server Compact with Windows Azure, you can use the "private deployment" method, as explained on "ErikEJ"'s blog.
Edit: Microsoft has announced that they now provide 1 free 20 MB SQL Azure Database for every Azure subscription. This means you can create a subscription and create a free website, with a free SQL Azure Database. (As long as it's less than 20 MB) You can also have multiple Web Sites associated with the same SQL Azure Database for free. So, if you're considering SQL Server Compact on Windows Azure because your database will be very small and you don't want to pay for a 100 MB database, you can consider this option. In most cases, it will be a better solution. Your website will perform better, your database performance will be better and you have the ability to change your data and it will be replicated.
It's possible for SQL Server Compact 4.0 on Azure!!
I write an an article for it
And this is the English version I found
By few step:
Below is the solution after my research:
Step by Step like this:
Install two nuget: EntityFrame.SqlServerCompact & Microsoft SQL Server Compact Edition
put your SQL database file(.sdf/.mdf) in APP_Data folder
(Put the connection string like this in order to use it:
<add name ="DefaultConnection" connectionString ="Data Source=|DataDirectory|CompactDB.sdf" providerName ="System.Data.SqlServerCe.4.0" />)
Publish full project include above SQL database file to AzureWebsites.
you can find it can work well and is totally free.
Second Wenchao Zeng of Microsoft the Azure don't support Sql Compact.
I could use once but this is not recommended because the Windows Azure work with replication of the data (this is the cloud, remember?) and the Sql CE does not support this functionality. If you can to put a Sql CE in Azure sometimes will not get access or users see data outdated or broken because the async.
The best way is you to use the Azure Sql ou BLOB storage.