-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: JetDriver and OpenSession(conn)
PostPosted: Mon Jun 05, 2006 6:14 am 
Newbie

Joined: Mon Jun 05, 2006 6:02 am
Posts: 1
Hibernate version: 1.0.2 + JetDriver

Please give me some help:

I need to open a different MS Access database file a runtime, but I'm not able to swich to the new database:

Can you give me an example?

Thank you
ms


I create a OleDbCoonection string:

OleDbConnection conn= new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=D:\\Documenti\\Sviluppo\\VB7PRG\\HCCProjects\\Pippo.mdb");

ISession session = SessionHelper.GetSession(conn);



this is the app.config:

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<configSections>
<section name="nhibernate" type="System.Configuration.NameValueSectionHandler, System, Version=1.0.5000.0,Culture=neutral, PublicKeyToken=b77a5c561934e089" />
</configSections>

<nhibernate>
<add
key="hibernate.show_sql"
value="true"
/>
<add
key="hibernate.connection.provider"
value="NHibernate.Connection.DriverConnectionProvider"
/>

<add
key="hibernate.dialect"
value="NHibernate.JetDriver.JetDialect, NHibernate.JetDriver"
/>
<add
key="hibernate.connection.driver_class"
value="NHibernate.JetDriver.JetDriver, NHibernate.JetDriver"
/>
<add
key="hibernate.connection.connection_string"
value="Provider=Microsoft.Jet.OLEDB.4.0;User ID=Admin;Data Source=D:\Documenti\Sviluppo\VB7PRG\HCCProjects\Hcc.mdb"
/>

</nhibernate>

</configuration>


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 06, 2006 7:50 am 
Beginner
Beginner

Joined: Tue May 30, 2006 10:55 am
Posts: 21
Well, my configuration file looks like this:
Code:
<!-- properties -->
      <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
      <property name="connection.driver_class">NHibernate.Driver.OleDbDriver</property>
      <property name="dialect">NHibernate.Dialect.MsSql2000Dialect</property>
      <property name="connection.connection_string">
         Provider=Microsoft.Jet.OLEDB.4.0;
         User ID=Admin;
         Data Source=PathToYourMDBFile;
         Mode=Share Deny None;
         Extended Properties=;
         Locale Identifier=1031;
         Jet OLEDB:Registry Path=;
         Jet OLEDB:Database Password=;
         Jet OLEDB:Engine Type=5;
         Jet OLEDB:Database Locking Mode=1;
         Jet OLEDB:Global Partial Bulk Ops=2;
         Jet OLEDB:Global Bulk Transactions=1;
         Jet OLEDB:New Database Password=secret;
         Jet OLEDB:Create System Database=False;
         Jet OLEDB:Encrypt Database=True;
         Jet OLEDB:Don't Copy Locale on Compact=False;
         Jet OLEDB:Compact Without Replica Repair=False;
         Jet OLEDB:SFP=False;
      </property>
      <property name="show_sql">true</property>
      <property name="use_outer_join">false</property>
      <property name="query.substitutions">true 1, false 0, yes 'Y', no 'N'</property>

Maybe you do not need all special parameters in the connection string, but in general it works in that way.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.