You are not logged in.
Pages: 1
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
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
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
I did not check your code...
But you seem to use the SynDBFirebird unit which is not finished nor released!
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
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
Pages: 1