Hello,
I have some curios connection problems to oracle or lets say with the Oracle Connection Driver. I use the following code to configure nhibernate:
Code:
public void Configuration()
{
_cfg = new Configuration();
_cfg.SetProperty("hibernate.connection.provider", "NHibernate.Connection.DriverConnectionProvider" );
_cfg.SetProperty("hibernate.connection.driver_class", "NHibernate.Driver.OracleClientDriver" );
_cfg.SetProperty("hibernate.dialect", "NHibernate.Dialect.OracleDialect" );
_cfg.SetProperty("hibernate.show_sql", "true");
_cfg.SetProperty("hibernate.query.substitutions", "true=1, false=0");
_cfg.SetProperty("hibernate.cache.use_query_cache", "true");
string oradb = "Data Source=(DESCRIPTION=" // C#
+ "(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=***)(PORT=****)))"
+ "(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=****)));"
+ "User Id=***;Password=****;";
_cfg.SetProperty("hibernate.connection.connection_string", oradb );
_cfg.AddAssembly(System.Reflection.Assembly.GetCallingAssembly());
}
So the obvious thing is if i create a session with the following code:
Code:
public void Open()
{
try
{
ISessionFactory factory = null;
factory = _cfg.BuildSessionFactory();
session = factory.OpenSession();
bool connected = session.IsConnected;
bool open = session.IsOpen;
Console.WriteLine("Connected: "+connected.ToString()+" Open: "+open.ToString());
ListUser();
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
}
}
the session is always connected and open BUT Oracle DB is not running and so not available. The session.Connection Object throws an NHibernate.ADOException but which is not thrown in my program. I cant give a stack trace cause the exception is thrown internally. I have switched on the log4net DEBUG output. But there is also not much information which gives me a hint. Here it is:
Quote:
2006-11-03 13:26:00,658 [3772] INFO NHibernate.Cfg.Configuration [(null)] <(null)> - processing one-to-many association mappings
2006-11-03 13:26:00,673 [3772] INFO NHibernate.Cfg.Configuration [(null)] <(null)> - processing one-to-one association property references
2006-11-03 13:26:00,673 [3772] INFO NHibernate.Cfg.Configuration [(null)] <(null)> - processing foreign key constraints
'Nhibernatetest1.exe': 'c:\windows\assembly\gac\system.data.oracleclient\1.0.5000.0__b77a5c561934e089\system.data.oracleclient.dll' geladen, keine Symbole geladen.
2006-11-03 13:26:00,720 [3772] INFO NHibernate.Dialect.Dialect [(null)] <(null)> - Using dialect: NHibernate.Dialect.OracleDialect
2006-11-03 13:26:00,736 [3772] INFO NHibernate.Connection.ConnectionProviderFactory [(null)] <(null)> - Intitializing connection provider: NHibernate.Connection.DriverConnectionProvider
2006-11-03 13:26:00,736 [3772] INFO NHibernate.Connection.ConnectionProvider [(null)] <(null)> - Configuring ConnectionProvider
2006-11-03 13:26:00,752 [3772] INFO NHibernate.Cfg.SettingsFactory [(null)] <(null)> - Optimize cache for minimal puts: False
2006-11-03 13:26:00,752 [3772] INFO NHibernate.Cfg.SettingsFactory [(null)] <(null)> - echoing all SQL to stdout
2006-11-03 13:26:00,752 [3772] INFO NHibernate.Cfg.SettingsFactory [(null)] <(null)> - Query language substitutions: {true=1, false=0}
2006-11-03 13:26:00,752 [3772] INFO NHibernate.Cfg.SettingsFactory [(null)] <(null)> - cache provider: NHibernate.Cache.HashtableCacheProvider
2006-11-03 13:26:00,752 [3772] INFO NHibernate.Cfg.SettingsFactory [(null)] <(null)> - query cache factory: NHibernate.Cache.StandardQueryCacheFactory
2006-11-03 13:26:00,923 [3772] INFO NHibernate.Impl.SessionFactoryImpl [(null)] <(null)> - building session factory
2006-11-03 13:26:00,923 [3772] DEBUG NHibernate.Impl.SessionFactoryImpl [(null)] <(null)> - instantiating session factory with properties: {hibernate.query.substitutions=true=1, false=0, hibernate.use_reflection_optimizer=true, hibernate.connection.connection_string=Data Source=(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=****)(PORT=****)))(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=****)));User Id=****;Password=****;, hibernate.connection.driver_class=NHibernate.Driver.OracleClientDriver, hibernate.connection.provider=NHibernate.Connection.DriverConnectionProvider, hibernate.dialect=NHibernate.Dialect.OracleDialect, hibernate.show_sql=true, hibernate.cache.use_query_cache=true}
2006-11-03 13:26:00,923 [3772] DEBUG NHibernate.Impl.SessionFactoryObjectFactory [(null)] <(null)> - initializing class SessionFactoryObjectFactory
2006-11-03 13:26:01,111 [3772] DEBUG NHibernate.Impl.SessionFactoryObjectFactory [(null)] <(null)> - registered: 5b51261609244e1392ba83cf75dc58ee(unnamed)
2006-11-03 13:26:01,111 [3772] INFO NHibernate.Impl.SessionFactoryObjectFactory [(null)] <(null)> - no name configured
2006-11-03 13:26:01,111 [3772] DEBUG NHibernate.Impl.SessionFactoryImpl [(null)] <(null)> - Instantiated session factory
2006-11-03 13:26:01,111 [3772] INFO NHibernate.Cache.UpdateTimestampsCache [(null)] <(null)> - starting update timestamps cache at region: UpdateTimestampsCache
2006-11-03 13:26:01,127 [3772] INFO NHibernate.Cache.StandardQueryCache [(null)] <(null)> - starting query cache at region: NHibernate.Cache.StandardQueryCache
2006-11-03 13:26:01,127 [3772] DEBUG NHibernate.Impl.SessionImpl [(null)] <(null)> - opened session
2006-11-03 13:26:05,142 [3772] DEBUG NHibernate.Connection.DriverConnectionProvider [(null)] <(null)> - Obtaining IDbConnection from Driver
2006-11-03 13:26:05,173 [3772] DEBUG NHibernate.Connection.DriverConnectionProvider [(null)] <(null)> - Obtaining IDbConnection from Driver
2006-11-03 13:26:05,173 [3772] DEBUG NHibernate.Connection.DriverConnectionProvider [(null)] <(null)> - Obtaining IDbConnection from Driver
2006-11-03 13:26:05,173 [3772] DEBUG NHibernate.Connection.DriverConnectionProvider [(null)] <(null)> - Obtaining IDbConnection from Driver
Connected: True Open: True
The problem appears in both version available (1.0 and 1.2).
So what is going wrong? Whats happening? Maybe someone has some information on such an issue and give me some clearness.
Thanks in advance!
Cheers
Andre