Delphi remote connection MySQL implementation method _delphi

Source: Internet
Author: User
Tags odbc mysql odbc driver

This article tells the Delphi remote connection MySQL realization method, is the Delphi database design very important skill. Share for everyone to use for reference. The specific methods are as follows:

Delphi via adoconnection link remote MySQL database, to install software on the computer installed MySQL driver, no in Baidu download, search MySQL ODBC driver came out

The main link code is as follows:

var srstring:string;

Srstring:= ' Driver={mysql ODBC 3.51 DRIVER}; Server= ' +trim (SERVER. Text) + ';D atabase= ' +trim (DATABASE. Text) + '; User= ' +trim (USER. Text) + '; Password= ' +trim (PASSWORD. Text) + '; option= ' +trim OPTION. Text) + '; charset=gb2312; ';

Here is a description of the variable meaning above:

Driver= represents the driver name used,

Server= represents the MySQL database address , remote directly write remote IP

Database= represents the name of the database to which you want to link

user= Database user name

password= Database Password

option= represents Port

Charset= represents the character encoding used

Link Data start:

adoconnection1.connectionstring:=srstring;
Adoconnection1.close;
Adoconnection1.open;
ShowMessage (' Save and Login Database success! ');

Finally, add the ADOConnection control to the form.

I hope this article on the Delphi Database program design help.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.