#51 Re: mORMot 1 » server does not creates tables » 2015-06-16 13:06:16

Yes, it works fine with Zeos.

Thanks a lot.

#52 Re: mORMot 1 » server does not creates tables » 2015-06-16 11:10:25

I say sorry for delay.

Today I downloaded and applied night build.

I have very simple code:

  FLocalModel := LocalModel;

  aProps := TSQLDBUniDACConnectionProperties.Create(TSQLDBUniDACConnectionProperties.URI(dMySQL,'***:***'), 'mednet', '***', '***');
  aProps.SpecificOptions.Values['UseUnicode'] := 'True';
  aProps.SpecificOptions.Values['Charset'] := 'utf8';

  VirtualTableExternalRegisterAll(FLocalModel, aProps, [regMapAutoKeywordFields]);

  FLocalRestServer := TSQLRestServerDB.Create(FLocalModel, SQLITE_MEMORY_DATABASE_NAME, true); // authentication=true
  FLocalRestServer.CreateMissingTables;

and I have an exception on last row of the snippet:

First chance exception at $7673B727. Exception class EMySqlException with message
#42S02Table 'mednet.transfer' doesn't exist'.

What is correct way to create automatically tables in mysql?

Thanks

#53 mORMot 1 » server does not creates tables » 2015-06-04 09:45:57

alexdmatveev
Replies: 9

Hello,

pls show me my mistake.

I start my server on full empty mysql database.
And I am awaiting it will create all model tables for me.

  aProps := TSQLDBUniDACConnectionProperties.Create('MySQL', 'medplatform', '***', '***');
  aProps.SpecificOptions.Values['Server'] := '****';
  aProps.SpecificOptions.Values['Port'] := '3306';
  aProps.SpecificOptions.Values['UseUnicode'] := 'True';
  aProps.SpecificOptions.Values['Charset'] := 'utf8';

  try
    aModel := CreateDataModel;
    VirtualTableExternalRegisterAll(aModel, aProps);

    MapFields(aModel);

    try
      DeleteFile('data1.db3');
      aRestServer := TSQLRestServerDB.Create(aModel,'data1.db3', true); // authentication=true
      try
        aRestServer.CreateMissingTables; // create tables or fields if missing

Log:

