I am facing a little problem with my NHibernate configuration connection with SQL server database. My App structure is just for simple test. Here is my hibernate.xml.cfg:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration>
<session-factory xmlns="urn:nhibernate-configuration-2.2">
<property name="hibernate.connection.driver_class">net.sourceforge.jtds.jdbc.Driver</property>
<property name="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</property>
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
<property name="connection.url">jdbc:jtds:sqlserver://OUSSEMA;DatabaseName=DB_GestionCompte</property>
<property name="connection.username">sa</property>
<property name="connection.password">123</property>
<property name="show_sql">true</property>
</session-factory>
</hibernate-configuration>
I am getting this error on running the project :
System.TypeInitializationException: 'The type initializer for 'HibernateUtil' threw an exception.'
HibernateConfigException: An exception occurred parsing configuration :The 'name' attribute is invalid - The value 'connection.url' is invalid according to its datatype 'Union' - The value 'connection.url' is not valid according to any of the memberTypes of the union.
Above error is raised on below code line in DataService.cs:
ISessionFactory factory = HibernateUtil.GetSessionFactory();
I tried different ways of NHibernate configurations and none of them works. Meanwhile I am sure that the SQL authentication works and cords are correct.