Delphi remote connection MySQL

Source: Internet
Author: User
Tags mysql odbc driver

Delphi via adoconnection link remote MySQL database, to install the software on the computer installed MySQL driver, not 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; ';


Explain the variable meaning above

Driver= indicates the name of the drive used,

server= represents the MySQL database address, remote direct write remote IP

Database= indicates the name of the database you want to link to

user= Database user Name

password= Database Password

Option= indicates the port

Charset= indicates the character encoding used


Link Data start

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


Finally, the record is added to the form with the adoconnection control

Delphi remote connection MySQL

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.