#1 2017-08-28 13:38:24

ssbird
Member
Registered: 2017-08-28
Posts: 4

SQL Lite3 to Oracle migration

I'm new to mORMot and i'm investigating the possibilities. Everything looks very promissing. For me the Samples\19 - AJAX ExtJS FishFacts demo is the most interesting demo, because it is close to my solution. The demo uses a SQLLite3 database. In the uses class there are the 'mORMotSQLite3, SynSQLite3Static,' files.

I want to migrate this demo to a Oracle database. Is there a alternative for Oracle to these 2 files. I Alreadty found the SunDBOracle. Just replacing these 2 for this one is not enough, as suspected. Is there somewone who did this before me?

Kind regards....

Offline

#2 2017-08-28 16:29:49

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

Re: SQL Lite3 to Oracle migration

If you can use Sqlite3, we strongly encourage using it on the mORMot server, since it will give you the best performance, for the smallest fee.
Then use the existing Oracle DB for legacy system integration.

To switch to SynDB external database, you have to define it as external.
See for instance how the "30 - MVC Server sample" can run with a local SQlite3 database via MVCServer.dpr, or an external FireBird engine via MVCServerFirebird.dpr, or an external PostgreSQL engine via MVCServerPostgreSQL.dpr - or even a NoSQL MongoDB store via MVCServerMongoDB.dpr.
Just by changing how the main TSQLRestServer class is initialized.
In your case, of course, you have to use SynDBOracle classes.

Online

#3 2017-08-30 08:14:00

ssbird
Member
Registered: 2017-08-28
Posts: 4

Re: SQL Lite3 to Oracle migration

Thanks for your reply. I started to investigate how to use a Oracle database. I have looked into the "30 - MVC" project. I tried to quickly change one of these projects to oracle. I couldn't manage that, because I lack the know how to congigure the ExternalDB and the server props. I found the "16 - Execute SQL via services" which i could connect to Oracle. But this application serves SQL statements and not a MVC Application. Is there a Oracle sample like the "30 - MVC application"?

Kind regards...

Offline

#4 2017-08-30 08:30:50

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

Re: SQL Lite3 to Oracle migration

Just use the TSQLDBOracleConnectionProperties class to define your connection to Oracle, then register it as external SQL database as in other ORM samples.

Online

#5 2017-08-30 12:35:49

ssbird
Member
Registered: 2017-08-28
Posts: 4

Re: SQL Lite3 to Oracle migration

Thanks again for your help. I have tried to just replace the TSQLDBOracleConnectionProperties. I can see this is used in the projects 12, 15 and 16. I dont see te technical solution to integrate it in to the '30 - MVC' project. As a basis a took the moongoDB variant, but i dont know how to integrate the TSQLDBOracleConnectionProperties into it.

To change the approach, i see the '\SQLite3\Samples\ThirdPartyDemos\EMartin\TSynRestDataset' project. This is also very close what i'm trying to achive. How could i switch this code from SQLLite to Oracle?

unit fMain;

interface

uses
  {$ifdef MSWINDOWS}
  Windows,
  Messages,
  {$endif}
  SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls,
  SynCommons, mORMot, mORMotSQLite3, SynSQLite3Static,
  mORMotHttpServer, SampleData;

type
  TfrmMain = class(TForm)
    Label1: TLabel;
    Button1: TButton;
    Label2: TLabel;
    procedure Button1Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormDestroy(Sender: TObject);
    procedure FormShow(Sender: TObject);
  private
  public
    Model: TSQLModel;
    DB: TSQLRestServerDB;
    Server: TSQLHttpServer;
  end;

var
  frmMain: TfrmMain;

implementation

uses
  mORMotDB;

{$R *.dfm}

procedure TfrmMain.Button1Click(Sender: TObject);
begin
  Close;
end;

procedure TfrmMain.FormCreate(Sender: TObject);
begin
  Model := CreateSampleModel;
  DB := TSQLRestServerDB.Create(Model, 'Project19Server.db3', False);
  DB.CreateMissingTables;
  Server := TSQLHttpServer.Create('8080',[DB],'+',HTTP_DEFAULT_MODE);
  Server.AccessControlAllowOrigin := '*'; // allow cross-site AJAX queries
end;

procedure TfrmMain.FormDestroy(Sender: TObject);
begin
  Server.Free;
  DB.Free;
  Model.Free;
end;

procedure TfrmMain.FormShow(Sender: TObject);
begin
  Label1.Caption := Caption;
end;

end.

Offline

#6 2017-08-30 13:55:15

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

Re: SQL Lite3 to Oracle migration

1. Please do not post extensive code snippets to the forum: it pollutes it.
See the rules - https://synopse.info/forum/misc.php?action=rules

2. Check the documentation about external SQL databases.
It is explained there.
Check https://synopse.info/files/html/Synopse … ml#TITL_27
and https://synopse.info/files/html/Synopse … l#TITL_146

Online

#7 2017-09-04 14:45:18

ssbird
Member
Registered: 2017-08-28
Posts: 4

Re: SQL Lite3 to Oracle migration

Thanks again. And sorry for the extensive code snipset. I was not aware of this rule.

I followd the TITL_27 and TITL_146 article. To keep it short. As I interpret it right know you have to use FireDac, AnyDac or ODBC to connect directly to Oracle. We use our own driver DOA. Is there a possability to use our on driver? Or is this to far fetched?

Kind regards

Last edited by ssbird (2017-09-04 14:45:40)

Offline

#8 2017-09-04 16:29:16

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

Re: SQL Lite3 to Oracle migration

What do you call "DOA" driver?

Note that there is in SynDBOracle a direct access to the Oracle OCI instant client, which gives better performance than FireDac, AnyDAC or ODBC.

Online

Board footer

Powered by FluxBB