Firebird connection in C#

不羁的心 提交于 2019-12-24 06:44:27

问题


i have problem with connection..

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;"

everything is working fine.

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;";

and this don't work also:

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;";

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..

Why?


回答1:


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;"; 

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



来源:https://stackoverflow.com/questions/9630770/firebird-connection-in-c-sharp

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!