20150604 11441159  +    TSQLDatabase(026E8D98).001606A8 SynSQLite3.TSQLDatabase.DBOpen (3743) 
20150604 11441159  +    	TSQLDatabase(026E8D98).0015F5F2 SynSQLite3.TSQLDatabase.Execute (3325) 
20150604 11441159 SQL   		PRAGMA cache_size=10000
20150604 11441159  -    	00.000.511
20150604 11441159  -    00.001.421
20150604 11441159  +    TSQLDatabase(026E8D98).0015FAE8 SynSQLite3.TSQLDatabase.Execute (3442) 
20150604 11441159 SQL   	SELECT name FROM sqlite_master WHERE type='table' AND name NOT LIKE 'sqlite_%';
20150604 11441159  -    00.000.612
20150604 11441159 debug TSQLDatabase(026E8D98) TableNames=[]
20150604 11441159  +    TSQLDatabase(026E8D98).0015F5F2 SynSQLite3.TSQLDatabase.Execute (3325) 
20150604 11441159 SQL   	BEGIN TRANSACTION;
20150604 11441159  -    00.000.196
20150604 11441159  +    TSQLDatabase(026E8D98).0015F5F2 SynSQLite3.TSQLDatabase.Execute (3325) 
20150604 11441159 SQL   	CREATE VIRTUAL TABLE AuthUser USING External(LogonName TEXT COLLATE SYSTEMNOCASE, DisplayName TEXT COLLATE SYSTEMNOCASE, PasswordHashHexa TEXT COLLATE SYSTEMNOCASE, GroupRights INTEGER, Data BLOB);
20150604 11441159  +    	TSQLDBUniDACStatement(026CDE30).003131E1 SynDBDataset.TSQLDBDatasetStatementAbstract.Prepare (448) 
20150604 11441159  +    		TSQLDBUniDACConnection(02E7D678).Connect to ProviderName=MySQL Database=medplatform on Server=91.213.21.104
20150604 11441205 DB    			Connected to MySQL (5.5.42)
20150604 11441205  -    		00.134.042
20150604 11441205  -    	00.134.597
20150604 11441205  +    	TSQLDBUniDACStatement(026CDE30).00313364 SynDBDataset.TSQLDBDatasetStatementAbstract.ExecutePrepared (464) 
20150604 11441205 SQL   		TSQLDBUniDACStatement(026CDE30) SELECT NOW()
20150604 11441207  -    	00.037.259
20150604 11441543 EXC   	EMySqlException ("\r\n#42S02Table 'medplatform.authuser' doesn't exist") at 0031D29A MySqlNetUni.TMySqlNet.ReadError  stack trace API 000EBA48 SynCommons.SynRtlUnwind (42799) 
20150604 11441626 EXC   	EMyError ("\r\n#42S02Table 'medplatform.authuser' doesn't exist") at 0033F4B0 MyClassesUni.TMySQLConnection.MySQLError  stack trace API 000EBA48 SynCommons.SynRtlUnwind (42799) 00005994 System.@HandleAnyException 0033F4B0 MyClassesUni.TMySQLConnection.MySQLError 003410DF MyClassesUni.TMySQLCommand.Check 0034564A MyClassesUni.TMySQLCommand.Execute 002F09AB CRAccess.TCRRecordSet.ExecCommand 002F2658 CRAccess.TCRRecordSet.ExecFetch 003471B8 MyClassesUni.TMySQLRecordSet.InternalOpen 0021F717 MemData.TData.Open 0035087D MyClassesUni.TMySQLMetaData.GetIndex 003509B7 MyClassesUni.TMySQLMetaData.GetIndexes 002F6B93 CRAccess.TCRMetaData.GetMetaData 002D5EDF DBAccess.TDAMetaData.InternalOpen 0029A5C3 DB.TDataSet.SetActive 0029A40A DB.TDataSet.Open 001E1679 SynDB.TSQLDBConnectionProperties.GetIndexesAndSetFieldsColumnIndexed (4570) 003153C5 SynDBUniDAC.TSQLDBUniDACConnectionProperties.GetFields (292) 001EA3C6 mORMotDB.TSQLRestStorageExternal.Create (605) 
20150604 11441627 EXC   	EMyError ("\r\n#42S02Table 'medplatform.authuser' doesn't exist") at 0033F4B0 MyClassesUni.TMySQLConnection.MySQLError  stack trace API 000EBA48 SynCommons.SynRtlUnwind (42799) 00005994 System.@HandleAnyException 0033F4B0 MyClassesUni.TMySQLConnection.MySQLError 003410DF MyClassesUni.TMySQLCommand.Check 0034564A MyClassesUni.TMySQLCommand.Execute 002F09AB CRAccess.TCRRecordSet.ExecCommand 002F2658 CRAccess.TCRRecordSet.ExecFetch 003471B8 MyClassesUni.TMySQLRecordSet.InternalOpen 0021F717 MemData.TData.Open 0035087D MyClassesUni.TMySQLMetaData.GetIndex 003509B7 MyClassesUni.TMySQLMetaData.GetIndexes 002F6B93 CRAccess.TCRMetaData.GetMetaData 002D5EDF DBAccess.TDAMetaData.InternalOpen 0029A5C3 DB.TDataSet.SetActive 0029A40A DB.TDataSet.Open 001E1679 SynDB.TSQLDBConnectionProperties.GetIndexesAndSetFieldsColumnIndexed (4570) 003153C5 SynDBUniDAC.TSQLDBUniDACConnectionProperties.GetFields (292) 001EA3C6 mORMotDB.TSQLRestStorageExternal.Create (605) 
20150604 11441627 EXC   	EMyError ("\r\n#42S02Table 'medplatform.authuser' doesn't exist") at 0033F4B0 MyClassesUni.TMySQLConnection.MySQLError  stack trace API 000EBA48 SynCommons.SynRtlUnwind (42799) 00005994 System.@HandleAnyException 0033F4B0 MyClassesUni.TMySQLConnection.MySQLError 003410DF MyClassesUni.TMySQLCommand.Check 0034564A MyClassesUni.TMySQLCommand.Execute 002F09AB CRAccess.TCRRecordSet.ExecCommand 002F2658 CRAccess.TCRRecordSet.ExecFetch 003471B8 MyClassesUni.TMySQLRecordSet.InternalOpen 0021F717 MemData.TData.Open 0035087D MyClassesUni.TMySQLMetaData.GetIndex 003509B7 MyClassesUni.TMySQLMetaData.GetIndexes 002F6B93 CRAccess.TCRMetaData.GetMetaData 002D5EDF DBAccess.TDAMetaData.InternalOpen 0029A5C3 DB.TDataSet.SetActive 0029A40A DB.TDataSet.Open 001E1679 SynDB.TSQLDBConnectionProperties.GetIndexesAndSetFieldsColumnIndexed (4570) 003153C5 SynDBUniDAC.TSQLDBUniDACConnectionProperties.GetFields (292) 001EA3C6 mORMotDB.TSQLRestStorageExternal.Create (605) 
20150604 11441628 EXC   	EMyError ("\r\n#42S02Table 'medplatform.authuser' doesn't exist") at 0033F4B0 MyClassesUni.TMySQLConnection.MySQLError  stack trace API 000EBA48 SynCommons.SynRtlUnwind (42799) 00005994 System.@HandleAnyException 0033F4B0 MyClassesUni.TMySQLConnection.MySQLError 003410DF MyClassesUni.TMySQLCommand.Check 0034564A MyClassesUni.TMySQLCommand.Execute 002F09AB CRAccess.TCRRecordSet.ExecCommand 002F2658 CRAccess.TCRRecordSet.ExecFetch 003471B8 MyClassesUni.TMySQLRecordSet.InternalOpen 0021F717 MemData.TData.Open 0035087D MyClassesUni.TMySQLMetaData.GetIndex 003509B7 MyClassesUni.TMySQLMetaData.GetIndexes 002F6B93 CRAccess.TCRMetaData.GetMetaData 002D5EDF DBAccess.TDAMetaData.InternalOpen 0029A5C3 DB.TDataSet.SetActive 0029A40A DB.TDataSet.Open 001E1679 SynDB.TSQLDBConnectionProperties.GetIndexesAndSetFieldsColumnIndexed (4570) 003153C5 SynDBUniDAC.TSQLDBUniDACConnectionProperties.GetFields (292) 001EA3C6 mORMotDB.TSQLRestStorageExternal.Create (605) 
20150604 11441628 EXC   	EMyError ("\r\n#42S02Table 'medplatform.authuser' doesn't exist") at 0033F4B0 MyClassesUni.TMySQLConnection.MySQLError  stack trace API 000EBA48 SynCommons.SynRtlUnwind (42799) 00005994 System.@HandleAnyException 0033F4B0 MyClassesUni.TMySQLConnection.MySQLError 003410DF MyClassesUni.TMySQLCommand.Check 0034564A MyClassesUni.TMySQLCommand.Execute 002F09AB CRAccess.TCRRecordSet.ExecCommand 002F2658 CRAccess.TCRRecordSet.ExecFetch 003471B8 MyClassesUni.TMySQLRecordSet.InternalOpen 0021F717 MemData.TData.Open 0035087D MyClassesUni.TMySQLMetaData.GetIndex 003509B7 MyClassesUni.TMySQLMetaData.GetIndexes 002F6B93 CRAccess.TCRMetaData.GetMetaData 002D5EDF DBAccess.TDAMetaData.InternalOpen 0029A5C3 DB.TDataSet.SetActive 0029A40A DB.TDataSet.Open 001E1679 SynDB.TSQLDBConnectionProperties.GetIndexesAndSetFieldsColumnIndexed (4570) 003153C5 SynDBUniDAC.TSQLDBUniDACConnectionProperties.GetFields (292) 001EA3C6 mORMotDB.TSQLRestStorageExternal.Create (605) 
20150604 11441629 EXC   	EMyError ("\r\n#42S02Table 'medplatform.authuser' doesn't exist") at 0033F4B0 MyClassesUni.TMySQLConnection.MySQLError  stack trace API 000EBA48 SynCommons.SynRtlUnwind (42799) 
20150604 11441629 EXC   	EMyError ("\r\n#42S02Table 'medplatform.authuser' doesn't exist") at 0033F4B0 MyClassesUni.TMySQLConnection.MySQLError  stack trace API 000EBA48 SynCommons.SynRtlUnwind (42799) 00005994 System.@HandleAnyException 0033F4B0 MyClassesUni.TMySQLConnection.MySQLError 003410DF MyClassesUni.TMySQLCommand.Check 0034564A MyClassesUni.TMySQLCommand.Execute 002F09AB CRAccess.TCRRecordSet.ExecCommand 002F2658 CRAccess.TCRRecordSet.ExecFetch 003471B8 MyClassesUni.TMySQLRecordSet.InternalOpen 0021F717 MemData.TData.Open 0035087D MyClassesUni.TMySQLMetaData.GetIndex 003509B7 MyClassesUni.TMySQLMetaData.GetIndexes 002F6B93 CRAccess.TCRMetaData.GetMetaData 002D5EDF DBAccess.TDAMetaData.InternalOpen 0029A5C3 DB.TDataSet.SetActive 0029A40A DB.TDataSet.Open 001E1679 SynDB.TSQLDBConnectionProperties.GetIndexesAndSetFieldsColumnIndexed (4570) 003153C5 SynDBUniDAC.TSQLDBUniDACConnectionProperties.GetFields (292) 001EA3C6 mORMotDB.TSQLRestStorageExternal.Create (605) 
20150604 11441631 info  	TSQLRestStorageExternal.Destroy -> {"TSQLRestStorageExternal(0260B8C0)":{}}
20150604 11441631 EXC   	EMyError ("\r\n#42S02Table 'medplatform.authuser' doesn't exist") at 0033F4B0 MyClassesUni.TMySQLConnection.MySQLError  stack trace API 000EBA48 SynCommons.SynRtlUnwind (42799) 00005994 System.@HandleAnyException 0033F4B0 MyClassesUni.TMySQLConnection.MySQLError 003410DF MyClassesUni.TMySQLCommand.Check 0034564A MyClassesUni.TMySQLCommand.Execute 002F09AB CRAccess.TCRRecordSet.ExecCommand 002F2658 CRAccess.TCRRecordSet.ExecFetch 003471B8 MyClassesUni.TMySQLRecordSet.InternalOpen 0021F717 MemData.TData.Open 0035087D MyClassesUni.TMySQLMetaData.GetIndex 003509B7 MyClassesUni.TMySQLMetaData.GetIndexes 002F6B93 CRAccess.TCRMetaData.GetMetaData 002D5EDF DBAccess.TDAMetaData.InternalOpen 0029A5C3 DB.TDataSet.SetActive 0029A40A DB.TDataSet.Open 001E1679 SynDB.TSQLDBConnectionProperties.GetIndexesAndSetFieldsColumnIndexed (4570) 003153C5 SynDBUniDAC.TSQLDBUniDACConnectionProperties.GetFields (292) 001EA3C6 mORMotDB.TSQLRestStorageExternal.Create (605) 
20150604 11441632 EXC   	EMyError ("\r\n#42S02Table 'medplatform.authuser' doesn't exist") at 0033F4B0 MyClassesUni.TMySQLConnection.MySQLError  stack trace API 000EBA48 SynCommons.SynRtlUnwind (42799) 
20150604 11441649 EXC   	ESQLite3Exception ("Error SQLITE_ERROR (1) - \"\r\n#42S02Table 'medplatform.authuser' doesn't existM\"") at 00162686 SynSQLite3.sqlite3_check (4530)  stack trace API 000EBA48 SynCommons.SynRtlUnwind (42799) 
20150604 11441650  -    04.857.691
20150604 11441650  +    TSQLDatabase(026E8D98).0015F5F2 SynSQLite3.TSQLDatabase.Execute (3325) 
20150604 11441650 SQL   	ROLLBACK TRANSACTION;
20150604 11441650  -    00.001.557
20150604 11441650 EXC   ESQLite3Exception ("Error SQLITE_ERROR (1) - \"\r\n#42S02Table 'medplatform.authuser' doesn't existM\"") at 00162686 SynSQLite3.sqlite3_check (4530)  stack trace API 000EBA48 SynCommons.SynRtlUnwind (42799) 00005E42 System.@ExceptionHandler 00162686 SynSQLite3.sqlite3_check (4530) 001617C3 SynSQLite3.TSQLRequest.Execute (4086) 0015F62B SynSQLite3.TSQLDatabase.Execute (3329) 00165292 mORMotSQLite3.TSQLRestServerDB.CreateMissingTables (842) 
20150604 11441651 EXCOS EAccessViolation (C0000005) at 00046BAC Classes.TThread.Terminate  stack trace API 000EBA48 SynCommons.SynRtlUnwind (42799) 00005E42 System.@ExceptionHandler 

