Elfoc
Elfoc

Reputation: 3689

Firebird connection in C#

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?

Upvotes: 1

Views: 11025

Answers (1)

Steve
Steve

Reputation: 216293

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.

Upvotes: 5

Related Questions