EXHIBIT 10.1

                            DEBT EXTENSION AGREEMENT

This Agreement is made and entered into as of this 1st day of November 2004, by
and between G. S. Beckwith Gilbert, of 35 Vista Drive, Greenwich, Connecticut
06830 ("LENDER"), and MEGADATA CORPORATION, a New York corporation, with its
principal place of business at 35 Orville Drive, Bohemia, New York 11716
("BORROWER" or "MEGADATA"):

                                   WITNESSETH

            WHEREAS, Megadata has issued promissory notes to Lender for value
received;

            WHEREAS, the total amount due and owing under the promissory notes
and accrued interest as of November 1, 2004 is $8,939,880; and
<PAGE>

            WHEREAS, Lender and Megadata desire to modify certain terms and
conditions of the outstanding promissory notes as of the date of this Agreement
and issue a Replacement promissory note for value received upon the terms and
conditions set forth herein.

            NOW, THEREFORE, in consideration of the foregoing and the agreements
contained herein, the parties hereby agree as follows:

1. MODIFICATION OF PREVIOUS NOTES:

            The outstanding promissory notes previously issued to Lender plus
accrued interest totaling $8,939,880 in aggregate principal amount shall be
modified as set forth herein.

2. ISSUANCE AND TERMS OF REPLACEMENT NOTE:

            For value received, Megadata shall issue a Replacement Note (the
"REPLACEMENT NOTE") to Lender in the aggregate principal amount of $8,939,880.
The Replacement Note will be in the form attached as Exhibit A hereto.

            TERM. The principal amount of the Replacement Note, together with
            any and all accrued and unpaid interest thereon, shall be paid in
            full on November 1, 2005.

            INTEREST. The Replacement Note shall bear interest on the unpaid
            principal amount, from the date of issuance until paid in full at
            the rate of 4.5% per annum.

3. MISCELLANEOUS.

            AMENDMENT AND MODIFICATION. This Agreement may be amended, modified
            and supplemented only by a written instrument signed by all of the
            parties hereto expressly stating that such instrument is intended to
            amend, modify or supplement this Agreement.

            ENTIRE AGREEMENT. This Agreement contains the entire agreement
            between the parties hereto with respect to the subject matter hereof
            and supersedes all prior agreements and understandings, oral or
            written, with respect to such matters.

            SEVERABILITY. If any provision of this Agreement shall be determined
            to be invalid or unenforceable under law, such determination shall
            not affect the validity or enforceability of the remaining
            provisions of this Agreement.

            GOVERNING LAW; JURISDICTION. This Agreement shall be governed by and
            construed in accordance with the laws of the State of New York,
            without regard to the conflicts of law rules of such state.

            COUNTERPARTS. This Agreement may be executed in one or more
            counterparts, each of which shall be deemed an original, and all of
            which shall constitute one and the same agreement and shall become
            effective when one or more counterparts have been signed by each of
            the parties and delivered to the other party, it being understood
            that both parties need not sign the same counterpart.
<PAGE>

IN WITNESS WHEREOF, the parties hereto have executed this Agreement as of the
day and year written above.

                                MEGADATA CORPORATION
                                35 Orville Drive
                                Bohemia, New York 11716


                                BY: /S/ JAMES T. BARRY
                                --------------------------
                                    NAME: JAMES T. BARRY
                                    TITLE: PRESIDENT AND CHIEF EXECUTIVE OFFICER


                                BY: /S/ JEFFREY P. DEVANEY
                                --------------------------
                                    NAME: JEFFREY P. DEVANEY
                                    TITLE: CHIEF FINANCIAL OFFICER


                                LENDER
                                G.S. Beckwith Gilbert
                                35 Vista Drive
                                Greenwich, Connecticut 06830


                                BY: /S/ G.S. BECKWITH GILBERT
                                -----------------------------
                                    NAME: G.S. BECKWITH GILBERT
<PAGE>

                                                                       EXHIBIT A

                             SECURED PROMISSORY NOTE

$8,939,880                                                New York, New York
                                                          AS OF NOVEMBER 1, 2004

            For value received, MEGADATA CORPORATION, a New York corporation
(hereinafter referred to as "BORROWER"), hereby unconditionally PROMISES TO PAY
to the order of G.S. Beckwith Gilbert ("LENDER"), or his permitted assigns, to
an account designated by Lender, in lawful money of the United States of America
and in immediately available funds, the principal sum of eight million nine
hundred thirty-nine thousand and eight hundred eighty dollars ($8,939,880)
together with interest on the unpaid principal amount of this note at the rate
of 4.5% per annum.

            The principal amount evidenced hereby will be repaid in full on
November 1, 2005. All accrued and unpaid interest hereunder as of November 1,
2005, shall be payable on such date.

            Notwithstanding the foregoing, the principal amount of the
