Delphi-Kylix
  Home arrow Delphi-Kylix arrow Page 3 - Using Delphi with MySQL
Dev Articles Forums 
ADO.NET  
Apache  
ASP  
ASP.NET  
C#  
C++  
ColdFusion  
COM/COM+  
Delphi-Kylix  
Design Usability  
Development Cycles  
DHTML  
Embedded Tools  
Flash  
Graphic Design  
HTML  
IIS  
Interviews  
Java  
JavaScript  
MySQL  
Oracle  
Photoshop  
PHP  
Reviews  
Ruby-on-Rails  
SQL  
SQL Server  
Style Sheets  
VB.Net  
Visual Basic  
Web Authoring  
Web Services  
Web Standards  
XML  
Dedicated Servers  
Moblin 
JMSL Numerical Library 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
DELPHI-KYLIX

Using Delphi with MySQL
By: Leidago
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 16
    2006-10-25

    Table of Contents:
  • Using Delphi with MySQL
  • Required Tools
  • Setting up the Connector
  • The Application
  • Form Two

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Using Delphi with MySQL - Setting up the Connector


    (Page 3 of 5 )

    So start up the MyCC application that you just installed. It should look something like this when opened:

    Now right click on the Database header and select new Database:

    and type in "publish." The database name should now appear on the list of databases. Click on it and then go to the tool bar and find the button that says "SQL." Click on it and a new window should appear. Add the following SQL:

    CREATE TABLE `articles` (
      `aID` int(4) NOT NULL auto_increment,
      `auth` varchar(100) NOT NULL default '',
      `title` varchar(100) NOT NULL default '',
      `article_body` text NOT NULL,
      `date_published` date NOT NULL default '0000-00-00',
      PRIMARY KEY  (`aID`)
    )
    INSERT INTO `articles` VALUES (1, 'Leidago !Noabeb', 'Using
    Delphi with MYSQL', 'It is really not that hard to do. Hey, if i
    can do it....', '2006-07-09');
    INSERT INTO `articles` VALUES (2, 'John Doe', 'Yes!', 'Than you
    can do it!!!', '2011-07-20');
    INSERT INTO `articles` VALUES (1, 'Joe Blogg', 'It is a breeze...',
    'It really is not that hard to do. Just give it a go....', '2006-
    07-09');
    INSERT INTO `articles` VALUES (2, 'John Doe', 'Patience', 'That's
    all you need to do it!!!', '2011-07-20');

    You should now have a database called publish and a table called articles with a couple of sample records in it. Now we need to create a connection between the database and the ODBC connector. Close down MyCC, go to the control panel, click on "Performance and maintenance," then click on "Administration tools." You should now see the screen below:

    Now, click on the link that says "Data Source/ODBC." You should now have the following screen:

    Click on "add." This will start the process of creating a new database connection. You should see the following window:

    This window lists all the drivers on your system. Find the ODBC connector driver and select "finish." You should see the following window:

    Try to fill in the details of the screen as they are on the example above.

    There are four important fields that might differ from my details:

    1. Server - If you are on a network, your host name might be different; check with whoever controls the network.
    2.  User - Usually the "root."
    3.  Password -  Usually empty, but you can create a username and password in the MyCC interface.
    4.  Database - Just select from the dropdown list.

    Finally, click the "test" button and check that everything is okay. If not, the problem is most likely to be the server, password or user name, so check them all. Then click "ok" and you should see the following screen with your new connection listed:

    That's it for connecting the database to the connector. Now all the work that we are going to do with our Delphi application is going to be done through the connector to the database and back. I am using an XP machine, so your control panel applets will not necessarily be the same as mine. Please be aware of this.

    More Delphi-Kylix Articles
    More By Leidago


       · MYSQL is a very powerful and easy to use database server that is freely available...
     

    DELPHI-KYLIX ARTICLES

    - Constructing the Interface for an Internet A...
    - Building a Server Application for an Interne...
    - Building an Internet Access Control Applicat...
    - Client Dataset: Working with Data Packets an...
    - Using the Client Dataset in an N-Tiered Appl...
    - Using the Client Dataset in Two-Tiered Clien...
    - Using the Client Dataset in File-Based Archi...
    - Demystifying the Client Dataset
    - Working with INI Files in Delphi
    - Creating Data Link (UDL) Files in Delphi
    - Looking at the Details for an Invoicing Appl...
    - Invoicing in Delphi: Show Me the Money
    - Saving Images and Binary Files to a Database...
    - Saving Files to a Database using Delphi: Sav...
    - Creating CF Applications and Integrating a S...







    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway