0
votes

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?

1

1 Answers

1
votes

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?