Table of Contents

Configuring MS SQL


Script to Create the Database



 CREATE DATABASE [wp_manager]
 GO
 USE [master]
 GO
 CREATE LOGIN [wpweb] WITH PASSWORD=N'Password-123', DEFAULT_DATABASE=[wp_manager], CHECK_EXPIRATION=OFF, CHECK_POLICY=ON
 GO
 USE [wp_manager]
 GO
 CREATE USER [wpweb] FOR LOGIN [wpweb]
 GO
 USE [wp_manager]
 GO
 EXEC sp_addrolemember N'db_owner', N'wpweb'
 GO
 ALTER DATABASE wp_manager SET READ_COMMITTED_SNAPSHOT ON
 GO

The Hibernate.cfg.xml File


The database configuration file is located in “C:\inetpub\wwwroot\XcaliburW\bin”. Open it with a text editor, and edit the following lines:

 <?xml version="1.0" encoding="utf-8"?>
 <hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
   <!-- an ISessionFactory instance -->
   <session-factory xmlns="urn:nhibernate-configuration-2.2">
 
     [...here...]
 
   </session-factory>
 </hibernate-configuration>

Set Up MS SQL


Edit the following lines:

    <property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>

For Microsoft SQL Server 2005:

    <property name="dialect">NHibernate.Dialect.MsSql2005Dialect</property>

For Microsoft SQL Server 2008:

    <property name="dialect">NHibernate.Dialect.MsSql2008Dialect</property>

For Microsoft SQL Server 2012:

    <property name="dialect">NHibernate.Dialect.MsSql2008Dialect</property>

Connection String


The setup will be different depending on the authentication mode used.

Connection in SQL Authentication Mode

Edit the following line:

    <property name="connection.connection_string">Data Source=127.0.0.1\SQLEXPRESS;Initial Catalog=wp_manager;User ID=wpweb;Pwd=password;Trusted_Connection=False;Network Library=DBMSSOCN;Persist Security Info=False;</property>

the value “password”refers to the password you chose when you created the wpweb account

Connection in Windows Authentication Mode

Replace the line:

    <property name="connection.connection_string">Data Source=127.0.0.1\SQLEXPRESS;Initial Catalog=wp_manager;User ID=wpweb;Pwd=password;Trusted_Connection=False;Network Library=DBMSSOCN;Persist Security Info=False;</property>

with:

  <property name="connection.connection_string">Data Source=127.0.0.1\SQLEXPRESS;Initial Catalog=wp_manager;Integrated Security=SSPI;</property>