AFAIK, there weren't any changes between RC and RTM, but the latest
bits are always good to have.

Here's what I'm using for one of our production systems.  I'm using
the builder...

Fluently
                    .Configure()
                    .Database(OracleDataClientConfiguration
                                  .Oracle10
                                  .UseReflectionOptimizer()
                                  .MaxFetchDepth(3)
                                  .AdoNetBatchSize(500)
                                  .DefaultSchema("production")
                                  .Cache(c => c
                                                  .UseQueryCache()

.ProviderClass<SysCacheProvider>()
                                  )
                                  .ConnectionString(cs => cs

.Server("database_server")

.Instance("instance.domain.net")

.Username("username")

.Password("password")
                                                              .Pooling(true)

.StatementCacheSize(100)

.OtherOptions("Min Pool Size=10;Incr Pool Size=5;Decr Pool Size=2;")
                                  )

                    // It does this automatically.. but I like to be explicit ;)

.ProxyFactoryFactory("NHibernate.ByteCode.Castle.ProxyFactoryFactory,
NHibernate.ByteCode.Castle")
                    // Testing/NHProf stuff
                    //.Raw("generate_statistics", "true")
                    //.ShowSql()
                    )
                    .Mappings(mappings => mappings

.FluentMappings.AddFromAssemblyOf<StudentMap>());

So, I ripped all of that out and tried using the connection string.
Thankfully, some PowerShell-fu from earlier today had a TNS-esque
connection string on my desktop.


Fluently
                    .Configure()
                    .Database(OracleDataClientConfiguration
                                  .Oracle10
                                  .ConnectionString(c => c.Is( "Data
Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=server)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=instance)));User
Id=user;Password=password;"))
                    // It does this automatically.. but I like to be explicit ;)

.ProxyFactoryFactory("NHibernate.ByteCode.Castle.ProxyFactoryFactory,
NHibernate.ByteCode.Castle")
                    //.Raw("generate_statistics", "true")
                    //.ShowSql()
                    )
                    .Mappings(mappings => mappings

.FluentMappings.AddFromAssemblyOf<StudentMap>());

Clicked to rerun the tests and everything green.  I reread through all
of the implementations of OracleDataClient and I can't see where it
might be going astray.  There shouldn't be a difference between that
TNS-body connection string and a standard TNS reference.  Like I said,
your conn string looks right.

Now, I'm assuming you have Oracle.DataAccess.dll referenced AND 'Copy
Local' set to True?

The next step would be if there's something in your conventions
(though I don't see any specified) that is breaking a constraint you
have in your Oracle environment.  If you could post up the full error,
that'd greatly help.  Hopefully it references the line number in FNH
that is hanging up for you.

--
David R. Longnecker
blog: http://blog.tiredstudent.com
twitter: dlongnecker

"Good design is a Renaissance attitude that combines technology,
cognitive science, human need, and beauty to produce something." -
Paola Antonelli



On Tue, Sep 1, 2009 at 8:43 PM, Chris<[email protected]> wrote:
>
> David,
>
> Thanks for your reply.
>
> I have tried using a connection string which in effect bypasses the
> TNS config files, but I get the same error. I do not believe there is
> a problem actually connecting to the database itself: that seems to
> work ok as I can see the session connected at the database.
>
> The error message I posted was the one from the Inner exception. The
> top level error message was a generic, cover everything sort of thing:
>      "An invalid or incomplete configuration was used while creating
> a SessionFactory. Check PotentialReasons collection, and
> InnerException for more detail"
>
> I'm running 1.0RC. I will download the RTM version and see how I go
> with it.
>
> I had a look at the link you supplied, but I must admit I'm on a
> pretty steep learning curve with this, so at the moment, I'm not up to
> speed on all the configuration and setup for NHibernate.
>
>
> Chris.
>
> On Sep 2, 12:06 am, "David R. Longnecker" <[email protected]>
> wrote:
>> Chris-
>>
>> That connection string should work. I've honestly never tried
>> OracleClient with FNH--preferring, like you, the Oracle ODP.  I'm
>> assuming your using a tnsnames.ora reference since you're not using
>> the ConnectionStringBuilder built into OracleDataClientConfiguration.
>>
>> A few questions:
>>
>> - Have you tried building a TNS-less connection string using the
>> ConnectionStringBuilder?  Same thing?
>>
>> - Did the exception you receive return any further details in the
>> inner exception?
>>
>> - Are you running 1.0 RTM?
>>
>> I also came across this from Fabio.  I haven't ran into the specified
>> situation, but perhaps our Oracle environment is setup with different
>> parameters (I'm happily NOT the Oracle DBA. :))
>>
>> http://groups.google.com/group/nhusers/browse_thread/thread/8acd81dab...
>>
>> -dl
>>
>> --
>> David R. Longnecker
>> blog:http://blog.tiredstudent.com
>> twitter: dlongnecker
>>
>> "Good design is a Renaissance attitude that combines technology,
>> cognitive science, human need, and beauty to produce something." -
>> Paola Antonelli
>>
>> On Tue, Sep 1, 2009 at 12:12 AM, Chris<[email protected]> wrote:
>>
>> > I am trying to evaluate Fluent NHibernate for a new development
>> > project. I am attempting to use the 'Getting Started' project from the
>> > Fluent NHibernate Wiki, adapted for use with an Oracle database. I
>> > want to be able to use the Oracle Data Provider rather than the
>> > Microsoft version because of extra features in the Oracle version and
>> > the termination of support for the Microsoft offering. I can connect
>> > to the database but I get the following error after the
>> > Fluently.Configure() ....  function throws an exception:
>>
>> > Unable to cast object of type
>> > 'Oracle.DataAccess.Client.OracleConnection' to type
>> > 'System.Data.Common.DbConnection'
>>
>> > The code I am using is just the getting started code modified for use
>> > with Oracle.:
>>
>> > private static ISessionFactory CreateSessionFactory()
>> >        {
>> >            //return Fluently.Configure()
>> >            //    .Database(SQLiteConfiguration.Standard
>> >            //        .UsingFile(DbFile))
>> >            //    .Mappings(m =>
>> >            //        m.FluentMappings.AddFromAssemblyOf<Program>())
>> >            //    .ExposeConfiguration(BuildSchema)
>> >            //    .BuildSessionFactory();
>>
>> >            var cfg = OracleDataClientConfiguration.Oracle10
>> >                .ConnectionString( c => c
>> >                    .Is( "DATA SOURCE=DEVDB;" +
>> >                         "PERSIST SECURITY INFO=True;" +
>> >                         "USER ID=TRY_FLUENT;" +
>> >                         "PASSWORD=TEST" ) );
>>
>> >            return Fluently.Configure()
>> >                    .Database( cfg )
>> >                    .Mappings( m => m
>> >                        .FluentMappings.AddFromAssemblyOf<Program>() )
>> >                    .BuildSessionFactory();
>> >        }
>>
>> > I know it does work with the Microsoft data access as a schema was
>> > built and tables were populated with data when I ran the program.
>>
>> > Can anyone please help with a solution as I have no idea how to solve
>> > this problem.
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to