The greatest advantage of mysql versus mssql is that mysql is free!

Other advantages of mysql over mssql is that mysql can run on linux,
windows, mac os, novel etc

 

Don't get me wrong, MSSQL is very robust and offers a whole load of features
but where I come from (Kenya) its not every day that someone spends tens of
thousands of dollars for software; downsides of MSSQL is (for me at least)
1. is cost, 2. heavy protocol 3. (this is very personal) its not open by
nature. I prefer seeing the lines of code that run my systems (including the
database) which helps me optimize my software for the particular task.

 

I wont say one is better than the other; All I can say that depending on the
task at hand; one can be better than the other.

 

I've uploaded on the files section (3tier.rar) that is a very simple 3 tier
application; the client sends a command to the server then the server does
the database stuff and replies to the client; it returns which class every
student is in. note that the client doesn't do any SQL; that's done by the
application server. It uses Delphi and indy10 (ok its not really connecting
to a database; but if you read the source that's just a line of code . in
fact it can connect to virtually any back end)

 

It's a far cry from a perfect app; no error handling; no compression to
further make the protocol more smaller, no reconnection but it's a good
start. Whoops I cant upload files so here are the dumps of the files

 

<<< SERVER >>>

 

Unit1.dfm

 

object Form1: TForm1

  Left = 192

  Top = 135

  Width = 696

  Height = 480

  Caption = 'Form1'

  Color = clBtnFace

  Font.Charset = DEFAULT_CHARSET

  Font.Color = clWindowText

  Font.Height = -11

  Font.Name = 'MS Sans Serif'

  Font.Style = []

  OldCreateOrder = False

  OnCreate = FormCreate

  OnDestroy = FormDestroy

  PixelsPerInch = 96

  TextHeight = 13

  object IdTCPServer1: TIdTCPServer

    Bindings = <>

    DefaultPort = 4566

    OnExecute = IdTCPServer1Execute

    Left = 72

    Top = 80

  end

end

 

Unit1.pas

unit Unit1;

 

interface

 

uses

  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

  Dialogs, IdBaseComponent, IdComponent, IdTCPServer, IdContext,
idIOHandler;

 

type

  TForm1 = class(TForm)

    IdTCPServer1: TIdTCPServer;

    procedure FormCreate(Sender: TObject);

    procedure FormDestroy(Sender: TObject);

    procedure IdTCPServer1Execute(AContext: TIdContext);

  private

    { Private declarations }

    procedure getname(IOHandler : TidIOHandler);

  public

    { Public declarations }

  end;

 

var

  Form1: TForm1;

 

implementation

 

{$R *.dfm}

 

procedure TForm1.FormCreate(Sender: TObject);

begin

  IdTCPServer1.Active:=True;

end;

 

procedure TForm1.FormDestroy(Sender: TObject);

begin

  IdTCPServer1.Active:=false;

end;

 

procedure TForm1.getname(IOHandler: TidIOHandler);

var

  I: Integer;

  nme,res : string;

  chr : char;

begin

  //WARNING : THIS PROCEDURE IS THREDED - KEEP IT THREAD SAFE - CHRIS

  // MANY CLIENTS CAN CALL THIS ATT THE SAME TIME WHEN MANY CLIENTS ARE
CONNECTED TO THIS SERVER

 

  chr:=#1;

  while chr<>#0 do

  begin

    chr:=IOHandler.ReadChar;

    if chr<>#0 then

      nme:=nme+chr;

  end;    // while

 

  // we now have the name

 

  // we can do whatever SQL we want here for example

 

  // ADOQuery1.SQL.Text:='select class from mytable where name =
'+quotedstr(nme)

  // ADOQUery1.open;

  // res:=ADOQuery1.fieldbyname('class').asstring

 

  // but for now - the easy way

  res:='the class from the server!';

 

  for I := 1 to length(res) do    // Iterate

    IOHandler.write(res[i]); // client waiting for the class; send it to
them

 

  IOHandler.write(#0); // to show client thats the end of the class

 

  // we are done!

 

end;

 

procedure TForm1.IdTCPServer1Execute(AContext: TIdContext);

begin

  //WARNING : THIS PROCEDURE IS THREDED - KEEP IT THREAD SAFE - CHRIS

  // MANY CLIENTS CAN CALL THIS ATT THE SAME TIME WHEN MANY CLIENTS ARE
CONNECTED TO THIS SERVER

 

  with AContext.Connection.IOHandler do

  begin

    case ReadChar of    //

      'A' : getname(AContext.Connection.IOHandler); // aha! he wants a name

      'B' : ; // do some other stuff;

      'C' : ; // do even more stuff;

      'D' : Application.Terminate // kill application server (for some
reason):

    end;    // case

 

 

  end;    // with

end;

 

end.

 

Project2.dpr

 

program Project2;

 

uses

  Forms,

  Unit1 in 'Unit1.pas' {Form1};

 

{$R *.res}

 

begin

  Application.Initialize;

  Application.CreateForm(TForm1, Form1);

  Application.Run;

end.

 

 

<< CLIENT >>

 

Unit1.dfm

 

