You are not logged in.
Pages: 1
My real goal is to connect a databaseserver and get data remotely.
My own first example is working (both Delphi/Lazarus). I created a SQLite database and put some data in it.
My own second example connects to a database server (MariaDB 5.5). I looked in the manual and took the code from chapter 8.1 (Lazarus 1.6Rc1/ FPC 3.0):
unit Unit1;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
SynCommons, mORMot, mORMotSQLite3, SynSQLite3Static,
mORMotDB, synDB,
SynDBZeos, // needed for Zeos
ZDbcMySql; // needed for Zeos
type
{ TForm1 }
TForm1 = class(TForm)
Button1: TButton;
Memo1: TMemo;
procedure Button1Click(Sender: TObject);
private
procedure UseProps(Props: TSQLDBConnectionProperties);
{ private declarations }
public
{ public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.lfm}
{ TForm1 }
procedure TForm1.Button1Click(Sender: TObject);
var Props: TSQLDBConnectionProperties;
Server : string;
begin
Server := 'zdbc:mysql://192.168.x.x:3306/test?username=xxx;password=xxx';
Props := TSQLDBZEOSConnectionProperties.Create(Server,'test','','');
try
UseProps(Props);
finally
Props.Free;
end;
end;
procedure TForm1.UseProps(Props: TSQLDBConnectionProperties);
var I: ISQLDBRows;
begin
I := Props.Execute('select * from gebruikers where id = ?',['1']);
showmessage(I.Column['login']);
end;
end.
Examples compiles without problem, but when I want to get data from the database, I get this error:
Project voorbeeld2 raised exception class 'External: SIGSEGV'.
In file 'C:\lazarus16RC1\components\zeoslib714\src\plain\ZPlainMySqlDriver.pas' at line 1240:
Result := PMYSQL_ROW(ROW)[Offset];
It looks the database will not be connected. Is my code wrong or do I have to do something else?
Offline
No one will help a beginner who want's to learn mORMot framework?
Offline
Hello,
I think you forgot the library driver.
You can find more informations here : http://synopse.info/files/html/Synopse% … #TITLE_182
Last edited by Thomas-Acia (2016-01-12 08:35:32)
Delphi 2010 - Delphi XE5 (x64 Apps) - CodeTyphon - Typhon IDE v 5.7 - FPC 3.1.1 - mORMot 1.18
Windows 7 - VirtualBox : Linux Debian 8.5 Jessie 32 bits
Offline
Pages: 1