Datasnap Delphi XE7 - ApplyUpdates(0) issue - delphi

I have a datasnap server app developed originally with XE5 that was working fine with a client app on a mobile tablet accessing a Firebird database on a server. I have recompiled the code with XE7. The only change I had to make to the code to compile without any errors was to add DataSnap.DSProviderDataModuleAdapter to the uses of the methods unit. Have replaced the server app on the server (stop service/uninstall/reinstall/start service) and now I can no longer insert/update records in the database on the server. Whenever I reach the line of code to ApplyUpdates(0) I get the following error:
Remote Error: Access violation at address 0093CB3F in module Snackerservice.exe. Read of address 00000000.
Retrieving data from the database to display on the tablet is not a problem so the connection is working.
If I change the server app back to the one developed under XE5......all works fine again. The other strange thing is that there are no problems with the XE7 compiled app when using 'localhost' to access a copy of the database on my development machine......only when accessing through an IP connection to a server.
Can someone please help me solve this frustrating problem.
Bill Zwirs
To hopefully make it a little clearer, here is a bit of code that causes the issue:
iLic := ServerMethodsClient.Get_Licences;
iDev := ServerMethodsClient.Get_NumDevices;
if (iDev < iLic) then
begin
iDevID := ServerMethodsClient.Get_NewDevID;
MobClientDM.DevicesClient.Open;
MobClientDM.DevicesClient.Insert;
MobClientDM.DevicesClientDEVID.AsInteger:= iDevID;
MobClientDM.DevicesClientMACADDRESS.AsString := sMacAddress;
MobClientDM.DevicesClient.Post;
if (MobClientDM.DevicesClient.ChangeCount > 0) then
MobClientDM.DevicesClient.ApplyUpdates(0); ....................Error occurs here
end;

Problem solved at last.
When I installed the server app on the server I also added Midas.dll to the directory which worked fine until I compiled with XE7. So I have now included MidasLib in the uses clause of the server app and removed the Midas.dll file from the install directory. Compiled and installed and all works good again.
Hope this helps others who might have a similar problem.
Bill Zwirs

Related

Connecting to local server via dBExpress

My D7 dBExpress project is supposed to connect to a local Interbase XE7 server.
It has the usual DBX setup: SqlConnection, SqlQuery, DataSetProvider and
ClientDataSet and does a simple 'select * from mytable'.
Last time I used it, it was working fine, but today when I ran it inside the IDE,
I get an exception as I call
ClientDataSet1.Open;
in my FormCreate (that call is the entire code of the project, btw). The
exception is an EDatabaseError with msg "No mapping for Error Code Found." and happens in TSqlConnection.DoConnect
That sounds familiar - I got that error myself one time, when I went back to an IB project after a few weeks.
It turned out that in the meantime something had sneaked Firebird onto my machine and it had hijacked the port IB usually listens on, and it was actually this FB server which was rejecting the connection, not the Interbase one!
Take a look under Services to see whether there is an FB server running. If there are, close it down (and start the IB server if not already running, of course). Then try your DBX project again.
Somewhere in the IB docs, I found something which seemed to suggest there was a way of getting FB and IB servers to coexist, but to avoid falling into a similar trap another time, I wrote a couple of batch files to shut down one of them and start the other. One is called "UseIB" and contains:
net stop "Firebird server - DefaultInstance"
net start "InterBase XE7 Server gds_db"
The other one, "UseFB" just does the opposite, of course.

delphi android black screen (unable to connect to database)

First time I tried on Delphi 10 (Seattle) to compile an android application and got an disappointment. Its a small test application using sqlite database. Database has only one table with few records (created just for testing purposes).
I link everything right (using firedac components) and in Delphi IDE my data shows. It also compiles without an error. The application also shows on my phone (HTC M8) but right after the splash screen, the screen goes black. Nothing !
If I disconnect the FDConnection and compile then the screen shows OK on the phone (without any data ofcourse). Then I tried this way :added a button on the form which I used to open the connection and the table manually but(when run) got a firedac error (unable to open database file).
What am I missing here ? Why cant the application open the database? Is there something else I must do ? Maybe trivial but I never did an android application before.
The mobile app cannot find the database in the phone's storage. You need to create one if it does not exist. This must be done before you can connecting to the database. Basically assign the database parameter to the FDConnection in the BeforeConnect event. also ensure that FDConnection's OpenMode = CreateUTF8
procedure TMainDataModule.FDConnection1BeforeConnect(Sender: TObject);
begin
{$IFDEF ANDROID}
FDConnection1.Params.Values['Database'] := TPath.Combine(TPath.GetDocumentsPath, 'mydatabase.sdb');
{$ENDIF}
end;
After googling for some time I found the information here
mobile tutorial
that :
"The database file is not available on your mobile device unless you
copy it to the mobile device or create it on the fly."
So basically, I can not connect to my existing database on the PC from my phone.