indebtedness evidenced hereby together with all accrued interest shall be
immediately due and payable upon written notice to Borrower from Lender upon the
happening of any of the following Events of Default:

            (a) Any representation or warranty in the Securities Purchase
      Agreement, dated September 18, 1996, between Borrower and Lender shall be
      untrue or incorrect in any material respect;

            (b) Any of the assets of Borrower shall be attached, seized, levied
      upon or subjected to a writ or distress warrant, or come within the
      possession of any receiver, trustee, custodian or assignee for the benefit
      of creditors of Borrower and shall remain unstayed or undismissed for
      thirty (30) consecutive days; or any person other than Borrower shall
      apply for the appointment of a receiver, trustee or custodian for any of
      the assets of Borrower and shall remain unstayed or undismissed for thirty
      (30) consecutive days; or Borrower shall have concealed, removed or
      permitted to be concealed or removed, any part of its property, with the
      intent to hinder, delay or defraud its creditors or any of them or made or
      suffered a transfer of any of its property or the incurring of an
      obligation which may be fraudulent under any bankruptcy, fraudulent
      conveyance or other similar law;

            (c) A case or proceeding shall have been commenced against Borrower
      in a court having competent jurisdiction seeking a decree or order in
      respect of Borrower (i) under title 11 of the United States Code, as now
      constituted or hereafter amended, or any other applicable federal, state
      or foreign bankruptcy or other similar law, (ii) appointing a custodian,
      receiver, liquidator, assignee, trustee or sequestrator (or similar
      official) of Borrower or of any substantial part of its properties, or
      (iii) ordering the winding-up or liquidation of the affairs of Borrower
      and such case or proceeding shall remain undismissed or unstayed for
      thirty (30) consecutive days or such court shall enter a decree or order
      granting the relief sought in such case or proceeding;
<PAGE>

            (d) Borrower shall (i) file a petition seeking relief under title 11
      of the United States Code, as now constituted or hereafter amended, or any
      other applicable federal, state or foreign bankruptcy or other similar
      law, (ii) consent to the institution of proceedings thereunder or to the
      filing of any such petition or to the appointment of or taking possession
      by a custodian, receiver, liquidator, assignee, trustee or sequestrator
      (or similar official) of Borrower or of any substantial part of its
      properties, (iii) fail generally to pay its debts as such debts become
      due, or (iv) take any corporate action in furtherance of any such action;

            (e) Final judgment or judgments (after the expiration of all times
      to appeal therefrom) for the payment of money in excess of $100,000 in the
      aggregate shall be rendered against Borrower and the same shall not be
      vacated, stayed, bonded, paid or discharged for a period of thirty (30)
      days; or

            (f) Any other event shall have occurred which would have a material
      adverse effect on Borrower or its assets or financial condition in
      Lender's reasonable judgment and Lender shall have given Borrower at least
      twenty (20) days notice thereof.

            As security for any and all liabilities of the Borrower to Lender,
now existing or hereafter arising hereunder, or otherwise, Lender is hereby
given a lien upon and a security interest in any and all moneys or other
property (i.e., goods and merchandise, as well as any and all documents relative
thereto; also, funds, securities, chooses in action and any and all other forms
of property whether real, personal or mixed, and any right, title or interest of
the Borrower therein or thereto), and/or the proceeds thereof, including
(without limitation of the foregoing) that in safekeeping or in which Borrower
may have any interest. In the event of the happening of any one or more Events
of Default, Lender shall have all of the rights and remedies provided to a
secured party by the Uniform Commercial Code in effect in New York State at that
time and, in addition thereto, the Borrower further agrees that (1) in the event
that notice is necessary, written notice delivered to the Borrower at its
principal executive offices ten business days prior to the date of public sale
of the property subject to the lien and security interest created herein or
prior to the date after which private sale or any other disposition of said
property will be made shall constitute reasonable notice, but notice given in
any other reasonable manner or at any other reasonable time shall be sufficient,
(2) in the event of sale or other disposition of such property, Lender may apply
the proceeds of any such sale or disposition to the satisfaction of Lenders
reasonable attorneys' fees, legal expenses and other costs and expenses incurred
in connection with the retaking, holding, preparing for sale, and selling of the
property, and (3) without precluding any other methods of sale, the sale of
property shall have been made in a commercially reasonable manner if conducted
in conformity with reasonable commercial practices of banks disposing of similar
property.

            Demand, presentment, protest and notice of nonpayment and protest
are hereby waived by Borrower.
<PAGE>

            This Note has been executed, delivered and accepted in the State of
New York and shall be interpreted, governed by, and construed in accordance
with, the laws of the State of New York.

                                          MEGADATA CORPORATION


                                          BY: /S/ JEFFREY P. DEVANEY
                                          --------------------------
                                              JEFFREY P. DEVANEY
                                              TITLE: CHIEF FINANCIAL OFFICER