Thanks a lot for advance.

#54 Re: mORMot 1 » negative ID again » 2015-02-11 21:56:18

I see now it is dangerous.

LocalClient.RetrieveList<TTransfer>('id=?', [msg.Transfer.Id]);

works good with negative ID.

Thanks

#55 mORMot 1 » negative ID again » 2015-02-11 21:38:37

alexdmatveev
Replies: 10

Hello,

I see in mORMot.pas next rows:

function TSQLRestClient.Retrieve(aID: integer; Value: TSQLRecord;
  ForUpdate: boolean=false): boolean;
var Resp: RawUTF8;
    TableIndex: integer;
begin
  result := false;
  if (self=nil) or (aID<=0) or (Value=nil) then
    exit;

Looks like mORMot can not retrieve values with negative ID.

Can I change it with rows below?

  if (self=nil) or (Value=nil) then
    exit;

Is it very dangerous for the project?

The point is my database really contains special rows with negative ID.
Is it good or not... The question is not for me because the database is inherited from other developers.

Thanks a lot.

#57 Re: mORMot 1 » How to add custom model table to AccessRights? » 2014-12-12 10:27:18

to be clear...
one question more:

if I am logged in as user from USER Auth Group... then I can not get all users than can access a table (for example TOmMessageOpenDetailsMail).
For the operation I need administrator permissions.

Right?

#58 Re: mORMot 1 » How to add custom model table to AccessRights? » 2014-12-11 15:23:37

>By design.

Clear answer.

Thanks a lot.
Will make a comment in the sources... Maybe it will help to prevent troubles from my colleagues.

#59 mORMot 1 » How to add custom model table to AccessRights? » 2014-12-11 13:36:49

alexdmatveev
Replies: 5

Hello,

I have tried to find the solution in documentation and examples but without significant success.

My task is to manage access to some model tables via permissions stored in server Database.

Looks like I should use AccessRights field of then authuser table (TSQLAuthUser class).

I see the field contains permissions and tables are there by their model indexes...

First... it is not clear what the indexes are.

