3

I could establish the connection to a Firebird database with the following connection string:

ConnectionString = "User ID=SYSDBA;Password=masterkey;Database=localhost:C:\\MyDb\\mydb.FDB;DataSource=localhost;Charset=NONE;";

But when the C# code tries to execute the query the following error comes:

Dynamic SQL Error SQL Error Code = -204 Table unknown

The code that I've tried:

using FirebirdSql.Data.FirebirdClient;
...
FbConnection connection = new FbConnection(ConnectionString);
connection.Open();
FbCommand readCommand = new FbCommand("Select Name From Customer;", connection);
FbDataReader myreader = readCommand.ExecuteReader();

There definitely exists the Customer table (I've checked with IBExpert - in that I can read the data). I hardly found anything on Google.

Firebird 2.5 server is running on my Computer. What could be the problem?

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197
Mitulát báti
  • 2,086
  • 5
  • 23
  • 37
  • The error is incomplete; a "Table unkown"-error will also display the name of the unknown table. Could you also show the DDL of the table? I suspect you created a table `"Customer"` which is case sensitive and therefor distinct from `Customer` (which is case insensitive and equivalent to `CUSTOMER`). – Mark Rotteveel May 22 '16 at 09:07
  • Unfortunately I don't know the DDL. An FDB file was sent to me as the database without any more information. Only thing I could use is IBExpert (to see what tables are in it). Can I figure out the DDL somehow from the database itself, or with some tools? – Mitulát báti May 22 '16 at 09:37
  • Sure, IBExpert can reverse engineer the DDL (as can other tools). As I don't use IBExpert, I don't exactly know how. – Mark Rotteveel May 22 '16 at 09:38
  • Yes, I've just checked, and unfortunately it's "Customer". – Mitulát báti May 22 '16 at 09:47
  • To view the DDL from `IBFExpert` open the table or stored procedure or something else and just click on `DDL` tab. – Val Marinov May 22 '16 at 10:56

1 Answers1

4

As you confirmed in the comments that the table name is actually "Customer", you will need to quote the object names in your query to make them case sensitive, so:

new FbCommand("Select \"Name\" From \"Customer\"", connection);

I have assumed that Name is also case sensitive, and therefor quoted it as well.

Mark Rotteveel
  • 100,966
  • 191
  • 140
  • 197