#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2007
    Posts
    177
    Rep Power
    40

    MYSQL ACCESS through DELPHI


    Hi All.

    I have been using myODBC to connect to mysql database for ages. I want to bypass the SETUP of myodbc and connect directly to the database.
    A typical setup for my program is setup as follows.
    1) Install the DELPHI enviroment
    2) Install MYODBC
    3) Install my PROGRAM
    4) Setup 4 ODBC connectings in windows (i have 4 databases for my program).

    So ideally what i would like is to remove point 4 from the equation? I googled and i just cannot get an answer.

    In my program i setup my ODBC connection like this (i only show one i have 4 of those)

    Code:
           
           db1.DatabaseName := 'myodbc_db1';
           db1.AliasName := 'myodbc_db1';
           db1.Params.Add('USER NAME=localuser');
           db1.Params.Add('PASSWORD=localpassword');
           db1.Connected := true;
    db1 is a database component. I know this code is very primitive. But it has been working for years. Its time for a change.

    Any ideas?
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2017
    Posts
    2
    Rep Power
    0
    Which version of Delphi are you using, and are you developing only for Windows?

    If your application is strictly for windows, then I suggest you download the free ZEOS database components.
    Depending on which version of Delphi you have you can either download the latest version from: https://sourceforge.net/projects/zeoslib/

    and if an older Delphi not supported by that version, then download version 6.6 here: https://sourceforge.net/projects/zeo...-6.6.6-stable/

    With ZEOS, you don't rely on ODBC, but do need the MySQL DLL (filename: libmysql.dll) that you can get from here: https://dev.mysql.com/downloads/connector/c/

    in the zip file it is located in the \lib\ directory, if you download the installer, not sure where it puts the dll, but you'd need to find it and make sure the dll is placed the your and any target computer either in the same directory as the application or on the path somewhere.

    ZEOS also has support via a forum here: Zeoslib Portal - Index page
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2007
    Posts
    177
    Rep Power
    40
    Originally Posted by rojam
    Which version of Delphi are you using, and are you developing only for Windows?

    If your application is strictly for windows, then I suggest you download the free ZEOS database components.
    Depending on which version of Delphi you have you can either download the latest version from: https://sourceforge.net/projects/zeoslib/

    and if an older Delphi not supported by that version, then download version 6.6 here: https://sourceforge.net/projects/zeo...-6.6.6-stable/

    With ZEOS, you don't rely on ODBC, but do need the MySQL DLL (filename: libmysql.dll) that you can get from here: https://dev.mysql.com/downloads/connector/c/

    in the zip file it is located in the \lib\ directory, if you download the installer, not sure where it puts the dll, but you'd need to find it and make sure the dll is placed the your and any target computer either in the same directory as the application or on the path somewhere.

    ZEOS also has support via a forum here: Zeoslib Portal - Index page
    Thanks Rojam

    I could ve used firedac as well probably. My only problem with these components is that i need to replace all my current queries with those components.
    With roughly 600 plus forms it will take me ages. But if there is no other solution i guess we need to do it. Thanks for your help. I'll definitely look into ZeosLib.

IMN logo majestic logo threadwatch logo seochat tools logo