Please explain me the moment.

For example I have a model:

Result := TSQLModel.Create([TSQLAuthUser, TSQLAuthGroup, TAccount, TTransfer, TOmMessagePatientDetails,
                              TPersonal, TCountry, TLanguage, TClient, TMandant,
                              TOmMessageOpenDetailsInstant, TOmMessageOpenDetailsPDF, TOmMessageOpenDetailsJpg,
                              TOmMessageOpenDetailsForm, TOmMessageOpenDetailsMail]);

Now I want to restrict user USER1 to use TOmMessagePatientDetails table ONLY for READ (not DELETE and no UPDATE).

In my example TOmMessagePatientDetails has index = 4. Right?
What if other developer will change table order in the model? It looks like allowed in code.

So... Where can I read all steps documentation about how to make per-table permissions?

Thanks a lot.

#60 Re: mORMot 1 » how to set client connection timeout? » 2014-11-21 07:31:32

ok, thanks
the main question for me now is how to make it from my code but not in SynCrtSock.pas ?

what should I write before or after the line below?

 FClient := TSQLHttpClientWinHTTP.Create(FServer, FPort, Model);

#61 Re: mORMot 1 » how to set client connection timeout? » 2014-11-20 15:18:34

I have increased every timeout constant to extremely big 600000 (10 min).
and now I can send big files. Works for me so.
But I hope to get from Synopse team good solution for the task.

Thanks a lot.

#62 Re: mORMot 1 » how to set client connection timeout? » 2014-11-20 14:10:28

Thanks a lot for your time.
hmmm... so what is the solution?

#63 Re: mORMot 1 » how to set client connection timeout? » 2014-11-20 08:18:06

I see in SynCrtSock next code:

  /// TWinHttpAPI timeout default value for DNS resolution
  // - leaving to 0 will let system default value be used
  HTTP_DEFAULT_RESOLVETIMEOUT = 0;
  /// TWinHttpAPI timeout default value for remote connection
  // - default is 60 seconds
  HTTP_DEFAULT_CONNECTTIMEOUT = 60000;
  /// TWinHttpAPI timeout default value for data sending
  // - default is 30 seconds
  // - you can override this value by setting the corresponding parameter in
  // TWinHttpAPI.Create() constructor
  HTTP_DEFAULT_SENDTIMEOUT = 30000;
  /// TWinHttpAPI timeout default value for data receiving
  // - default is 30 seconds
  // - you can override this value by setting the corresponding parameter in
  // TWinHttpAPI.Create() constructor
  HTTP_DEFAULT_RECEIVETIMEOUT = 30000;

So please show me the way to create my own TWinHttpAPI object for my FClient.

My extreme way is to change mORMot contants but I think it is not very good idea.

Thanks.

#64 mORMot 1 » how to set client connection timeout? » 2014-11-19 16:35:45

alexdmatveev
Replies: 9

Hello gurus,

I have a client:

  FClient := TSQLHttpClientWinHTTP.Create(FServer, FPort, Model);

How to increase timeout for the client?

I tried to make so:

FClient.WinApi.ConnectionTimeout := 120000;

as it discussed here: http://synopse.info/forum/viewtopic.php?id=1335

but it looks like WinApi has no ConnectionTimeout property.

What should I do?

Thanks a lot.

#65 Re: mORMot 1 » Execute complex SQL with join » 2014-11-15 20:34:59

ok, will try.

next question...

tab: TSQLTable;
tab := FConnectionManager.Client.ExecuteList([], sql);

result table contains information about ID so we can convert it to objectlist and so on.

can I get ID column in result clientdataset after

cds := TSQLTableToClientDataSet(self, tab);

?

Thanks.

#66 Re: mORMot 1 » Execute complex SQL with join » 2014-11-15 12:54:09

Yes, I see.
What I need now is fast solution to fill a grid with some data.
As I understand main problem of me now is SQLite does not know about ID field an can not allow to join other tables via the ID.

It is too slow way to select joined data in a delphi loop for example... So words about flexible custom SQL queries in mORMot Framework is little bit exaggerated.

Have we simple way to get a workaround with ID field in SQL?

Your offer with web-service is clever and good but too complex for my simple task.

Thanks a lot again for your help.

#67 Re: mORMot 1 » Execute complex SQL with join » 2014-11-14 17:10:04

I use on server UniDAC connection properties to MySQL.
Now I made new form with Unidac Connection and Unidac Query... My SQL query works fine on the form.

#68 Re: mORMot 1 » Execute complex SQL with join » 2014-11-14 16:58:46

Sure I checked all SQLs... not in SynDBExplorer but in other Mysql manager (SQLyog).
SQL is quite correct and runs good.

#69 Re: mORMot 1 » Execute complex SQL with join » 2014-11-14 12:34:43

thanks for UNION ALL tip.

will try to provide MAP info little later.

#70 mORMot 1 » Execute complex SQL with join » 2014-11-14 11:07:57

alexdmatveev
Replies: 10

Hello gurus,

I have to execute not very complex custom SQL but it looks like not very obvious for mORMot.
Please show me the way


function TfrmTransform.Initialize: TfrmDocked;
var
  tab: TSQLTable;
  sql: String;
begin
  Result := inherited;
    sql := 'SELECT  transfer.id_transfer, id_user_sender, id_user_reciever, SendDateTime, RecieveDate, MessageState, MessageFormat, PatientId, PatientFirstName, PatientSecondName, PatientBirthday FROM ' +
      'transfer ' +
      'LEFT JOIN ' +
      '( ' +
      'SELECT id_transfer, PatientId, PatientFirstName, PatientSecondName, PatientBirthday FROM ommessageopendetailsform ' +
      'UNION ' +
      'SELECT id_transfer, PatientId, PatientFirstName, PatientSecondName, PatientBirthday FROM ommessageopendetailsinstant ' +
      'UNION ' +
      'SELECT id_transfer, PatientId, PatientFirstName, PatientSecondName, PatientBirthday FROM ommessageopendetailsjpg ' +
      'UNION ' +
      'SELECT id_transfer, PatientId, PatientFirstName, PatientSecondName, PatientBirthday FROM ommessageopendetailspdf ' +
      'UNION ' +
      'SELECT id_transfer, PatientId, PatientFirstName, PatientSecondName, PatientBirthday FROM ommessageopendetailsmail ' +
      ') AS opendetails ' +
      'ON id_transfer=opendetails.id_transfer';

  tab := FConnectionManager.Client.ExecuteList([], sql);
  cds := TSQLTableToClientDataSet(self, tab);
  BindSourceDB.Dataset := cds;
  tab.Free;
