使用NHibernate连接到Sybase IQ [英] connect to Sybase IQ with NHibernate
问题描述
我想通过Fluent NHibernate连接到一个服务器上的Sybase IQ数据库:我使用的是NHibernate 3.3.1.4版本的C#
我是使用这里的代码:
http://pwigle.wordpress.com/2008/11/21/nhibernate-session-handling-in-aspnet-the-easy-way/
我试图采用这个构造器:
private SessionManager()
{
sessionFactory = Fluently.Configure()
.Database(SQLAnywhereConfiguration.SQLAnywhere11.ConnectionString(server = SERVER_NAME:PORT; user = USER_NAME; password = PASSWORD; database = DATABASE))
.Mappings ()= b.ExposeConfiguration(x => x.SetProperty(current_session_context_class,managed_web))
.BuildConfiguration()
.BuildSessionFactory();
$ b我没有连接到我的数据库;是否使用正确的连接字符串,或者是SQLAnywhereConfiguration类错误? 您可以看到> //www.connectionstrings.com/sybase-advantage/rel =nofollow> http://www.connectionstrings.com/sybase-advantage/
或 http://www.connectionstrings.com/sybase-adaptive/
检查您的连接字符串格式。
I want to connect to a Sybase IQ database, which is lying on a server via Fluent NHibernate: I use C# with the NHibernate version 3.3.1.4
I am using the code from here:
http://pwigle.wordpress.com/2008/11/21/nhibernate-session-handling-in-aspnet-the-easy-way/
I have tried to adopt the construktor to this:
private SessionManager()
{
sessionFactory = Fluently.Configure()
.Database(SQLAnywhereConfiguration.SQLAnywhere11.ConnectionString("server=SERVER_NAME:PORT; user=USER_NAME; password=PASSWORD; database=DATABASE"))
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<SessionManager>())
.ExposeConfiguration(x => x.SetProperty("current_session_context_class", "managed_web"))
.BuildConfiguration()
.BuildSessionFactory();
}
I get no connection to my database; does I use the right connection string, or is the SQLAnywhereConfiguration class wrong?
解决方案 You can see http://www.connectionstrings.com/sybase-advantage/
or http://www.connectionstrings.com/sybase-adaptive/
to check your connection string format.
这篇关于使用NHibernate连接到Sybase IQ的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!