object Form1: TForm1

  Left = 192

  Top = 135

  Width = 696

  Height = 480

  Caption = 'Form1'

  Color = clBtnFace

  Font.Charset = DEFAULT_CHARSET

  Font.Color = clWindowText

  Font.Height = -11

  Font.Name = 'MS Sans Serif'

  Font.Style = []

  OldCreateOrder = False

  OnCreate = FormCreate

  OnDestroy = FormDestroy

  PixelsPerInch = 96

  TextHeight = 13

  object Label1: TLabel

    Left = 80

    Top = 16

    Width = 28

    Height = 13

    Caption = 'Name'

  end

  object Button1: TButton

    Left = 80

    Top = 72

    Width = 75

    Height = 25

    Caption = 'Get Age'

    TabOrder = 0

    OnClick = Button1Click

  end

  object Edit1: TEdit

    Left = 80

    Top = 40

    Width = 121

    Height = 21

    TabOrder = 1

  end

  object IdTCPClient1: TIdTCPClient

    ConnectTimeout = 0

    Host = '127.0.0.1'

    IPVersion = Id_IPv4

    Port = 4566

    ReadTimeout = 0

    Left = 192

    Top = 80

  end

end

 

unit1.pas

 

unit Unit1;

 

interface

 

uses

  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

  Dialogs, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient,

  StdCtrls;

 

type

  TForm1 = class(TForm)

    Button1: TButton;

    Edit1: TEdit;

    Label1: TLabel;

    IdTCPClient1: TIdTCPClient;

    procedure Button1Click(Sender: TObject);

    procedure FormCreate(Sender: TObject);

    procedure FormDestroy(Sender: TObject);

  private

    { Private declarations }

  public

    { Public declarations }

  end;

 

var

  Form1: TForm1;

 

implementation

 

// Protocol is simple: if you want to get the class of a person send
A<name>#0

// the server will return <class>#0

 

{$R *.dfm}

 

procedure TForm1.Button1Click(Sender: TObject);

var

  cls : string;

  chr : char;

 

begin

  cls:='';

  IdTCPClient1.IOHandler.Write('A'+Edit1.Text+#0); // A = get AGE followed
by name then null to show end of name

  chr:=#1;

  while chr<>#0 do

  begin

    chr:=IdTCPClient1.IOHandler.ReadChar;

    if chr<>#0 then

      cls:=cls+chr;

  end;    // while

 

  ShowMessage(cls);

end;

 

procedure TForm1.FormCreate(Sender: TObject);

begin

  idtcpclient1.connect;

end;

 

procedure TForm1.FormDestroy(Sender: TObject);

begin

  IdTCPClient1.Disconnect;

end;

 

end.

 

Project1.dpr

 

program Project1;

 

uses

  Forms,

  Unit1 in 'Unit1.pas' {Form1};

 

{$R *.res}

 

begin

  Application.Initialize;

  Application.CreateForm(TForm1, Form1);

  Application.Run;

end.

 

 

 

 

PO Box 627 00502 Karen, 
Nairobi, Kenya.
Mobile: +254 722 996532
Fixed: +254 20 2050859
[EMAIL PROTECTED] 

  _____  

From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of Marselle
Sent: 01 May 2008 4:08 p
To: [email protected]
Subject: RE: [delphi-en] Mssql Locking causes Delphi App to crash

 

Chris.. I totally agree... perhaps you may want to send him a small example
here on how to set a nTier environment.. also is MySQL lic cost very
much...? you may want to add some pro's and cons about that as well

--- On Thu, 5/1/08, Chris <[EMAIL PROTECTED] <mailto:jangita%40jangita.com>
com> wrote:
From: Chris <[EMAIL PROTECTED] <mailto:jangita%40jangita.com> com>
Subject: RE: [delphi-en] Mssql Locking causes Delphi App to crash
To: [EMAIL PROTECTED] <mailto:delphi-en%40yahoogroups.com> ps.com
Date: Thursday, May 1, 2008, 7:58 AM

Hi,

I have been through the same thing; sadly to say the only way I solved it

was to change my database backend to mysql from mssql; My Delphi application

is currently running in 700 locations countrywide; so the database server is

hit with about 5 requests per second with over 14,000 simultaneous

connections and its all _smooth_.

Your case seems to be that you are connecting MSSQL clients via a wan

connection which I can guess is not as fast as a LAN connection; I don't

think the problem is the database backend or Delphi; its mysql. Not a

problem per-say; its just that MSSQL protocol over a network is "chatty" and

is quite heavy - not recommended to be used over the internet and other wan

networks where speed doesn't come easy.

You might find that the application is exceptionally slow and your ADO

connections are timing out over slow networks; I suggest you use a database

backend that is network friendly and has a very light protocol. Or build a 3

tier system where the clients run an application that communicate the bare

nessessities to an application server which translates into the commands

that will hit the database.

Hope this helps

PO Box 627 00502 Karen, 

Nairobi, Kenya.

Mobile: +254 722 996532

Fixed: +254 20 2050859

[EMAIL PROTECTED] com 

_____ 

From: [EMAIL PROTECTED] ps.com [mailto:[EMAIL PROTECTED] ps.com] On
Behalf

Of edsynergy

Sent: 30 April 2008 6:41 p

To: [EMAIL PROTECTED] ps.com

Subject: [delphi-en] Mssql Locking causes Delphi App to crash

I have just gone live with a delphi app which has mssql at the backend.

Under load testing it has been well behaved. It is now installed in a

large health organisation with users coming in over wan connections to

the sql server. For periods the system performs well and then it

crashes. All other users of the system also crash out as well. The

application will still launch and they can even log on but meaningful

work is not possible.

I have reviewed the code and cannot find an issue there. It would be

easy for me to blame the network/ old pc's ( and not doubt the clients

IT support could point a the software) but I rather get to the bottom

of it. The sql server is not on a dedicated server. It is one of

these new fangled virtual servers and I wonder if this is the issue.

After all it is only using the chunk of memory allocated to it by the

real server it is on. Would this impact on performance. Any views

would be much appreciated.

[Non-text portions of this message have been removed]











__________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile. Try it now. http://mobile.
<http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ>
yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

 



[Non-text portions of this message have been removed]

Reply via email to