Hello Devart,
connections via ODAC go without problems, but I need MySQL
I am looking for a solution to use UniDAC or (ODAC and MyDAC), but I absolutely need to use the principle, as in the MIDAS example.
I've been using it with ODAC for about 10 years now. The fastest and most stable solution.
I tried 2 versions MyDAC, the 9th and 10th (1 version from my colleague for test and 1 version trial)
i took a MySQL database
added a new user
added a new schema
added a new EMP table
next, i go to XE 10 Seattle (and XE 10 Berlin)
started the SERVER from THE PATH - Devart\MyDAC for RAD Studio 10\Demos\Miscellaneous\Midas
check connect SERVER with database = OK.
started the CLIENT from THE PATH - Devart\MyDAC for RAD Studio 10\Demos\Miscellaneous\Midas
check connect CLIENT with SERVER =
(Access violation at address 0067CE4F in module 'Client.exe'. Read of address 00000000.)
!!! the error is normal, something didn't come from somewhere, or something wasn't created. But it is impossible to find the source of the error.
I assume that the provider on the server side does not give the results . !!!
I'm looking at the code from the sample client. (nothing special)
procedure TfmClient.btOpenClick(Sender: TObject);
begin
if edEmpNo.Text <> '' then
ClientDataSet.Params.ParamByName('EmpNo').AsInteger:= StrToInt(edEmpNo.Text);
ClientDataSet.Open; - ERROR
edEmpNo.Text:= IntToStr(ClientDataSet.Params.ParamByName('EmpNo').AsInteger);
end;
I thought that it's not enough to just send variables, create a method on the server, and execute it on the client
procedure TfmClient.btOpenClick(Sender: TObject);
var
str_sql, sout : string;
begin
str_sql:='select * from table1';
ClientDataSet.Close;
SocketConnection1.AppServer.MyMethod(str_sql,sout);
the request goes to the server and is executed. query result, number of records in the table (sout)
ClientDataSet.active := true; - ERROR
end;
P.S.
the bundle of components RemoteServer, ClientDataSet remained the same, wie in DEMO
Thanks a Lot for your answer.
MyDAC 10 for XE 10 (Demos=Midas) ACCESS VIOLATION
Re: MyDAC 10 for XE 10 (Demos=Midas) ACCESS VIOLATION
When investigating, we found out that this error is not related to MyDAC functionality, but to midas.dll. The error occurs if the old version of midas.dll is used. You can check it by executing the following code:
To solve the issue, you should use a correct version of midas.dll.
Code: Select all
program TestMidas;
{$APPTYPE CONSOLE}
uses
SysUtils,
Uni,
DB,
DBClient;
var
DataSet: TClientDataSet;
F_INT: TField;
FieldDef: TFieldDef;
begin
DataSet := TClientDataSet.Create(nil);;
try
FieldDef := DataSet.FieldDefs.AddFieldDef();
FieldDef.Name := 'F_INT';
FieldDef.DataType := ftInteger;
F_INT := TIntegerField.Create(DataSet);
F_INT.FieldName := 'F_INT';
F_INT.Dataset := DataSet;
try
DataSet.CreateDataset;
except
on E: Exception do
Writeln(E.Message);
end;
finally
DataSet.Free;
Writeln('Ok');
Readln;
end;
end.