end;

on server I has an error:

20141114 12031343 EXC           ESQLite3Exception ("Error SQLITE_ERROR (1) - \"no such column: transfer.id_transfer\"") at 00563882  stack trace 0053B79C 0053D9BC 0053CE75 005403B4 0040491E 00407554 7702F8B1 66DF1911 0040491E 00407554 004075BB 005FD485 005F5CEF 005FB0D0 00446F4D 004073CA 75623677 77049F42 77049F15

on server I have MySQL and I thought the SQL will be executed directly by MySQL...
What should I do?

Thanks a lot

#71 Re: mORMot 1 » How to avoid memory leak? » 2014-10-28 15:38:33

MultiFieldValues looks like exactly what I need. Thanks a lot!

#72 Re: mORMot 1 » How to avoid memory leak? » 2014-10-28 07:47:12

Let's up the topic again.

mormot has very comfortable way to sort JSONTable on client side, but I again have the memory leak as described above.

var
  transfer, headers: TTransfer;
  table: TSQLTable;
  objects: TObjectList<TTransfer>;
begin
  headers := TTransfer.CreateAndFillPrepare(FConnectionManager.LocalClient, 'messageFormat=?', [Integer(messageFormat)]);
  table := headers.FillTable;
  table.SortFields(0, false);
  objects := table.ToObjectList<TTransfer>;
  //do some with objects
  objects.Free;
  //headers.Free; <--EXCEPTION HERE
end;

I have to free [headers] object but when I try to do it I get exception about object is freed already.
But when I comment the row I have the leak as described above.

I would like to
1. sort
2. have not the memory leak

I use last night build downloaded yesterday.

What should I try?

#73 mORMot 1 » Exception in Destroy in FMX project » 2014-10-26 08:04:45

alexdmatveev
Replies: 3

Hello,

I have next servers/client/models:

  FClient := TSQLHttpClientWinHTTP.Create(FServer, FPort, Model);
  FDocumentClient := TSQLHttpClientWinHTTP.Create(FDocumentServer, FDocumentPort, DocumentModel);
  FLocalModel := LocalModel;
  FLocalServer := TSQLRestServerDB.Create(FLocalModel, ChangeFileExt(paramstr(0),'.db3'));
  FLocalServer.CreateMissingTables;
  FLocalClient := TSQLRestClientDB.Create(FLocalServer);

they are created and work good.

destructor TOmConnectionManager.Destroy;
begin
  if sqlite3 = nil then
    sqlite3 := TSQLite3LibraryStatic.Create;

  FreeAndNil(FModel);
  FreeAndNil(FClient);

  FLocalClient.Free;
  FLocalServer.Free;
  FLocalModel.Free;

  FDocumentClient.Free;
  FDocumentModel.Free;

  FreeAndNil(sqlite3);
  inherited;
end;

Then I try to destroy them and always get exception in mORMot.pas

destructor TSQLModel.Destroy;
var i,j: integer;
begin
  for i := 0 to fTablesMax do begin
    with TableProps[i].Props do begin
      EnterCriticalSection(fLock); // may be called from several threads at once   <---- THEN EXCEPTION HERE
      try
        for j := 0 to fModelMax do
          if fModel[j].Model=self then begin
            // un-associate this TSQLRecord with this model
            Move(fModel[j+1],fModel[j],(fModelMax-j)*sizeof(fModel[j]));
            dec(fModelMax);
            break;
          end;
        TableProps[i].Free;
      finally
        LeaveCriticalSection(fLock);
      end;
    end;
  end;
  inherited;
end;

in VCL everything works good as I see. The problem is in FMX project.

Pls show me the way. Thanks.

#74 Re: mORMot 1 » How to avoid memory leak? » 2014-10-21 06:28:18

yes, with your TSQLRest.RetrieveList<TTransfer> approach it looks much more better.

Thanks a lot.

#75 Re: mORMot 1 » How to avoid memory leak? » 2014-10-20 11:38:09

you will find it in topic starting post.

#76 Re: mORMot 1 » How to avoid memory leak? » 2014-10-20 10:58:57

could you write me code snippet with my context?
what should I do concretely?

Thanks a lot for your help.

#77 Re: mORMot 1 » How to avoid memory leak? » 2014-10-20 10:09:39

I am sorry...

I copied in the post wrong function.

function TOmMailbox.Headers(messageFormat: TOmMessageFormat): TTransfer;
begin
  if messageFormat = mtUnknown then
    Result := TTransfer.CreateAndFillPrepare(FClient, '')
  else
    Result := TTransfer.CreateAndFillPrepare(FClient, 'messageFormat=?', [Integer(messageFormat)]);
end;

So I return TTransfer object, but when I try to free it I get the exception.

#78 mORMot 1 » How to avoid memory leak? » 2014-10-20 08:57:33

alexdmatveev
Replies: 11

Hello,

please show me the way to free memory and avoid exception.

procedure TForm1.Button1Click(Sender: TObject);
var
  transfer, trans: TTransfer;
  tab: TSQLTable;
  objs: TObjectList<TTransfer>;
  i: Integer;
begin
  trans := FMailbox.Headers(mtUnknown);
  tab := trans.FillTable;
  objs := tab.ToObjectList<TTransfer>;

  objs.Free;
  trans.Free; //<--- EXCEPTION IS HERE
end;

////////
function TOmMailbox.HeadersTable(messageFormat: TOmMessageFormat): TSQLTable;
var
  tr: TTransfer;
begin
  if messageFormat = mtUnknown then
    tr := TTransfer.CreateAndFillPrepare(FClient, '')
  else
    tr := TTransfer.CreateAndFillPrepare(FClient, 'messageFormat=?', [Integer(messageFormat)]);
  Result := tr.FillTable;
end;

so I have AV exception. FastMM says me: you try to destroy already freed object.

ok, when I comment the problem line I have memory leak report from FastMM:


--------------------------------2014/10/20 10:52:37--------------------------------
A memory block has been leaked. The size is: 52

