我在SQLSERVER (2008 R2 EXPRESS)
管理员列表中。我在我的机器上担任管理员角色。我可以手动连接到SQLSERVER(通过Management Tools
)使用ServerName(在我的情况下它是S-PROG-T\SQLEXPRESS
)。在安装过程中,我决定只使用Windows Authentication
模式。我无法连接到SS。无法连接到SQLSERVER 2008 R2 EXPRESS
错误消息:Login failed for user S-PROG-T\admin. Cannot open database 'ProjectDB' requested by the login.
我用下面的配置NHibernate
:
<session-factory>
<property name="connection.provider">
NHibernate.Connection.DriverConnectionProvider
</property>
<property name="dialect">
NHibernate.Dialect.MsSql2008Dialect
</property>
<property name="connection.driver_class">
NHibernate.Driver.Sql2008ClientDriver
</property>
<property name="connection.connection_string">
Data Source=S-PROG-T\SQLEXPRESS;Initial Catalog=ProjectDB;Integrated Security=SSPI
</property>
<property name="show_sql">
true
</property>
<mapping resource="Project.Domain.Model.Entities.Mappings.Vehicle.hbm.xml" assembly="Project.Domain" />
</session-factory>
而且我试着使用.\SQLEXPRESS
数据源进行连接。入站规则不限制SSMS。
怎么了? 谢谢!
编辑:单元测试
一切(nhibernate
配置和架构出口试行)开始我的单元测试中(我不知道这是否事项)。
[TestFixture]
public class VehicleFixture
{
[Test]
public void TestSchemaExport()
{
new SchemaExport(new Configuration().Configure()).Execute(false, true, false);
}
}
编辑:日志信息
我发现了一个日志中的下一个信息(路径:%ProgramFiles%\Microsoft SQL Server\MSSQL10_50.SQLEXPRESS\MSSQL\Log\
):
Error: 18456; State: 38.
Login failed for user ‘S-PROG-T\Admin’.
Reason: Failed to open the explicitly specified database.
根据文章:http://sql-articles.com/articles/troubleshooting/troubleshooting-login-failed-error-18456/数据库不存在或登录无权访问数据库。
我完全困惑。我应该在我试图导出模式之前创建数据库(手动)(对不起,如果问题很傻)?
编辑:使用混合身份验证模式
我已经设置混合模式身份验证,并与serveradmin
& sysadmin
角色创建新的登录。但仍然错误消息是相同的,除了用户名。再次我可以用登录名和密码手动做同样的事情(连接并创建数据库)。
你使用什么编程语言? – ChrisBint 2011-12-16 13:42:25
为什么“综合安全”中有两个空格? – 2011-12-16 13:48:55