如何从我的ASP中访问EC2服务器上的SQL Server 2012。在同一个EC2服务器上发布的网站?

时间:2022-01-24 03:32:54

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

我的站点无法从EC2建立到SQL Server 2012的连接。我的连接字符串如下:

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

如您所见,我正在使用Windows身份验证;我采用的这种方法有什么问题吗?我是Ec2的新手。

Please help

请帮助

The New Connection string i am using is

我正在使用的新连接字符串是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

更多信息:我刚刚在我的Ec2机器上恢复了一个新的数据库。我的sql server实例只使用Windows身份验证,我将其更改为混合模式。我创建了一个新的登录,并将它设置为已恢复数据库的Db所有者

Properties of the Login User

登录用户的属性。

如何从我的ASP中访问EC2服务器上的SQL Server 2012。在同一个EC2服务器上发布的网站?

如何从我的ASP中访问EC2服务器上的SQL Server 2012。在同一个EC2服务器上发布的网站?

2 个解决方案

#1


2  

You should authenticate using user name and password, not integrated security. Your connection string should be like this:

您应该使用用户名和密码进行身份验证,而不是集成安全性。您的连接字符串应该如下所示:

Data Source=AMAZONA-2SSRDM3;Initial Catalog=MyDatabase;User Name=TheUserNameAmazonGaveYou;Password=MyPassword

#2


1  

connectionString="Data Source=localhost;Initial Catalog=MyDb;User ID=something;Password=something"

Just Had to make this Connection String Data Source as localhost it worked fine then

只需将此连接字符串数据源作为localhost进行处理即可。

#1


2  

You should authenticate using user name and password, not integrated security. Your connection string should be like this:

您应该使用用户名和密码进行身份验证,而不是集成安全性。您的连接字符串应该如下所示:

Data Source=AMAZONA-2SSRDM3;Initial Catalog=MyDatabase;User Name=TheUserNameAmazonGaveYou;Password=MyPassword

#2


1  

connectionString="Data Source=localhost;Initial Catalog=MyDb;User ID=something;Password=something"

Just Had to make this Connection String Data Source as localhost it worked fine then

只需将此连接字符串数据源作为localhost进行处理即可。