connect to mysql database using 6.6xx

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
yonghan
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 24.06.2007, 05:58
Contact:

connect to mysql database using 6.6xx

Post by yonghan »

Hi..i want to ask how to connect to a mysql datbase.Also if i want to distribute the application?What must i include in the setup application?Thx a lot.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

1. How to connect to a mysql database:
Drop a TZconnectioncomponent on a form and set protocol to 'mysql' (or even better mysql-x, where x is the version). Set user, host and password. This can all be done at design time in the property inspector. When active is set to true a connection will be made.
2. To be able to run your application (or make a connection from the IDE) the system must be able to find the libmysql.dll file. (or the libmysqlxx.dll file) When running a standalone exe file just drop the dll next to your executable or in the system path. When running from the IDE the dll must be available in the system path. (ind win32\system32 should be OK on windows systems)
3. When adding to a setup application be carefull with licencing stuff. Mysql is a licenced product, so make sure you are allowed to distribute/package it with your application. Maybe you have to tell your client he should take the dll from his own mysql distribution or you need a mysql OEM licence.

Mark
yonghan
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 24.06.2007, 05:58
Contact:

If i include the mysql?

Post by yonghan »

I'll give it a try.Thanks a lot.
yonghan
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 24.06.2007, 05:58
Contact:

Post by yonghan »

Sorry,i want to ask again.How to choose a database that i will be using?What file will it be used?Thanks a lot.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

Set this TZConnection properties:
- Protocol : mysql (or mysql-xx depending on your version, when you choose mysql, mysql-5 protocol will be used)
- Host : the server ip or name (default =empty -> localhost)
- Port : server port number (0=default mysql port)
- Database : the database name in the mysql server.
- User : the database user you connect with
- Password : the password the user needs to connect to the server.
yonghan
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 24.06.2007, 05:58
Contact:

need help again..

Post by yonghan »

Hi..i want to ask again.What format of database should i choose? *.myi or which one.Thanks a lot.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

just the database name. Not a FILEname. How do you connect using the mysql console? First time you use mysql?
yonghan
Fresh Boarder
Fresh Boarder
Posts: 5
Joined: 24.06.2007, 05:58
Contact:

Sorry,i've succeded.

Post by yonghan »

I've succeeded connect.Sorry if i ask again.When i want to distribute the program,must the dcu's included in the setup?Thanks a lot.
User avatar
mdaems
Zeos Project Manager
Zeos Project Manager
Posts: 2766
Joined: 20.09.2005, 15:28
Location: Brussels, Belgium
Contact:

Post by mdaems »

No, not at all.

You need your exe and the libmysql file you use.
If you work with runtime libraries you will have to distribute them as well. Zeoslib can also be used this way, but I suppose you're not that an advanced user yet. ;)
Post Reply