Firebird Embedded - 尝试打开文件时出错
我想使用 Firebird 2.5。在 .NET 4.0 项目中嵌入 NHibernate 3.2。火鸟提供商的代码工作非常出色。但是,当我尝试配置 NHibernate
Configuration = new Configuration().Configure();
UPD:
当我尝试构建会话工厂时,
Factory = Configuration.BuildSessionFactory();
会发生错误:
文件“C:\MYDB.txt”的“CreateFile(打开)”操作期间发生 I/O 错误。 FBD" 尝试打开文件时出错
在 app.config 中,一切看起来都很好
<configSections>
<section
name="hibernate-configuration"
type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate"
/>
</configSections>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="connection.driver_class">NHibernate.Driver.FirebirdClientDriver</property>
<property name="connection.connection_string">
Server=localhost;
ServerType=1;
Database=C:\MYDB.FBD;
User=SYSDBA;Password=masterkey
</property>
<property name="show_sql">true</property>
<property name="dialect">NHibernate.Dialect.FirebirdDialect</property>
<property name="command_timeout">60</property>
<property name="query.substitutions">true 1, false 0, yes 1, no 0</property>
</session-factory>
</hibernate-configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>
I want to use Firebird 2.5. Embedded with NHibernate 3.2 in .NET 4.0 project. The work is great with firebird provider's code. But when I try to configure NHibernate
Configuration = new Configuration().Configure();
UPD:
when I try to build session factory
Factory = Configuration.BuildSessionFactory();
the error occurs:
I/O error during "CreateFile (open)" operation for file "C:\MYDB.FBD"
Error while trying to open file
In the app.config everything looks fine
<configSections>
<section
name="hibernate-configuration"
type="NHibernate.Cfg.ConfigurationSectionHandler, NHibernate"
/>
</configSections>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="connection.driver_class">NHibernate.Driver.FirebirdClientDriver</property>
<property name="connection.connection_string">
Server=localhost;
ServerType=1;
Database=C:\MYDB.FBD;
User=SYSDBA;Password=masterkey
</property>
<property name="show_sql">true</property>
<property name="dialect">NHibernate.Dialect.FirebirdDialect</property>
<property name="command_timeout">60</property>
<property name="query.substitutions">true 1, false 0, yes 1, no 0</property>
</session-factory>
</hibernate-configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />
</startup>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我的猜测是,嵌入式火鸟独占使用该文件,当您打开另一个会话时,它会尝试连接到同一文件并抛出异常。
以下其中一项有帮助:
OpenSession(globalConnection);
my guess is that firebird embedded uses the file exclusivly and when you open another session it tries to connect to the same file and throws.
one of the following helps:
OpenSession(globalConnection);
因为我没有看到解决方案,所以我将添加我找到的内容 - 尽管这篇文章有多旧:
在使用数据库之前,您必须调用
FirebirdSql.Data.FirebirdClient.FbConnection.CreateDatabase(ConnectionString);
。https://sourceforge.net/p/firebird/mailman/message/9316804/< /a>
问候
朱伊·朱卡
because I didn't see a solution I'll add what I've found - despit how old this post is:
You have to call
FirebirdSql.Data.FirebirdClient.FbConnection.CreateDatabase(ConnectionString);
before using the database.https://sourceforge.net/p/firebird/mailman/message/9316804/
Greetings
Juy Juka