Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Closed Thread
 
Thread Tools Display Modes
  #1  
Old 04-24-2016, 10:11 AM
lexd lexd is offline
Senior Member
 
Join Date: Feb 2015
Posts: 268
Default ODBC 32 bit, MySQL, Delphi 7, Windows 7

I have loaded MySQL 5.7
Then loaded MySQL 3.51 ODBC connector because the MySQL 5.7 connector 32 bit will not install (only 64 bit).
started windows odbcad32.exe 32 bit from sysWOW64 directory
Set up MySQL using the 'sys' database (already in MySQL)

started Delphi 7, went DBExpress and placed TSQLConnection on form
Renamed it to SqlConn

double clicked form to get FormCreate

HTML Code:
procedure TForm1.FormCreate(Sender: TObject);
begin
     SqlConn.DriverName := 'dbxmysql';
     SqlConn.GetDriverFunc := 'getSQLDriverMYSQL50';
     SqlConn.VendorLib := 'libmysql.dll';
     SqlConn.LibraryName := 'dbxopenmysql50.dll';

     SqlConn.Params.Values['HostName'] := 'localhost';// as setup in dbcad32
     SqlConn.Params.Values['Database'] := 'sys';
     SqlConn.Params.Values['User_Name'] := 'root';// as setup in odbcad32
     SqlConn.Params.Values['Password'] := 'admin';// as setup in odbcad32
     SqlConn.LoginPrompt := false;
     SqlConn.Open;// error unable to load LibMySQL.dll
         // Delphi stops hear
     SqlConn.Free;
end;
Note I have been using the dbxopenmysql50.dll too as well as the default
dll as set by DBExpress.

What is my options
1/ Use another MySQL connector
2/ is SqlConn.DriverName correct
any other options

The computer I'm using is fairly clean.
But detail on testing has got past many errors
  #2  
Old 04-24-2016, 05:58 PM
rojam rojam is offline
Senior Member
 
Join Date: Jun 2015
Posts: 198
Default

Do you have the 32 bit libmysql.dll either in the folder with your executable or in the c:\windows\sysWOW64 directory? (for 64bit either in the executable folder or in the c:\windows\system32 directory) If not, it's not going to be able to find the file. You can download the file from here. Pick the C Driver for MySQL (Connector C) then select the zip 32 and/or 64 bit and within the lib directory of the zip, you'll find libmysql.dll. Copy that file and place it in the appropriate directory.

(BTW: I did get the directories correct, sysWOW64 is for 32 bit and system32 is for 64 bit).

Another option is to use ZEOS, but since you are using an older version of Delphi, you'll be stuck on an older version of the ZEOS connector, which you can download here. You'll also need libmysql.dll for ZEOS also though.
  #3  
Old 04-25-2016, 12:15 AM
lexd lexd is offline
Senior Member
 
Join Date: Feb 2015
Posts: 268
Default

I found Custom install gave me a full x86 install that installed in 'Program files (x86)'.
That means I have a x86 libmysql.dll installed
re ran C:\Windows\SysWOW64\odbcad32.exe and set up

compared my odbcad32.exe new setting to DBExpress\SQLConnection
Data source name: - MySQL sys
tcp/ip:- localhost
User: - root
database: - sys


delphi connection
HTML Code:
        SqlConn.DriverName := 'MySQL sys';
        SqlConn.GetDriverFunc := 'getSQLDriverMYSQL50';
        SqlConn.VendorLib := 'libmysql.dll';
        SqlConn.LibraryName := 'dbxopenmysql50.dll';

        SqlConn.Params.Values['HostName'] := 'localhost';
        SqlConn.Params.Values['Database'] := 'sys';
        SqlConn.Params.Values['User_Name'] := 'root';
        SqlConn.Params.Values['Password'] := 'admin';
        SqlConn.LoginPrompt := false;
        SqlConn.Open; // error unable to load LibMySQL.dll
        SqlConn.Free;
1/ is dbxopenmysql50.dll to be installed with libmysql.dll
Both found with start\run editor ok
2/ or is it these link details
  #4  
Old 04-25-2016, 12:21 AM
lexd lexd is offline
Senior Member
 
Join Date: Feb 2015
Posts: 268
Default

I got a 3rd party program to log on with out a password
and it worked
whats going on?
  #5  
Old 04-25-2016, 04:03 AM
rojam rojam is offline
Senior Member
 
Join Date: Jun 2015
Posts: 198
Default

Quote:
Originally Posted by lexd View Post
I found Custom install gave me a full x86 install that installed in 'Program files (x86)'.
libmysql.dll must be either in the same directory as the executable or it must be somewhere in the PATH. If the error you are getting is that it can't load libmysql.dll then it is a simple problem that it cannot find it. libmysql.dll is not the type of dll that needs to be "installed" and installing the ODBC drivers for MySQL will NOT install the libmysql.dll

No idea how a 3rd party app can connecting without a password. I've got MySQL installed on my machine, and I can tell you I can connect with no problem, but it does need a username and password.

I also noticed that you are connecting to the database as "root" You should probably create another username and associated password and connect your application using those credentials. Have you installed MySQL Workbench? It gives the facility to administer your server.
  #6  
Old 04-25-2016, 06:46 AM
lexd lexd is offline
Senior Member
 
Join Date: Feb 2015
Posts: 268
Default

I have a MySQL database 5.7 working
The error was a bit funny, it mite be the data source name in inodbcad32.exe that I used, and I believe the custom install of mysql helped too.

I now have a error : - Invalid Precision Value when using parameters

So I guess i'm using data types that are not allowed

I have
integers //integer
unsigned integers // DWord
big integers // should be a int64
bit(1) // Boolean
decimal 4, 2 for currency
char or strings with size setting
blob string called text 0-65355 // this is like a separate file I gather, and should be a anscii string

what is not working with Delphi and especially for Data module
I have set default values too like true, 0 and 0.00
  #7  
Old 04-25-2016, 08:57 AM
lexd lexd is offline
Senior Member
 
Join Date: Feb 2015
Posts: 268
Default

I found it Null does not work in Delphi

The database is working in Delphi

Thanks rojam for talking me though
Closed Thread

Tags
delphi 7, mysql db, windows 7

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 09:05 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.