You are not logged in.
Pages: 1
Hello,
I'm trying to use mORMot with a Standard Database having an external Table in a Oracle DB, by this way :
procedure TsrvMainDm.ConnectMainDB;
begin
TSynLog.Enter(Self, 'ConnectMainDB');
FOracleProps := TSQLDBOracleConnectionProperties.Create('URIOS', '', 'URIOS_INF', 'VALIDU');
//FOracleProps := TSQLDBOracleConnectionProperties.Create('//DellTHIBAUT:1526/Urios3', '', 'URIOS_INF', 'VALIDU');
FMainDataModel := TSQLModel.Create([]);
FMainDataModel.AddTable(TSQLPlan);
// Redirection d'une table du modele sur la base Oracle
VirtualTableExternalRegister(FMainDataModel, TSQLPlan, FOracleProps, 'P_PLAN');
FMainDataModel.Props[TSQLPlan].ExternalDB.MapField('ID', 'NO_PLAN');
FMainDB := TSQLRestServerDB.Create(FMainDataModel, 'Main.db3', True);
FMainDB.CreateMissingTables(0);
end;
This work fine when the Oracle database is on my computer ("URIOS" case).
But when it is on a remote one (on the local network) I lose my application during "FMainDB.CreateMissingTables(0);".
Any Idea why ?
Thank you
Offline
Well with the SynDBExplorer, the connection string works fine !
Offline
Here are some informations I can give you:
The last point before I lose the application running:
procedure TSQLDataBase.GetFieldNames(var Names: TRawUTF8DynArray; const TableName: RawUTF8);
var R: TSQLRequest;
n: integer;
begin
if (self=nil) or (fDB=0) then
exit; // avoid GPF in case of call from a static-only server
Lock;
try
try
*********************************************************************
R.Prepare(fDB,'PRAGMA table_info('+TableName+');'); // ESQLite3Exception
*********************************************************************
n := 0;
repeat
if R.Step<>SQLITE_ROW then break;
if n=length(Names) then
SetLength(Names,n+MAX_SQLFIELDS);
Names[n] := sqlite3.column_text(R.Request,1); // cid,name,type,notnull,dflt_value,pk
inc(n);
until false;
SetLength(Names,n);
finally
R.Close;
end;
finally
UnLock;
end;
end;
And the stack :
SynSQLite3.TSQLDatabase.GetFieldNames((),'Plan')
mORMotSQLite3.TSQLRestServerDB.CreateMissingTables(0,[])
srvMainDm_.TsrvMainDm.ConnectMainDB
SrvMainFrm_.TForm3.Button5Click($2D830A0)
Hope this can help you
Offline
I'have tried with the file deleted.
It's the same : I saw the file being generated (Main.db3 and Main.db3-journal), but noting after.
Offline
Yes, I used to.
I'have tried :
FMainDataModel := TSQLModel.Create([TSQLPlan]);
and
FMainDataModel := TSQLModel.Create([]);
FMainDataModel.AddTable(TSQLPlan);
Offline
And something like Firewall ?
But why did I succed with SynDbExplorer ?
I'm going to try on an other computer.
Offline
Well,
I'have tried on an other computer (no firewall) and it's the same result...
Something strange :
FOracleProps := TSQLDBOracleConnectionProperties.Create('//Delldev5:1526/Urios', '', 'URIOS_INF', 'VALIDU');
lSQLDBConnection := FOracleProps.NewConnection;
lSQLDBConnection.Connect
if not lSQLDBConnection.Connected then
raise Exception.Create('Message d''erreur');
-> the connection is Ok
Offline
Did you recompile SynDBExplorer with the same source (there may be a regression)?
Please enable the logs, create a .map file at compilation in project options, and send more information.
Offline
Hello AB,
I work a bit on my trouble, and it seems that I've identified somethings :
- my trouble is function of the structure of the external table I try to lock.
If I use a typical table, with an standard ID Field, and another such as VAL1, it work fine (retrieve records and update them)
In fact most of our tables don't have such ID field's name, but often NOID or NO_PLAN.
And the lock I have depends if I try to map a field or not.
Can this help you ?
Offline
I guess the database was not created the same.
Perhaps the table in the local database has been created by the ORM, whereas the external table was already existing.
And there is an issue in the external database column mapping...
Offline
The 2 databases are the same (come from an client's export).
Perhaps it is something like the rigths between the 2 computers.
I'm stil invastigating this problem and working on other fonctions of your framework.
So I'll be back to you as I've some news.
Offline
It doesn't matter.
Regards
Offline
Pages: 1