#1 2013-07-23 14:43:56

Roberto Schneiders
Member
From: Santa Catarina, Brazil
Registered: 2012-09-19
Posts: 127
Website

Help with Firebird Embedded

I'm trying to connect mORMot to a firebird embedded database.

This is the code:

var
  Props:TSQLDBConnectionProperties;
begin
  Model := CreateSampleModel;
  Props := TSQLDBFirebirdEmbeddedConnectionProperties.Create('localhost:C:\TESTE2.fdb', 'TESTE2.fdb', 'SYSDBA', 'asd');
  VirtualTableExternalRegister(Model,TSQLSampleRecord,Props, 'SampleRecord');
  Database := TSQLRestServerDB.Create(Model, ':memory:'); 

  TSQLRestServerDB(Database).CreateMissingTables(0); // ERROR
end;

CreateMissingTables returns this error. What is very strange since the firebird embedded does not have authentication.

Stack:

exception class   : ESQLite3Exception
exception message : Firebird Error 14000098: Your user name and password are not defined. Ask your database administrator to set up a Firebird login. [ SQLCODE=-902 (Unsuccessful execution caused by a system error that precludes successful execution of subsequent statements) ].

main thread ($21bc):
006ce2ce +02e Project1.exe SynSQLite3      3890   +2 sqlite3_check
006cde05 +041 Project1.exe SynSQLite3      3818   +3 TSQLRequest.Step
006cd3bd +035 Project1.exe SynSQLite3      3439   +5 TSQLRequest.Execute
006cd46a +02e Project1.exe SynSQLite3      3459   +3 TSQLRequest.Execute
006cc048 +074 Project1.exe SynSQLite3      2847   +9 TSQLDatabase.Execute
006cf150 +144 Project1.exe mORMotSQLite3    752  +16 TSQLRestServerDB.CreateMissingTables

Can help me?

Offline

#2 2013-07-23 16:01:30

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,238
Website

Re: Help with Firebird Embedded

We only did tests with FireBird embedded, so without username/password.
And it worked as exepcted.
See the performance test sample file.

You use localhost:c:\.... and I suspect this is not a firebird embedded DB but a Firebird instance running at localhost.

Offline

#3 2013-07-23 16:46:53

Roberto Schneiders
Member
From: Santa Catarina, Brazil
Registered: 2012-09-19
Posts: 127
Website

Re: Help with Firebird Embedded

I tried to use the same way as the example 15 - External DB performance does, but there is another error.

var
  Props:TSQLDBConnectionProperties;
begin
  Model := CreateSampleModel;
  Props := TSQLDBFirebirdEmbeddedConnectionProperties.Create('firebirdembedded.1', '', '', '');
  VirtualTableExternalRegister(Model,TSQLSampleRecord,Props, 'SampleRecord');
  Database := TSQLRestServerDB.Create(Model, ':memory:');
  TSQLRestServerDB(Database).CreateMissingTables(0);
end;

This error also occurs in example 15.

Stack

exception class   : ESQLite3Exception
exception message : Firebird Error 140000F9: Dynamic SQL Error. SQL error code = -502. Invalid cursor declaration. Statement already has a cursor SYNDB assigned. [ SQLCODE=-502 (The cursor identified in an OPEN statement is already open.) ].

main thread ($50bc):
006ce2ce +02e Project1.exe SynSQLite3      3890   +2 sqlite3_check
006cde05 +041 Project1.exe SynSQLite3      3818   +3 TSQLRequest.Step
006cd3bd +035 Project1.exe SynSQLite3      3439   +5 TSQLRequest.Execute
006cd46a +02e Project1.exe SynSQLite3      3459   +3 TSQLRequest.Execute
006cc048 +074 Project1.exe SynSQLite3      2847   +9 TSQLDatabase.Execute
006cf150 +144 Project1.exe mORMotSQLite3    752  +16 TSQLRestServerDB.CreateMissingTables

what I'm doing wrong?

Offline

#4 2013-07-23 19:02:47

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,238
Website

Re: Help with Firebird Embedded

I did not check your code...

But you seem to use the SynDBFirebird unit which is not finished nor released!
smile

Only tested units for Firebird are via SynDBUniDAC or SynDBZeos providers (the 2nd the better IMHO).
See the documentation and the performance sample...
You can try with SynDBFireDAC libraries, if you have them.

Offline

#5 2013-07-23 20:47:26

Roberto Schneiders
Member
From: Santa Catarina, Brazil
Registered: 2012-09-19
Posts: 127
Website

Re: Help with Firebird Embedded

Sorry about that.

Now trying to ZDBC.

var
  Props:TSQLDBConnectionProperties;
begin
  Model := CreateSampleModel;
  Props := TSQLDBZEOSConnectionProperties.Create( TSQLDBZEOSConnectionProperties.URI(dFirebird, 'fbembed.dll'), 'mormot.fdb', '', '');
  VirtualTableExternalRegister(Model,TSQLSampleRecord,Props, 'SampleRecord');
  Database := TSQLRestServerDB.Create(Model, 'Application');

  TSQLRestServerDB(Database).CreateMissingTables(0);

I noticed some problems.
1) Apparently the word "Time" is a reserved word in firebird. When trying to add the table SampleRecord an error occurs. A boring coincidence.
Simply changed the name of the property and is working.

2) The command to count the records in the table (TSQLRestServerDB(Database).TableRowCount(TSQLSampleRecord)) does not seem to be working. Always returns zero. I checked and there is data in the table.

Offline

Board footer

Powered by FluxBB