My site is not able to establish a connection to the SQL Server 2012 from EC2. My connection string is as follows:

Data Source=AMAZONA-2SSRDM3;Initial Catalog=MyDatabase;Integrated Security=SSPI;

As you can see I am using Windows Authentication; is there something wrong with this approach I am taking? I am new to Ec2

Please help

The New Connection string i am using is

 connectionString="Data Source=http://ec2-46-137-228-121.ap-southeast-1.compute.amazonaws.com/;Initial Catalog=MyDb;User ID=something;Password=something"

More Info : I just restored a new database on to my Ec2 Machine . My sql server instance was using only Windows Authentication which i changed to Mixed Mode. I created a new Login something and made it the Db Owner of the Restored Database as well


Change the data source parameter of the connection string to "localhost". When everything is running on the same machine there's no need to specify the actual host name. If you do need to specify the host name, when SQL Server is running on one server and the database is on another server for example, only specify the name of the server. In your case the connection string would reference the internal name of the server. In that case the connection string would look something like this.

connectionString="Data Source=ec2-46-137-228-121;Initial Catalog=MyDb;User ID=something;Password=something"

What ever the value in the data source you should be able to ping that name to make it work.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.