You are not logged in.
Pages: 1
Hello every one .
Sorry for my poor english. I am a newbie with mormot.
I had create a unigui application,and use mormot as connection pool in unigui's servermodule unit.
This application connect a mssql database.
I got some problems on this project.
1.The pool create new connection several seconds or minutes. when i test this , got 40+ connects after 30 minutes.
2.The connection count look not accuracy.
What is wrong or missing ?
the source codes are here:
servermodule.pas unit
type
TUniServerModule = class(TUniGUIServerModule)
private
{ Private declarations }
dbConn: TOleDBMSSQLConnectionProperties;
protected
procedure FirstInit; override;
public
{ Public declarations }
Procedure OpenSql(aSql:String;aFDMemTable:TFDMemTable);
Procedure ExecSql(aSql:String);
function GetConCount:integer;
end;
implementation
Const
cServer:RawUTF8='127.0.0.1';
cDatabase:RawUTF8='testdb';
cUserId:RawUTF8='sa';
cUserPwd:RawUTF8='sapassword';
procedure TUniServerModule.ExecSql(aSql: String);
begin
dbconn.ExecuteNoResult(aSql,[]);
end;
procedure TUniServerModule.FirstInit;
begin
InitServerModule(Self);
//add by myself
dbconn:=TOleDBMSSQLConnectionProperties.Create(cServer,cDatabase,cUserId,cUserPwd);
dbconn.ConnectionTimeOutMinutes:=1;
//add by myself end
end;
function TUniServerModule.GetConCount: integer;
begin
result:=dbconn.MainConnection.TotalConnectionCount;
end;
procedure TUniServerModule.OpenSql(aSql: String; aFDMemTable: TFDMemTable);
var
rows: ISQLDBRows;
begin
rows:=dbconn.ExecuteInLined(aSql,True);
if aFDMemTable.Active=false then aFDMemTable.Open;
aFDMemTable.EmptyDataSet;
aFDMemTable.CopyDataSet(ToDataSet(aFDMemTable,rows),[coStructure,coRestart,coAppend]);
aFDMemTable.CommitUpdates;
// dbconn.EndCurrentThread;
end;
mainmodule.pas unit
type
TUniMainModule = class(TUniGUIMainModule)
private
{ Private declarations }
public
{ Public declarations }
procedure OpenSql(aSql:string;aFDMemTable:TFDMemTable);
procedure ExecSql(aSql:String);
function GetConCount:Integer;
end;
implementation
procedure TUniMainModule.ExecSql(aSql: String);
begin
UniServerModule.ExecSql(aSql);
end;
function TUniMainModule.GetConCount: Integer;
begin
Result:=UniServerMOdule.GetConCount;
end;
procedure TUniMainModule.OpenSql(aSql: string; aFDMemTable:TFDMemTable);
begin
UniServerModule.OpenSql(asql,aFDMemTable);
end;
mainform.pas unit
procedure TMainForm.UniButton1Click(Sender: TObject);
var
SQL:String;
begin
self.FDMemTable1.Close;
sql:='select * from testtable';
UniMainMOdule.OpenSql(sql,self.FDMemTable1);
end;
//value of unitimer1.interval is 5000;
procedure TMainForm.UniTimer1Timer(Sender: TObject);
begin
self.UniButton1.Click;
end;
Offline
Inside dbconn.ExecuteInLined mORMot create a connection based on thread ID in which code is executed, so if UniGui create a copy of TUniServerModule for each client (web) connection in separate thread (looks like this is true), then you got as many Db connection as unigui threads. This is as expected.
Last edited by mpv (2018-01-11 10:49:56)
Offline
Inside dbconn.ExecuteInLined mORMot create a connection based on thread ID in which code is executed, so if UniGui create a copy of TUniServerModule for each client (web) connection in separate thread (looks like this is true), then you got as many Db connection as unigui threads. This is as expected.
Sorry for reply so late.
UniGui's UniServerModule is the main thread(only one,and globe shared ) at runtime ,the UniMainModules(thread shared or one client shared) are create in separate threads for every client connect the server.
Offline
We use TOleDBMSSQL2012ConnectionProperties in production for many years without problems. May me something wrong with SQLNCLI10, used by default by TOleDBMSSQLConnectionProperties - try to replace it with TOleDBMSSQL2012ConnectionProperties which use a SQLNCLI11
Offline
Hi !
Finally,I had changed my project's structure。
unigui app<->mormot app<->database
TWinHttp(unigui app servermodule.pas) as httpclient。
THttpApiServer(mormot app) as httpserver。
TOleDBMSSQLConnectionProperties(mormot app) as database client( or manager)。
thanks mpv's replys.
Offline
Hi !
Finally,I had changed my project's structure。
unigui app<->mormot app<->databaseTWinHttp(unigui app servermodule.pas) as httpclient。
THttpApiServer(mormot app) as httpserver。
TOleDBMSSQLConnectionProperties(mormot app) as database client( or manager)。
Mormot server is a different app? I have writed a couple of Unigui+mORMot, but was using mORMot server in the same application (sqlite3).
Offline
To understand what is happening:
1. Idera, sees a flaw, a blatant lack and a shortfall in the EMB web products.
2. Idera sees in unigui, the ideal solution to overcome this lack. She wants UNIGUI.
3. Idera wants to offer Unigui as an add-on, at a reasonable price, she will have to get rid of the expensive Sencha licenses.
4. What she did by absorbing sencha company.
5. Idera is a good player: she counts on millions Delphi users in the world, Who are impressed by UNIGUI project.
6. Idera has no intention of re-inventing the wheel. It will be satisfied with the hard work of FMSOFT, of what has endured Farshad since 2009 !
7. Finally, as an apotheosis, as I know, most of the smaller companies bought by BIG predators, products dies at the end. These BIG predators can do any thing. As far I know they don't care about customers, they just care about how they can earn more and eliminate their competitors.
Offline
@warleyalex, So it's a win for delphi deveopers?
One question -
- I think Ideara hasn't acquired FMSOFT?
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
So it's a win for delphi deveopers?
One question -
- I think Ideara hasn't acquired FMSOFT?
I was probably drunk last night, Idera didn't buy FMSoft! (that's bad news for UNIGUI).
about Idera absorbing sencha company.
I remember since the Art Landro has joined the Sencha's company as its new CEO. The worst mistake was letting Sequoia near it. From that point it was all lies and sticky-tape. First decision: immediately, the super architect Aconran and others core employees were laid off and comes with the decision of the diabolic the requirement to purchase "5-dev license for only 5K", and wow, they simply deleted all the comments as "no longer relevant" about ExtJS. Sencha was treating their community like sh*t.
The latest version available to us has known bugs that are fixed already. I remember I fixed some bugs myself and submit countless fixes back to Sencha but don’t get to track their integration via a pull request or use the framework versions that incorporate them in my open source projects. These CEO left a large hole in the boat.
Let’s not pretend this acquisition is good news for anyone using Sencha products. It's indirect confirmed, IDERA has already dismissed all developers and will outsource the development process to places like India, and they have already told the Sencha services guys to look for new jobs. Presumably IDERA got Sencha for a fire sale price and now intends to milk the licensing revenues while they last without investing much. The acquisition comes along with the announcement on Single Developer Licences for Ext (US$960), this is indeed annual subscription license that includes 1 year of development and distribution rights. For perpetual license (minimum 5 licenses for $4,340).
--------
Look, this BIG predator, just care about how they can earn more and eliminate their competitors. I think they will propose a single developer perpetual license linked with Delphi to use ExtJS. That more expensive Delphi licenses await us (bad news). If so, only UniGUI will be the extra cost.
(mORMot with Ext) and (UniGUI with Ext) is like rocket and turtle if we spoke about speed.
Offline
I don't use any Sencha products, but let's see what will happen to Delphi...
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
Pages: 1