How to solve exception error when consuming Microsoft Sql Server Reporting Services (SSRS) 2005 from Delphi XE7

I am trying to create a sample Delphi XE7 desktop app that will connect to SSRS 2005 web service but every time I try to call LoadReport web method, the following error is shown:
This is what I have done so far:
Create a desktop app.
Import WSDL for ReportExecution2005 and ReportService2005.
Create a button that call the web service based on the code shown
here. The web service locations as well as report are hardcoded for
simplicity purposes.
This is the code snippet from the link:
HTExec := tHttpRio.Create(nil);
rsExec := GetReportExecutionServiceSoap(False, ExecURL, HTExec);
// Load the selected report.
LRParams.Report := 'ReportName';
LoadParamsResponse := rsExec.LoadReport(LRParams); //here it fails
Note: I have already created a .NET win form app (VS2010 and VS2013) that consumes this web service without any issues, thus I know the web service and report to render are working OK. Sadly our requirements is for a Delphi solution, My educated guess is that the WSDL importer generated code is not correct and somebody out there may have come across with this issue before and know how to solve it.
I did a quick search for "http://schemas.microsoft.com/sqlserver/2005/06/30/reporting/reportingservices/LoadReport"
and found this.
If it applies to you as well, it may be the case you're calling the service on an incorrect URL, use the one with ReportExecution2005.asmxin it, not ReportService2005.asmx
(There's a lot more here)
To find out differences between the Delphi version and the working version, use a HTTP proxy (Fiddler2) to capture the SOAP HTTP traffic in both setups.
If you have no access to the working environment, use SoapUI to create SOAP requests.

Delphi Indy: cannot load SSL libraries first time. A retry works

I'm using the latest indy snapshot (installed yesterday) and newest SSL libraries.
When trying to send a mail using idSMTP, the first time the component connects, I get an exception:
Could't load the SSL libraries
. Funny thing is, a retry works always. Debugging I found that the problem is in IsSSLOpenSSLHeader, function Loaad: boolean, line
#OpenSSL_add_all_algorithms := LoadFunctionCLib('OpenSSL_add_all_algorithms');
Why does it fail the first time and not the second is still a mystery to me, but before I go on investigating I would like to as if anybody knows the solution to this problem.
The code you are using is NOT the latest snapshot. That bug was fixed a couple of weeks ago. The line you quote is NOT in the latest code, it has been replaced with the following:
fn_OPENSSL_add_all_algorithms_noconf = 'OPENSSL_add_all_algorithms_noconf';
fn_OpenSSL_add_all_algorithms = 'OpenSSL_add_all_algorithms';
#OpenSSL_add_all_algorithms := LoadOldCLib(fn_OpenSSL_add_all_algorithms, fn_OPENSSL_add_all_algorithms_noconf);
I'm using Delphi XE-1 on Win 7/64, with the SSL and Indy that are installed by default. This week I had to do some work with SMTP and SSL, and I ran into the same problem you reported. Our application is somewhat complex and is already live and deployed in several locations and it uses Indy at several points in the code, so installing a newer version of Indy and rebuilding etc, was not very palatable.
Since the problem only arises on the first pass, I traced through some of the code and came up with this simple, painless workaround:
smtpClient.connect;
smtpClient.disconnect;
smtpClient.connect;
if not smtpClient.Authenticate then
raise ...
smtpClient.Send(msg);
Once you call connnect and then disconnect, the SSL libraries are loaded, so on your second call to connect you're good to go.
Works fine.

Delphi datasnap with Apache

Has anyone ever managed to get a datasnap system (BDS2006) running in apache?
I have set up my apache to acceot cinnections to the httpsvr.dll as per this article
http://www.distribucon.com/blog/HTTPSRVRWithApache.aspx
.
My TWebConnection objects connects perfectly but as soon as my clientDataset becomes active I get an error saying "cannot load library/dll"
I assume it is a problem loading the com server into memory? Any Ideas?
(I am trying to get away without having to change my com server, so that i can use it on both IIS and apache installations.
If your application is using clientdataset, it also needs midas.dll.
You should deploy midas.dll or your application uses block should contain midaslib unit.

Resources