是否可能在数据元件服务器和客户之间分享数据库链接?
我希望在客户中执行动态的q,并取得成果。
是否可能在数据元件服务器和客户之间分享数据库链接?
我希望在客户中执行动态的q,并取得成果。
I found 2 ways to execute dynamic sql in client side
(1) 使用DbxConnection(dbExpress)
// Server code
function TServerMethods1.GetConnection: TDbxConnection;
begin
Result := DBConnection.DBXConnection;
end;
//Client code
dbxConnection := ServerMethods.GetConnection;
command := dbxConnection.CreateCommand;
command.Text := SELECT COUNT(1) FROM clients WHERE name LIKE :name ;
param := com.CreateParameter;
param.Name := name ;
param.DataType := TDBXDataTypes.WideStringType;
param.Value.SetString( %name% );
command.Parameters.AddParameter(param);
reader := command.ExecuteQuery;
reader.Next; // to Fetch row
ShowMessage(reader.Value[0].AsString);
2) 利用Set后裔
www.un.org/spanish/ecosoc 服务器部件
服务器梯度班必须是TDSServer Module后代
www.un.org/spanish/ecosoc 客户部分
D. 执行询问守则
CDS.Close; // TClientDataSet
CDS.CommandText := SELECT COUNT(*) FROM clients WHERE name LIKE :name ;
CDS.Params.ParamByName( name ).AsString := %name% ;
CDS.Open;
ShowMessage(CDS.Fields[0].AsString);
www.un.org/spanish/ecosoc 服务器边代码:
MainMethods.pas
TMainMethods = class(TDSServerModule)
PgQuery: TPgQuery;
PgQueryProvider: TDataSetProvider;
PgConnection: TPgConnection;
end;
MainMethods.dfm
object MainMethods: TMainMethods
Height = 248
Width = 440
object PgConnection: TPgConnection
Left = 200
Top = 32
...
end
object PgQuery: TPgQuery
Connection: PgConnection
Left = 32
Top = 24
end
object PgQueryProvider: TDataSetProvider
DataSet = PgQuery
Options = [poAllowCommandText, poUseQuoteChar]
Left = 120
Top = 24
end
end
www.un.org/spanish/ecosoc 客户代码:
客户。
TVerusClient = class(TDataModule)
dbxVerusConnection: TSQLConnection;
dbxSqlConnectionProvider: TDSProviderConnection;
cdsSqlDataSet: TClientDataSet;
end;
客户dfm
object VerusClient: TVerusClient
Height = 271
Width = 415
object dbxVerusConnection: TSQLConnection
DriverName = DataSnap
LoginPrompt = False
...
end
object dbxSqlConnectionProvider: TDSProviderConnection
ServerClassName = TMainMethods
SQLConnection = dbxVerusConnection
Left = 176
Top = 32
end
object cdsSqlDataSet: TClientDataSet
ProviderName = PgQueryProvider
RemoteServer = dbxSqlConnectionProvider
Left = 176
Top = 104
end
end
数据Snap(Multi-Tier)申请的主要目标是安全。 你们不能以遥远的方式直接分享物体(连接、资源),但你可以改变会议数据集。
// Server Code
procedure TMyServerMethod.ChangeSQL(ASQL:string); // insecure
begin
AdoQuery1.Active:=false;
AdoQuery1.SQL.Text:=ASQL; // AdoQuery,DbxExpress,UniDAC,AnyDac,...
AdoQuery1.Active:=true;
end;
I am investigating moving a thick client SQL based Delphi application to Multi Tier thin clients, and have been looking at using Datasnap in Delphi 2010. I have worked through the White Paper written ...
I need to implement a small, standalone web server that will be used to process REST API calls, using Delphi 2010. There seem to be two easy choices available with Delphi 2010 out of the box: Indy s ...
Someone can tell me how to get the client ip of a connected session from the server side?. Thanks
I m often getting this exception "EDBClient: Mismatch in datapacket" when I call ApplyUpdates on a particular ClientDataSet. I can t reproduce on my machine and I think it started after upgrading to ...
I have done a search on Google for applications writen with Datasnap and didn t find much information. What well know applications are written in Datasnap 2009 / 2010 ? Is using Datasnap 2010 a ...
I m trying to use Daniele Teti s Datasnap Filters Compendiun (the cipher ones) without success. Someone have a how to for cipher filters for Datasnap? Regards.
I am building a small multipliplayer which will need the following: it must be written in Delphi must support Internet connection (not only LAN) work over HTTP support some encryption of the packets (...
i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...