Delphi & MySQL

Posted on 2004-11-03
Last Modified: 2010-04-05
I am trying to build an app using MySQL and of course Delphi with Zeos components.
So... I need to deploy my application to my client that has a small LAN and will be using my app on all the computers. One of the computers will be the server for my MYSQL database and the rest of the users will access the DB through LAN.
So far I used MS ACCESS for my apps and used ODBC. Now with Zeos I connect directly to the MYSQL database so there's no need for ODBC :)
My problems are
1... Do I need to build 2 different apps (one for use on the server and the other for the use on the rest of the LAN members) ?
2... If so... then what settings do I need to make on the server/(and)or the client to make it work.
        (rigth now it tells me that "host is not allowed to connect to this MYSQL Server" where the host is the workstation not the server, and the MySQL server is on a Windown XP)

To be short tell me what should I do to be able to connect to my MySQL server that is installed on an XP from a Win98 from LAN running a ZeosLib powered delphi application. I repeat I am no expert in MySQL.
Question by:Ghitza
    LVL 17

    Expert Comment

    by:Wim ten Brink
    You're trying to create a multi-tier application and you're going to implement the communication between client and server yourself? Well, good luck because that's a task of herculean proportions. I think even Herculus would prefer to clean some dirty stables than choose for this solution.

    First of all, you will have to work on at least two projects. First of all the client application that will just be a simple executable that connects to the server. And then the server application that could be a simple executable too. But it could also be a system service running in the background. Or a COM+ component that's installed in a COM+ application. Or even a webservice application combined with IIS so you could easily access the data through the SOAP API's.

    The settings you'll need depend completely on your environment and the server solution that you choose. I think the easiest way would be by creating a webservice, although Delphi has some few flaws in it's webservice implementation. (Datetime and booleans are wrongly implemented.) But a webservice just integrates with IIS and just requires you to connect to the server as if it's a webpage. Your client would have to implement some SOAP client stuff but it could easily do this since Delphi 7 has some nice wizards for this.

    If you use these techniques then technically, your clients won't need the ZEOS libraries. But you will have to find a way to send over the datasets from the server to the client. Midas might be useful. Or just create your own protocol to send over the data.
    LVL 3

    Author Comment

    Nothing that big...
    I only want to replace my Access database with MySql database. I already have the application that is running just fine with ADO and MS ACCESS. But considering the price for the MSAccess licence and the one for MySql :).... and not to forget that MySQL is a lot faster that Access I decided to migrate my application to MySQL. So practicaly this is what I need. Help migrate my application , and configuration for the MySQL in order to force it to accept incomming connection from LAN.
    My Application does not use web. It's a simple app that connects to a mdb and makes updates, inserts, selects on it returning datasets or not.
       Sorry if my english made you understand my question wrong.
    I am still waiting for someone that need my points :)
    I am sure there must be someone out there that did the same thing.... (I hope)
    LVL 5

    Expert Comment

    You simply need to grant some privileges to the user your application connects as to connect from multiple hosts.

    See the GRANT command in the MySQL Manual:

    You can use '%' as the host name to allow the user access from any host.
    LVL 11

    Accepted Solution

    Use MySQLCC on the server from the MySQL website, and on the User administration... right click on it... and choose new user. A new page will appear. Username... your username, host ... your remote host. On the new page choose the rights you want to give to the user, check the "with Grant option" on the bottom of the page, and on the right of the page check the databases you want to allow access to your user.
    Then Apply and Close.
     You will be able to connect from the remote host to your server now.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
    Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Hi everyone! This is Experts Exchange customer support.  This quick video will show you how to change your primary email address.  If you have any questions, then please Write a Comment below!

    733 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now