C#中的Firebird连接 [英] Firebird connection in C#

查看:242
本文介绍了C#中的Firebird连接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有连接问题.

在计算机上下载该数据库后,我可以毫无问题地连接到数据库:

I can connect without problems to my database, when this database is downloaded on my computer:

viewdataConnection.ConnectionString = "User ID=sysdba;Password=masterkey;Database=localhost:F:\\machine.FDB;DataSource=localhost;Charset=NONE;"

一切正常.

但是当我尝试连接到局域网中的此基础时,问题就开始了:

But problems starts when i try to connect to this base in lan network:

viewdataConnection.ConnectionString = "User ID=sysdba;Password=masterkey;Database=10.48.14.51:d:\\backup\\machine.fdb; DataSource=:d:\\backup\\machine.fdb;Charset=NONE;";

这也不起作用:

viewdataConnection.ConnectionString = "User ID=sysdba;Password=masterkey;Database=10.48.14.51:d:\\backup\\maszyna.fdb; DataSource=:10.48.14.51:d:\\backup\\maszyna.fdb;Charset=NONE;";

然后我在sql查询中收到有关无效令牌"second"的错误,但是当数据库位于localhost上时,此查询有效.因此,我的连接字符串中可能存在错误.

then i get error about invalid token "second" in my sql query, but this query works when database is on localhost.. so probably there's mistake in my connectionstring..

为什么?

推荐答案

因此,您的数据源部分应为datasource = 10.48.14.51,且没有任何额外的路径. 数据库部分应该是您到数据库的网络路径,例如"database = \ server \ path \ database.fdb"

So your datasource part should be datasource=10.48.14.51 without any extra path. The database part should be your network path to the database like "database=\server\path\database.fdb"

将所有内容放在一起,我将以这种方式尝试:

Putting all together I will try in this way:

viewdataConnection.ConnectionString = "User ID=sysdba;Password=masterkey;" + 
"Database=\\server\share\database.fdb;DataSource=10.48.14.51;Charset=NONE;"; 

当然,您需要使用您的确切网络路径更改\ server \ share \ database.fdb.

of course you need to change \server\share\database.fdb with your exact network path.

这篇关于C#中的Firebird连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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