Reputation: 21
I cannot connect to SQL Server 2012 Express with NHibernate.
I get a
Keyword not supported: 'server'.
exception. I get the same exception when using Data Source in lieu of Server. I recently switched DB's from MySql to SQL Server Express. I had no issues performing all CRUD. operations in MySql.
My hibernate.cfg.xml
file is as follows:
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="dialect">NHibernate.Dialect.MsSql2012Dialect</property>
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
<property name="connection.connection_string">
"Server=MyServer;
Initial Catalog =MyDB;
User Id=MyUserID;
Password=MyPW;
Convert Zero Datetime=True"
</property>
<property name="show_sql">true</property>
</session-factory>
</hibernate-configuration>
Any help is most appreciated.
Upvotes: 2
Views: 2166
Reputation: 49291
Convert Zero Datetime
is MySQL connection string parameter only. If I add it to a SQL Server connection string I get "Keyword not supported: 'convert zero datetime'" and I'm not sure why your error message says that server is not supported but I think that removing Convert Zero Datetime
from the connection string will fix the problem.
The connection string parameters have aliases and I think you can mix and match but for the record my SQL Server connection strings are usually of the form
Server=myserver;Database=mydatabase;Uid=myuser;Pwd=mysecretpassword;
Upvotes: 0
Reputation: 10113
Maybe the Convert Zero Datetime
isn't supported? Otherwise, look into Hbm2DDLKeywords. You might have some classes with SQL Express reserved keywords.
Upvotes: 1