Skip to content

nHibernate not working in .NET Core when deployed to CentOS for certain database types #2102

@kutekrish

Description

@kutekrish

We are using NHibernate, Version=5.1.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4 in .NET Core application that connects to SQL Server / Postgre SQL. This works fine when deployed on Windows environment. However, when we deploy this on a CentOS Server, it gets stuck at the below line

2019-04-03 04:57:56,871 [DEBUG] - Session factory constructed with filter configurations : {}
2019-04-03 04:57:56,879 [DEBUG] - instantiating session factory with properties: {'connection.provider'='NHibernate.Connection.DriverConnectionProvider', 'connection.driver_class'='NHibernate.Driver.SqlClientDriver', 'connection.connection_string'='<connection string goes here>', 'dialect'='NHibernate.Dialect.MsSql2008Dialect', 'show_sql'='true', 'format_sql'='true', 'use_sql_comments'='true'}
2019-04-03 04:57:56,889 [DEBUG] - Obtaining DbConnection from Driver
2019-04-05 11:53:54,884 [DEBUG] - Session factory constructed with filter configurations : {}
2019-04-05 11:53:54,885 [DEBUG] - instantiating session factory with properties: {'connection.driver_class'='NHibernate.Driver.Sql2008ClientDriver', 'connection.connection_string'='<connection string goes here>', 'dialect'='NHibernate.Dialect.MsSql2008Dialect', 'show_sql'='true', 'format_sql'='true', 'use_sql_comments'='true'}
2019-04-05 11:53:54,887 [DEBUG] - Obtaining DbConnection from Driver

I first thought that the CentOS server might not have SQL Server drivers and hence I followed MS documentation to install it. Still it did not help. So I switched to Postgre SQL to check if that atleast works. But it gets stuck at the same place for Postgre SQL too

2019-04-04 12:27:54,880 [DEBUG] - Session factory constructed with filter configurations : {}
2019-04-04 12:27:54,881 [DEBUG] - instantiating session factory with properties: {'connection.provider'='NHibernate.Connection.DriverConnectionProvider', 'connection.driver_class'='NHibernate.Driver.NpgsqlDriver', 'connection.connection_string'='<connection string goes here>', 'dialect'='NHibernate.Dialect.PostgreSQLDialect', 'show_sql'='true', 'format_sql'='true', 'use_sql_comments'='true'}
2019-04-04 12:27:54,883 [DEBUG] - Obtaining DbConnection from Driver

Edit:
I've tried with SQLite and it works fine

2019-04-05 08:34:05,283 [DEBUG] - Session factory constructed with filter configurations : {}
2019-04-05 08:34:05,284 [DEBUG] - instantiating session factory with properties: {'connection.provider'='NHibernate.Connection.DriverConnectionProvider', 'connection.driver_class'='NHibernate.Driver.SQLite20Driver', 'connection.connection_string'='Data Source=dbname.db;Version=3;New=True', 'dialect'='NHibernate.Dialect.SQLiteDialect', 'show_sql'='true', 'format_sql'='true', 'use_sql_comments'='true'}
2019-04-05 08:34:05,286 [DEBUG] - Obtaining DbConnection from Driver
2019-04-05 08:34:05,431 [DEBUG] - Closing connection

I've tried with Oracle, and that too is working fine (except for a few columns which are of type boolean but that's a separate problem

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions