美好的一天,
我正在开发一个使用NHibernate + ODP.NET托管驱动程序的c#应用程序,应用程序在连接期间抛出异常:
[06.12.2013 12:29:33:324] NHibernate.Exceptions.GenericADOException : could not execute query
at NHibernate.Loader.Loader.ListIgnoreQueryCache(ISessionImplementor session, QueryParameters queryParameters)
at NHibernate.Loader.Criteria.CriteriaLoader.List(ISessionImplementor session)
at NHibernate.Impl.SessionImpl.List(CriteriaImpl criteria, IList results)
at NHibernate.Impl.CriteriaImpl.List(IList results)
at NHibernate.Impl.CriteriaImpl.List[T]()
...
[Inner Exception] System.ArgumentNullException : Parameter '' cannot be null.
Parameter name: serializationStream
at OracleInternal.ConnectionPool.PoolManager`3.CreateNewPR(Int32 reqCount, Boolean bForPoolPopulation, ConnectionString csWithDiffOrNewPwd, String instanceName)
at OracleInternal.ConnectionPool.PoolManager`3.Get(ConnectionString csWithDiffOrNewPwd, Boolean bGetForApp, String affinityInstanceName, Boolean bForceMatch)
at OracleInternal.ConnectionPool.OraclePoolManager.Get(ConnectionString csWithNewPassword, Boolean bGetForApp, String affinityInstanceName, Boolean bForceMatch)
at OracleInternal.ConnectionPool.OracleConnectionDispenser`3.Get(ConnectionString cs, PM conPM, ConnectionString pmCS, SecureString securedPassword, SecureString securedProxyPassword)
at Oracle.ManagedDataAccess.Client.OracleConnection.Open()
at NHibernate.Connection.DriverConnectionProvider.GetConnection()
at NHibernate.AdoNet.ConnectionManager.GetConnection()
at NHibernate.AdoNet.AbstractBatcher.Prepare(IDbCommand cmd)
at NHibernate.AdoNet.AbstractBatcher.ExecuteReader(IDbCommand cmd)
at NHibernate.Loader.Loader.GetResultSet(IDbCommand st, Boolean autoDiscoverTypes, Boolean callable, RowSelection selection, ISessionImplementor session)
at NHibernate.Loader.Loader.DoQuery(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies)
at NHibernate.Loader.Loader.DoQueryAndInitializeNonLazyCollections(ISessionImplementor session, QueryParameters queryParameters, Boolean returnProxies)
at NHibernate.Loader.Loader.DoList(ISessionImplementor session, QueryParameters queryParameters)
软件版本:
Oracle Database 11g企业版11.2.0.1.0版 - 64位生产
ODP.NET托管驱动程序版本121.1.1
使用其他oracle数据库:“Oracle Database 11g版本11.2.0.3.0 - 64位生产”它运行正常!
由于Oracle ODP.NET不受管理,它也运行良好! 使用Oracle Client(System.Data.OracleClient)也工作正常!
可能有人知道如何解决这个问题?谢谢!
答案 0 :(得分:3)
问题在于非标准数据库编码。 要解决此问题,您应该在数据库中使用标准编码(将数据库中的非标准编码转换为标准(UTF8))。