This block was allocated by thread 0x36E4, and the stack trace (return addresses) at the time was:
406D06 
4088B7 
408FDE 
4089AC 
69E260 [mORMot.pas][mORMot][mORMot.TSQLRecord.FillPrepare][21505]
69FE0D [mORMot.pas][mORMot][mORMot.TSQLRecord.CreateAndFillPrepare][22103]
7B13FA [OM.Impl.Mailbox.pas][OM.Impl][OM.Impl.Mailbox.TOmMailbox.Headers][68]
7D097D [uMain.pas][uMain][uMain.TForm1.Button1Click][167]
543359 [Vcl.Controls][Vcl][Vcl.Controls.TControl.Click]
565BEF [Vcl.StdCtrls][Vcl][Vcl.StdCtrls.TCustomButton.Click]
5666FD [Vcl.StdCtrls][Vcl][Vcl.StdCtrls.TCustomButton.CNCommand]

The block is currently used for an object of class: TSQLRecordFill

The allocation number is: 6327

Current memory dump of 256 bytes starting at pointer address 7EE6D480:
E8 59 67 00 00 98 F5 7E 01 00 00 00 14 00 00 00 00 00 00 00 B8 09 F3 7E FF FF 07 00 00 00 00 00
00 00 00 00 00 00 00 00 A8 04 09 79 80 80 80 80 80 80 80 80 80 80 80 80 00 00 00 00 41 CA E6 7E
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 5A 17 00 00 06 6D 40 00 B7 88 40 00 DE 8F 40 00
67 B5 7A 00 C6 61 7A 00 B2 0A 7D 00 0B CF 60 00 0F CB 60 00 4C 90 40 00 C0 CA 60 00 A1 78 61 00
E4 36 00 00 E4 36 00 00 22 6D 40 00 D5 88 40 00 29 90 40 00 CE 89 40 00 DB 89 40 00 5C 0D 7D 00
87 CF 60 00 5F CD 60 00 88 90 40 00 6F CD 60 00 4E E7 4C 00 34 00 00 00 10 B1 7A 00 B7 A9 C9 86
90 12 94 00 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80
80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 80 48 56 36 79 00 00 00 00 41 C1 E6 7E
è  Y  g  .  .  ˜  õ  ~  .  .  .  .  .  .  .  .  .  .  .  .  ¸  .  ó  ~  ÿ  ÿ  .  .  .  .  .  .
.  .  .  .  .  .  .  .  ¨  .  .  y  €  €  €  €  €  €  €  €  €  €  €  €  .  .  .  .  A  Ê  æ  ~
.  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  Z  .  .  .  .  m  @  .  ·  ˆ  @  .  Þ    @  .
g  µ  z  .  Æ  a  z  .  ²  .  }  .  .  Ï  `  .  .  Ë  `  .  L    @  .  À  Ê  `  .  ¡  x  a  .
ä  6  .  .  ä  6  .  .  "  m  @  .  Õ  ˆ  @  .  )    @  .  Î  ‰  @  .  Û  ‰  @  .  \  .  }  .
‡  Ï  `  .  _  Í  `  .  ˆ    @  .  o  Í  `  .  N  ç  L  .  4  .  .  .  .  ±  z  .  ·  ©  É  †
  .  ”  .  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €
€  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  €  H  V  6  y  .  .  .  .  A  Á  æ  ~

--------------------------------2014/10/20 10:52:37--------------------------------
A memory block has been leaked. The size is: 532

This block was allocated by thread 0x36E4, and the stack trace (return addresses) at the time was:
41711E [FastMM4.pas][FastMM4][FastMM4.DebugReallocMem][8935]
406D43 
40CEC9 
40D002 
69D2FE [mORMot.pas][mORMot][mORMot.TSQLRecordFill.AddMap][21152]
69D3D8 [mORMot.pas][mORMot][mORMot.TSQLRecordFill.AddMap][21172]
69D6EC [mORMot.pas][mORMot][mORMot.TSQLRecordFill.Map][21260]
40D002 
69B3C6 [mORMot.pas][mORMot][mORMot.TSQLTableJSON.ParseAndConvert][19923]
697C45 [mORMot.pas][mORMot][mORMot.TSQLTable.CreateFromTables][18578]
40904C 

The block is currently used for an object of class: Unknown

The allocation number is: 6329

