如何在C#中打开firebird数据库文件? [英] How to open firebird database files in C#?

查看:127
本文介绍了如何在C#中打开firebird数据库文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我们从客户端获取firebird数据库的.ydb文件。 Currenlty我们创建了一个带有一些额外安装/驱动程序的DSN,然后访问文件中的表和数据。



我们计划将此流程转移到azure云服务(而不是azure VM) )所以为了避免创建DSN等,我们需要从c#代码访问.ydb文件。



我无法使用firebird ado.net提供程序直接打开,抛出异常。



以下是在机器中创建DSN的步骤。它工作很长时间。



  1. Windows Server中的Firebird ODBC设置



    Driver-IscDbc,


    Database-E:\ Somefolder\FileName.ydb


    Client-C: \ProgramFiles \Firebird \Firebird2_5 \WOW64 \fbclient.dll


    数据库帐户 - SYSDBA


    密码 - masterkey


    角色 - SYSDBA


    CharSet - None



  2. 然后使用下面的C#代码使用DSN访问FileName.ydb。


    using(var connection = new OdbcConnection(" DSN = DSNName1"))


    {


    connection.Open();


    var schema = connection.GetSchema(" Tables");


    var tableNames = new List();


    }




现在修改上面的DSN创建过程,我在c#解决方案中添加了FirebirdSql.Data.FirebirdClient nuget包。

  字符串  connectionString   =    " User = SYSDBA;"     +    "密码= masterkey;"     +   
" Database = E:\\Somefolder \\Filename.ydb;" + " Dialect = 3;" + " Charset = NONE;" +
" Role = SYSDBA;" ;

FbConnection fbConn = FbConnection connectionString );
fbConn
打开 ();

VAR <跨度类=" PLN "风格=" 保证金:0像素;填充:0像素;边框:0像素;颜色:#303336">架构 = fbConn GetSchema " Tables" );


< p style ="padding-right:0px;字体大小:15像素;明确:两者;颜色:#242729; font-family:Arial,'Helvetica Neue',Helvetica,sans-serif; line-height:19.5px">
它在fbConn.Open()上抛出异常; - 无法完成对主机"localhost"的网络请求。



如何在不创建DSN的情况下直接在C#中打开.ydb文件?



谢谢



Bhanu。

解决方案

Firebird不是受支持的MS产品所以我们无法在这些论坛中帮助您。请在Firebird的支持论坛(http://firebirdsql.org/en/net-provider/)上发布您的问题。


We get .ydb files of firebird database from client. Currenlty we created a DSN with some additional installation/drivers and then access the tables and data inside the files.

We are planning to move this process to azure cloud service (not azure VM) so to avoid creating DSN etc. we need to access the .ydb files from c# code.

I could not open directly using firebird ado.net provider, throwing exceptions.

The below are the steps used to create DSN in the machine. It is working for long time.

  1. Firebird ODBC setup in Windows Server

    DSNName-DSNName1,

    Driver-IscDbc,

    Database-E:\Somefolder\FileName.ydb

    Client-C:\ProgramFiles\Firebird\Firebird2_5\WOW64\fbclient.dll

    Database Account- SYSDBA

    Password - masterkey

    Role - SYSDBA

    CharSet - None

  2. Then used the below C# code to access the FileName.ydb using the DSN.

    using (var connection = new OdbcConnection("DSN=DSNName1"))

    {

    connection.Open();

    var schema = connection.GetSchema("Tables");

    var tableNames = new List();

    }

Now to modify the above DSN creation process, I added FirebirdSql.Data.FirebirdClient nuget package in the c# solution.

string connectionString = "User=SYSDBA;" + "Password=masterkey;" +
"Database=E:\\Somefolder\\Filename.ydb;" + "Dialect=3;" + "Charset=NONE;" +
"Role=SYSDBA;";

FbConnection fbConn = new FbConnection(connectionString);
            fbConn.Open();

            var schema = fbConn.GetSchema("Tables");

It throws exception on fbConn.Open(); - Unable to complete network request to host "localhost".

How to open the .ydb files in C# directly without creating a DSN ?

Thanks

Bhanu.

解决方案

Firebird is not a supported MS product so we cannot help you in these forums. Please post your question in Firebird's support forums (http://firebirdsql.org/en/net-provider/).


这篇关于如何在C#中打开firebird数据库文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