|
Replies:
20
-
Last Post:
Oct 21, 2015 2:53 AM
Last Post By: Andrea Kaiser
|
|
|
Posts:
63
Registered:
11/17/15
|
|
1. I drop a TFDPhysMySQLDriverLink on a form:
Name: FDPhysMySQLDriverLink1
DriverId: MySQL_DriverID
VendorLib: C:\Temp\Test\MySQL_Release\libmysqld.dll
2. I drop a TFDConnection on the form:
Name: FDConnection1
DriverName: FDPhysMySQLDriverLink1
3. I use the connection editor of FDConnection1, fill in the fields:
Database: Test
User_Name, Server, Port etc.
I click the button "Test" - Connection OK!
4. I drop a TFDQuery on the form:
Name: FDQuery1
Connection: FDConnection1
5. I use the Query editor of FdQuery1 and enter as an SQL statement: "select * from address"
6. When I execute it, the following message appears: [FireDAC][Phys][MySQL] Table 'test.address' doesn't exist. But, of course, this table DOES exist.
What am I doing wrong?
|
|
|
Posts:
1,406
Registered:
12/7/03
|
|
6. When I execute it, the following message appears: [FireDAC][Phys][MySQL] Table 'test.address' doesn't exist. But, of course, this table DOES exist.
How you have verified that 'address' table exists in 'test' database ?
--
With best regards,
Dmitry Arefiev / FireDAC Architect
|
|
|
|
Posts:
63
Registered:
11/17/15
|
|
6. When I execute it, the following message appears: [FireDAC][Phys][MySQL] Table 'test.address' doesn't exist. But, of course, this table DOES exist.
How you have verified that 'address' table exists in 'test' database ?
--
With best regards,
Dmitry Arefiev / FireDAC Architect
Yes, 'address' exists in the 'test' database.
I tried a lot of other things to connect MySQL to FireDAC, I consulted tutorials - nothing seems to work.
|
|
|
|
Posts:
1,406
Registered:
12/7/03
|
|
Yes, 'address' exists in the 'test' database.
How you have verified that 'address' table exists in 'test' database ?
--
With best regards,
Dmitry Arefiev / FireDAC Architect
|
|
|
|
Posts:
63
Registered:
11/17/15
|
|
Yes, 'address' exists in the 'test' database.
How you have verified that 'address' table exists in 'test' database ?
--
With best regards,
Dmitry Arefiev / FireDAC Architect
I can manage and check it with Delphi 7 and SqlDirect. This table is definitely there.
|
|
|
|
Posts:
63
Registered:
11/17/15
|
|
To get to the bottom of this, I decided to fill out everything in the code and then try to create a db and a table. Just to make sure.
I put the components on the form, but don't edit any settings. I do this in a procedure.
When I hit the button that activates this procedure, the program just closes without any messages:
with FDPhysMySQLDriverLink1 do begin
DriverID := 'MySQL';
VendorLib := 'C:\Temp\Test_FireDAC\MySQL_Release\libmysqld.dll';
end;
with FDConnection1 do begin
DriverName := 'MySQL';
LoginPrompt := false;
Params.Database := 'Test';
Params.DriverID := 'MySQL';
Params.UserName := 'root';
Connected := true; <----- Here the program crashes
end;
with FDQuery1 do begin
Connection := FDConnection1;
SQL.Add('select * from address');
end;
|
|
|
|
Posts:
1,406
Registered:
12/7/03
|
|
|
|
|
Posts:
63
Registered:
11/17/15
|
|
First of all, thanks for your time, Dmitry, it's much appreciated.
I'm evaluating Delphi 10 Seattle Architect and since FireDAC seems to be the new hot thing,
I try to establish any SQL-Connections with those components.
Thanks for the link, I added embedded arguments.
I changed the VendorLib and the basedir to the original installation of MySQL (4.0.17).
Not sure about the '--skip-innodb', but this is surely not the problem.
with FDPhysMySQLDriverLink1 do begin
DriverID := 'MySQL';
EmbeddedArgs.Add('--basedir=<C:\MySQL>');
EmbeddedArgs.Add('--datadir=<C:\Server\MySQL>');
EmbeddedArgs.Add('--skip-innodb');
VendorLib := 'C:\MySQL\Embedded\DLL\release\libmysqld.dll';
end;
with FDConnection1 do begin
DriverName := 'MySQL';
LoginPrompt := false;
Params.Database := 'Test';
Params.DriverID := 'MySQL';
Params.UserName := 'root';
Connected := true; <---- still crashes here
end;
use test;
select * from address;
Yes, it works - I receive all records from this table.
|
|
|
|
Posts:
856
Registered:
12/2/99
|
|
Try making a connection on Data Explorer. Is the table listed under
tables? If so, drag and drop the database and table from Data Explorer
onto a form. Then look at TFDQuery that gets created and see how it is
different.
Andrea Kaiser wrote:
1. I drop a TFDPhysMySQLDriverLink on a form:
Name: FDPhysMySQLDriverLink1
DriverId: MySQL_DriverID
VendorLib: C:\Temp\Test\MySQL_Release\libmysqld.dll
2. I drop a TFDConnection on the form:
Name: FDConnection1
DriverName: FDPhysMySQLDriverLink1
3. I use the connection editor of FDConnection1, fill in the fields:
Database: Test
User_Name, Server, Port etc.
I click the button "Test" - Connection OK!
4. I drop a TFDQuery on the form:
Name: FDQuery1
Connection: FDConnection1
5. I use the Query editor of FdQuery1 and enter as an SQL statement: "select * from address"
6. When I execute it, the following message appears: [FireDAC][Phys][MySQL] Table 'test.address' doesn't exist. But, of course, this table DOES exist.
What am I doing wrong?
|
|
|
|
Posts:
63
Registered:
11/17/15
|
|
Try making a connection on Data Explorer. Is the table listed under
tables? If so, drag and drop the database and table from Data Explorer
onto a form. Then look at TFDQuery that gets created and see how it is
different.
With the data explorer the problem with the vendor lib occurs again.
Has anybody a sample how I connect in a simple way FireDAC with MySQL? I prefer code instead of properties - so it's easier to understand.
|
|
|
|
Posts:
1,406
Registered:
12/7/03
|
|
Has anybody a sample how I connect in a simple way FireDAC with MySQL? I prefer code instead of properties - so it's easier to understand.
Do you really need MySQL Embedded ? If not then:
* specify libmysql.dll instead of libmysqld.dll
* remove EmbeddedArgs
* try to connect to your MySQL server.
--
With best regards,
Dmitry Arefiev / FireDAC Architect
|
|
|
|
Posts:
63
Registered:
11/17/15
|
|
Do you really need MySQL Embedded ? If not then:
* specify libmysql.dll instead of libmysqld.dll
* remove EmbeddedArgs
* try to connect to your MySQL server.
--
With best regards,
Dmitry Arefiev / FireDAC Architect
I changed the code:
with FDPhysMySQLDriverLink1 do begin
DriverID := 'MySQL';
VendorLib := 'C:\MySQL\bin\libmySQL.dll';
end;
with FDConnection1 do begin
DriverName := 'MySQL';
LoginPrompt := false;
Params.Database := 'Test';
Params.DriverID := 'MySQL';
Params.UserName := 'root';
Connected := true;
end;
with FDQuery1 do begin
Connection := FDConnection1;
SQL.Add('select * from address');
Active := true; <----- Crash
end;
and I get an access violation, when the program activates the FDQuery1 component:
Access violation at 151EDC04 in 'FireDACCommon230.bpl'. read of address 00000035
Should I use another component than FireDAC to connect to MySQL? What would be the best component for that in Delphi 10 Seattle?
|
|
|
|
Posts:
1,406
Registered:
12/7/03
|
|
Please post your test application to attachments forum and I will review it.
--
With best regards,
Dmitry Arefiev / FireDAC Architect
|
|
|
|
Posts:
63
Registered:
11/17/15
|
|
|
|
|
Posts:
1,406
Registered:
12/7/03
|
|
1) It is strange that you are getting AV in FireDACCommon230.bpl, but your
project does not have "Link with runtime packages" = True. Do you really get
described AV when you run your application ?
2) Could you please post to attachments also your libmysql.dll.
--
With best regards,
Dmitry Arefiev / FireDAC Architect
|
|
|
|
Posts:
63
Registered:
11/17/15
|
|
1) It is strange that you are getting AV in FireDACCommon230.bpl, but your
project does not have "Link with runtime packages" = True. Do you really get
described AV when you run your application ?
2) Could you please post to attachments also your libmysql.dll.
--
With best regards,
Dmitry Arefiev / FireDAC Architect
1) Yes, I really get this AV with the exact project I attached.
2) Done in the attachment forum: https://forums.embarcadero.com/thread.jspa?messageID=712702#712702
|
|
|
|
Posts:
1,406
Registered:
12/7/03
|
|
1) Yes, I really get this AV with the exact project I attached.
Strange ...
This is a bug in libmysql.dll v 4.0.17, which returns uninitialized pointer
in one place. There are two basic options:
* upgrade libmysql.dll to 5.0.xxx series. Not higher, because probably
it will be incompatible with 4.0.17 server.
* upgrade both client and server to current MySQL versions.
--
With best regards,
Dmitry Arefiev / FireDAC Architect
|
|
|
|
Posts:
63
Registered:
11/17/15
|
|
This is a bug in libmysql.dll v 4.0.17, which returns uninitialized pointer
in one place. There are two basic options:
* upgrade libmysql.dll to 5.0.xxx series. Not higher, because probably
it will be incompatible with 4.0.17 server.
* upgrade both client and server to current MySQL versions.
--
With best regards,
Dmitry Arefiev / FireDAC Architect
This bug never occurred in Delphi 7 with SqlDirect oder ADO components.
I have a problem with upgrading: a lot of my customers use MySQL 4 and I can't force them to upgrade.
Isn't there another solution? Like using embedded MySQL in FireDAC?
|
|
|
|
Posts:
63
Registered:
11/17/15
|
|
I installed MySQL 5.5 and it worked.
Thanks a lot for your help, Dmitry!
Now I' going to test how I can get information about the SQL data definition (tables, fields etc) of any database via FireDAC.
Can you point me in the right direction?
|
|
|
|
Posts:
1,406
Registered:
12/7/03
|
|
This bug never occurred in Delphi 7 with SqlDirect oder ADO components.
Because they use less DBMS API information than FireDAC.
Isn't there another solution?
You can change FireDAC sources to workaround this issue.
Now I' going to test how I can get information about the SQL data definition (tables, fields etc) of any database via FireDAC.
Can you point me in the right direction?
http://docwiki.embarcadero.com/RADStudio/Seattle/en/Working_with_Metadata_%28FireDAC%29
--
With best regards,
Dmitry Arefiev / FireDAC Architect
|
|
|
|
Posts:
63
Registered:
11/17/15
|
|
This bug never occurred in Delphi 7 with SqlDirect oder ADO components.
Because they use less DBMS API information than FireDAC.
Isn't there another solution?
You can change FireDAC sources to workaround this issue.
Now I' going to test how I can get information about the SQL data definition (tables, fields etc) of any database via FireDAC.
Can you point me in the right direction?
http://docwiki.embarcadero.com/RADStudio/Seattle/en/Working_with_Metadata_%28FireDAC%29
--
With best regards,
Dmitry Arefiev / FireDAC Architect
Thank you very much.
|
|
|
|
Legend
|
|
Helpful Answer
(5 pts)
|
|
Correct Answer
(10 pts)
|
|
Connect with Us