Current memory dump of 256 bytes starting at pointer address 7EF309B0:
01 00 00 00 28 00 00 00 40 2A FA 7E 00 00 00 00 00 00 00 00 40 2A FA 7E 60 5F E6 7E 01 00 00 00
40 2A FA 7E C0 60 E6 7E 02 00 00 00 40 2A FA 7E 20 62 E6 7E 03 00 00 00 40 2A FA 7E 80 63 E6 7E
04 00 00 00 40 2A FA 7E E0 64 E6 7E 05 00 00 00 40 2A FA 7E 40 66 E6 7E 06 00 00 00 40 2A FA 7E
A0 67 E6 7E 07 00 00 00 40 2A FA 7E 00 69 E6 7E 08 00 00 00 40 2A FA 7E 00 13 E4 7E 09 00 00 00
40 2A FA 7E 60 14 E4 7E 0A 00 00 00 40 2A FA 7E C0 15 E4 7E 0B 00 00 00 40 2A FA 7E 70 16 E4 7E
0C 00 00 00 40 2A FA 7E D0 17 E4 7E 0D 00 00 00 40 2A FA 7E 30 19 E4 7E 0E 00 00 00 40 2A FA 7E
90 1A E4 7E 0F 00 00 00 40 2A FA 7E F0 1B E4 7E 10 00 00 00 40 2A FA 7E 50 1D E4 7E 11 00 00 00
40 2A FA 7E B0 1E E4 7E 12 00 00 00 40 2A FA 7E 10 20 E4 7E 13 00 00 00 00 00 00 00 00 00 00 00
.  .  .  .  (  .  .  .  @  *  ú  ~  .  .  .  .  .  .  .  .  @  *  ú  ~  `  _  æ  ~  .  .  .  .
@  *  ú  ~  À  `  æ  ~  .  .  .  .  @  *  ú  ~     b  æ  ~  .  .  .  .  @  *  ú  ~  €  c  æ  ~
.  .  .  .  @  *  ú  ~  à  d  æ  ~  .  .  .  .  @  *  ú  ~  @  f  æ  ~  .  .  .  .  @  *  ú  ~
   g  æ  ~  .  .  .  .  @  *  ú  ~  .  i  æ  ~  .  .  .  .  @  *  ú  ~  .  .  ä  ~  .  .  .  .
@  *  ú  ~  `  .  ä  ~  .  .  .  .  @  *  ú  ~  À  .  ä  ~  .  .  .  .  @  *  ú  ~  p  .  ä  ~
.  .  .  .  @  *  ú  ~  Ð  .  ä  ~  .  .  .  .  @  *  ú  ~  0  .  ä  ~  .  .  .  .  @  *  ú  ~
  .  ä  ~  .  .  .  .  @  *  ú  ~  ð  .  ä  ~  .  .  .  .  @  *  ú  ~  P  .  ä  ~  .  .  .  .
@  *  ú  ~  °  .  ä  ~  .  .  .  .  @  *  ú  ~  .     ä  ~  .  .  .  .  .  .  .  .  .  .  .  .

--------------------------------2014/10/20 10:52:37--------------------------------
A memory block has been leaked. The size is: 116

This block was allocated by thread 0x36E4, and the stack trace (return addresses) at the time was:
406D06 
4088B7 
408FDE 
69FDD3 [mORMot.pas][mORMot][mORMot.TSQLRecord.CreateAndFillPrepare][22097]
76D76170 [ScriptTextOut]
7B13FA [OM.Impl.Mailbox.pas][OM.Impl][OM.Impl.Mailbox.TOmMailbox.Headers][68]
7D097D [uMain.pas][uMain][uMain.TForm1.Button1Click][167]
543359 [Vcl.Controls][Vcl][Vcl.Controls.TControl.Click]
565BEF [Vcl.StdCtrls][Vcl][Vcl.StdCtrls.TCustomButton.Click]
5666FD [Vcl.StdCtrls][Vcl][Vcl.StdCtrls.TCustomButton.CNCommand]
542DE8 [Vcl.Controls][Vcl][Vcl.Controls.TControl.WndProc]

The block is currently used for an object of class: TTransfer

The allocation number is: 6233

Current memory dump of 256 bytes starting at pointer address 7EFA2A40:
68 F4 6C 00 80 D4 E6 7E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 B7 19 92 02 80 80 80 80 80 80 80 80 00 00 00 00 C1 2D FA 7E
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 F0 18 00 00 06 6D 40 00 B7 88 40 00 DE 8F 40 00
11 D8 69 00 DE D5 69 00 B5 3A 7D 00 87 09 7D 00 59 33 54 00 EF 5B 56 00 FD 66 56 00 E8 2D 54 00
E4 36 00 00 E4 36 00 00 D5 88 40 00 29 90 40 00 FC FC 69 00 DB 89 40 00 5E 39 7D 00 95 34 7D 00
29 90 40 00 1D 2A 7D 00 B8 29 7D 00 84 2D 7D 00 DB 89 40 00 6C 00 00 00 68 F4 6C 00 64 EB 6A 87
h  ô  l  .  €  Ô  æ  ~  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .
.  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .
.  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .
.  .  .  .  .  .  .  .  .  .  .  .  ·  .  ’  .  €  €  €  €  €  €  €  €  .  .  .  .  Á  -  ú  ~
.  .  .  .  .  .  .  .  .  .  .  .  .  .  .  .  ð  .  .  .  .  m  @  .  ·  ˆ  @  .  Þ    @  .
.  Ø  i  .  Þ  Õ  i  .  µ  :  }  .  ‡  .  }  .  Y  3  T  .  ï  [  V  .  ý  f  V  .  è  -  T  .
ä  6  .  .  ä  6  .  .  Õ  ˆ  @  .  )    @  .  ü  ü  i  .  Û  ‰  @  .  ^  9  }  .  •  4  }  .
)    @  .  .  *  }  .  ¸  )  }  .  „  -  }  .  Û  ‰  @  .  l  .  .  .  h  ô  l  .  d  ë  j  ‡

--------------------------------2014/10/20 10:52:37--------------------------------
This application has leaked memory. The small block leaks are (excluding expected leaks registered by pointer):

37 - 52 bytes: TSQLRecordFill x 1
101 - 116 bytes: TTransfer x 1
485 - 532 bytes: Unknown x 1

Note: Memory leak detail is logged to a text file in the same folder as this application. To disable this memory leak check, undefine "EnableMemoryLeakReporting".

Please show me correct way to avoid the exception as well as the memory leak.

Thanks a lot for advance.

#79 Re: mORMot 1 » TSQLAuthUser and TSQLAuthGroup do not create default records » 2014-09-25 16:37:19

Thanks. What is about previous reply about the exception?

#80 Re: mORMot 1 » TSQLAuthUser and TSQLAuthGroup do not create default records » 2014-09-25 13:55:09

You said TSQLAuthUser.LogonName is primary key for the corresponding table...
Hmm... What do I do wrong?

  Result := TSQLModel.Create([TSQLAuthUser, TSQLAuthGroup, TTransfer, TOmMessageDetailsInstant]);

and I see in DB authuser table with ID: Integer as primary key.

Thanks.

#81 Re: mORMot 1 » TSQLAuthUser and TSQLAuthGroup do not create default records » 2014-09-25 12:57:23

Thanks for your help.

Detailed log:

20140925 14402248  +    TSQLDBUniDACStatement(02A9F440).002AD220 SynDBDataset.TSQLDBDatasetStatementAbstract.ExecutePrepared (460) 
20140925 14402248 SQL   	TSQLDBUniDACStatement(02A9F440) insert into User (id,username,DisplayName,passwort,GroupRights,MetaData,Name1,Name2,Title,id_country,id_mandant,id_client,id_Personal,id_Language) values (1,'Admin','Admin','67aeea294e1cb515236fd7829c55ec820ef888e8e221814d24d83b3dc4d825dd',1,NULL,'','','',0,0,0,0,0)
20140925 14402441 EXC   	EVariantBadIndexError ("Variant or safe array index out of bounds") at 00023D38 Variants.TranslateResult  stack trace API 000816E4 SynCommons.SynRtlUnwind (41486) 
20140925 14402445 EXC   	EVariantBadIndexError ("Variant or safe array index out of bounds") at 00023D38 Variants.TranslateResult  stack trace API 000816E4 SynCommons.SynRtlUnwind (41486) 0000546C System.@HandleAnyException 00023D38 Variants.TranslateResult 00023E85 Variants.VarResultCheck 0002C0EE Variants.VarArrayGet 0002C95F Variants.DynArrayFromVariant 000295C5 Variants.@VarToDynArray 0027A32C DBAccess.TDAParam.GetParamObject 0027A2DD DBAccess.TDAParam.GetNativeParamObject 0028DB35 DBAccess.TCustomDASQL.AssignParamValue 002A9D8C Uni.TUniSQL.WriteParams 0027D504 DBAccess.TCustomDADataSet.Execute 002B03CC SynDBUniDAC.TSQLDBUniDACStatement.DatasetExecSQL (531) 00181CB5 mORMotDB.TSQLRestStorageExternal.ExecuteFromJSON (1674) 
20140925 14402446  -    01.957.649

Tables information:
before server first start I have existing EMPTY user table and groups table does not exist.

version information:
in inc files I see words about version 1.18

environment information:
win 7 64bit, delphi 2010

#82 Re: mORMot 1 » How to get user id on client-side? » 2014-09-24 17:52:54

Thanks for the answer.

After Client.setuser I can get partically filled client.sessionuser.
It has filled name and so... But user.id=0.

How can I get id of current session user and ids of other
users if I have names of users?

User := tuser.create(client, 'logonname=?', [client.sessionuser.logonname]);

Is it possible?

Thanks?

#83 mORMot 1 » How to get user id on client-side? » 2014-09-24 15:33:37

alexdmatveev
Replies: 3

Hello everybody,

my task is to post a message in messages database table.
the table contains user_id field.

I create a message on the client side:

var
   FClient: TSQLHttpClient;

msg := TMessage.Create;
msg.Text := 'Hello';
msg.user_id := ... ; 
FClient.Add(msg, true);

I have user name as FClient.SessionUser.LogonName after FClient.SetUser().
How can I get user's ID if I logged on with User group permission... I can not just Create User from the server by his name because I have no permissions to TSQLAuthUser table.

Does the client-side way exist?

If no, then what is server-side way?


Thanks a lot.

#84 mORMot 1 » TSQLAuthUser and TSQLAuthGroup do not create default records » 2014-09-24 14:40:01

alexdmatveev
Replies: 6

Hello everybody,

my problem is my server does not create default records in authgroup and user tables.

  aProps := TSQLDBUniDACConnectionProperties.Create('MySQL', 'medplatform', 'root', 'Tiger4711');
  aProps.SpecificOptions.Values['Server'] := 'localhost';
  aProps.SpecificOptions.Values['Port'] := '3306';

  try
    aModel := DataModel;
    VirtualTableExternalRegisterAll(aModel, aProps);

    MapFields(aModel);

    try
      aRestServer := TSQLRestServerDB.Create(aModel,'data.db3', true); // authentication=true
      try
        aRestServer.CreateMissingTables; // create tables or fields if missing
....


function DataModel: TSQLModel;
begin
  Result := TSQLModel.Create([TUser, TSQLAuthGroup, TTransfer, TOmMessageDetailsInstant]);
end;

After aRestServer.CreateMissingTables; I have added next code

        if not aRestServer.TableHasRows(TSQLAuthGroup) then
        begin
          TSQLAuthGroup.InitializeTable(aRestServer, '', [itoNoIndex4ID, itoNoIndex4UniqueField, itoNoIndex4NestedRecord, itoNoIndex4RecordReference]);
        end;

Now server tries to create the records BUT when it creates ADMIN record an exception is raised.

Log:

20140924 16390435 SQL   	TSQLDBUniDACStatement(0289F500) insert into User (id,LogonName,DisplayName,PasswordHashHexa,GroupRights,MetaData,Name1,Name2,Title,id_country,id_mandant,id_client,id_Personal,id_Language) values (1,'Admin','Admin','67aeea294e1cb515236fd7829c55ec820ef888e8e221814d24d83b3dc4d825dd',1,NULL,'','','',0,0,0,0,0)
20140924 16390557 EXC   	EVariantBadIndexError ("Variant or safe array index out of bounds") at 00424D38  stack trace API 004826E4 
20140924 16390560 EXC   	EVariantBadIndexError ("Variant or safe array index out of bounds") at 00424D38  stack trace API 004826E4 0040646C 77CC6A8B 77C90143 00424D38 00424E85 0042D0EE 0042D95F 0042A5C5 0067B32C 0067B2DD 0068EB35 006AAD8C 0067E504 006B13CC 00582CB5 

What way should I go to fix it?

Thanks.

#85 Re: mORMot 1 » Problem to run TSQLHttpServer via HTTPS? » 2014-09-18 17:47:34

Thanks a lot,

Is my problem on the server or on client?
You sent me a link to a tool...

Does it mean I should get public certificate from StartSSL to work via HTTPS with remote computer?
And when I produce a certificate with manual from your article I am able to ONLY use localcomputer connection.

Right?

And a point is I have no domain name on the my server but only IP-address...

Thanks.

#86 mORMot 1 » Problem to run TSQLHttpServer via HTTPS? » 2014-09-18 14:21:19

alexdmatveev
Replies: 2

Hello,

first time on the forum...
I am very new with mORMot. It looks like the stuff solving lot of my problems and must say THANK YOU.

My task is run TSQLHttpServer via HTTPS.

Thanks to blog article at

http://blog.synopse.info/post/2013/09/0 … -in-mORMot

I can run server on local computer. It works fine.


Next task is to run it on remote computer.
I have made all steps from the article on the server but when I run client I get exception (EWinHTTP): winhttp.dll error  12175 (A security error occured).


My steps:

1. 
makecert -sv SignRoot.pvk -cy authority -r signroot.cer -a
sha1 -n "CN=Dev Certification Authority" -ss my -sr localmachine

2. install Dev Certificate Authority

3.
makecert -iv SignRoot.pvk -ic signroot.cer -cy end -pe -n
CN="MY_SERVER_IP" -eku 1.3.6.1.5.5.7.3.1 -ss my -sr
localmachine -sky exchange -sp
"Microsoft RSA SChannel Cryptographic Provider" -sy 12

4.
netsh http add sslcert ipport=0.0.0.0:8843 certhash=0000000000003ed9cd0c315bbb6dc1c08da5e6 appid={00112233-4455-6677-8899-AABBCCDDEEFF}

5. Open port 8843 in Firewall...

6. Run client.exe on client computer

7. get the exception.

I not very guru with certificates and I suspect I have a mistake in steps... Please show me the way.

PS.
1. when I run the client.exe on the server everything works fine.
  aClient := TSQLHttpClientWinHTTP.Create(MY_SERVER_IP,8843,aModel, true);

2. telnet MY_SERVER_IP 8843 establishes a connection on the client computer.

Thanks a lot.

Board footer

Powered by FluxBB