Skip to content

NHibernate how to connect to remote database server

June 12, 2012

I had problems last week on how to add a reference and connect properly to a remote web server that is a virtual server using NHibernate which kept giving very unuseful errors back like Session factory does not implement ISessionFactoryImplementor.

Well after a good long week break after Download Festival, I managed to solve his problem by adding a SQL script to manually add a database user with a password that complies with the credentials required for Microsoft Server 2003, I referred back to my blog post a few weeks ago by writing the script:

USE [database]

CREATE LOGIN DatabaseUser2 WITH PASSWORD = ’Database$ser2’; USE Database; GO CREATE USER DatabaseUser2 FOR LOGIN DatabaseUser2;

Then for once the error gave a more useful message saying that the user didn’t have SELECT Permissions.

ll you need to do here is write the following script: –

USE [database]
EXEC sp_addrolemember N’db_datareader’, N’Username’

Et Voila, it works and you can connect to the remote database server using NHibernate.

 

Advertisements

From → Uncategorized

Leave a Comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: